Skip to content

Add reverse() to both vectors and masks - #356

Merged
Shnatsel merged 3 commits into
linebender:mainfrom
Shnatsel:reverse
Aug 30, 2026
Merged

Add reverse() to both vectors and masks#356
Shnatsel merged 3 commits into
linebender:mainfrom
Shnatsel:reverse

Conversation

@Shnatsel

Copy link
Copy Markdown
Contributor

This deserves its own op because it has better lowerings than swizzle_dyn: we can splt/combine to move data across blocks for free in larger-than-native vectors, e.g. for 512-bit vectors on SSE4.2.

Other than the block split, it just reuses swizzle_dyn under the hood, so the implementation is generic and pretty clean.

Masks also get this op, lowering into either a bitcast into a vector on most backends or into scalar ops on a packed mask on AVX-512.

Matches std::simd API

This has better lowerings than swizzle_dyn_precise because we can splt/combine for free to move data across blocks for larger-than-native vectors, e.g. 512-bit vectors on SSE4.2
@Shnatsel Shnatsel mentioned this pull request Aug 27, 2026
22 tasks
@Shnatsel
Shnatsel added this pull request to the merge queue Aug 30, 2026
Merged via the queue into linebender:main with commit 6eb7f83 Aug 30, 2026
22 checks passed
@Shnatsel
Shnatsel deleted the reverse branch August 30, 2026 09:00
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.

2 participants