Skip to content

Add SIMD mask and select operations.#9749

Open
copybara-service[bot] wants to merge 1 commit intomasterfrom
test_886929409
Open

Add SIMD mask and select operations.#9749
copybara-service[bot] wants to merge 1 commit intomasterfrom
test_886929409

Conversation

@copybara-service
Copy link
Copy Markdown
Contributor

Add SIMD mask and select operations.

This change introduces a mask template to represent boolean masks for SIMD vectors. It includes:

  • Definition of the mask template in vec.h.
  • Overloaded comparison operators (==, !=, <, <=, >, >=) for vec types, returning mask types.
  • Overloaded bitwise operators (&, |, ^, ~) for mask types.
  • A select function to conditionally choose elements from two vectors based on a mask.
  • Specialized implementations for ARM NEON, x86 SSE2, AVX, and AVX512.
  • Generic implementations for multi_vec.
  • New test cases for compare and select operations.

This change introduces a `mask` template to represent boolean masks for SIMD vectors. It includes:
- Definition of the `mask` template in `vec.h`.
- Overloaded comparison operators (`==`, `!=`, `<`, `<=`, `>`, `>=`) for `vec` types, returning `mask` types.
- Overloaded bitwise operators (`&`, `|`, `^`, `~`) for `mask` types.
- A `select` function to conditionally choose elements from two vectors based on a `mask`.
- Specialized implementations for ARM NEON, x86 SSE2, AVX, and AVX512.
- Generic implementations for multi_vec.
- New test cases for compare and select operations.

PiperOrigin-RevId: 886929409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant