Skip to content

core_arch: redefine svrev, svzip and svuzp#2163

Merged
adamgemmell merged 2 commits into
rust-lang:mainfrom
davidtwco:intrinsic-redefinition-svrev-svzip-svuzp
Jun 16, 2026
Merged

core_arch: redefine svrev, svzip and svuzp#2163
adamgemmell merged 2 commits into
rust-lang:mainfrom
davidtwco:intrinsic-redefinition-svrev-svzip-svuzp

Conversation

@davidtwco

@davidtwco davidtwco commented Jun 16, 2026

Copy link
Copy Markdown
Member

Split out from #2160.

Clang uses the llvm.aarch64.sve.rev.bN intrinsic for svrev with b16, b32 and b64. Likewise with llvm.aarch64.sve.zip.bN for svzip and llvm.aarch64.sve.uzp.bN for svuzp. This required small generator changes so it knew a bool-to-bool conversion was a no-op and a new blanket identity impl of SveInto so the calls generated compile. These intrinsics were just returning the wrong value prior to this change, but obviously this isn't tested until #2160 lands.

r? @adamgemmell

Clang uses the `llvm.aarch64.sve.rev.bN` intrinsic for `svrev` with
`b16`, `b32` and `b64`. This required small generator changes so it knew
a bool-to-bool conversion was a no-op and a new blanket identity impl of
`SveInto` so the calls generated compile.
Clang uses the `llvm.aarch64.sve.zip.bN` intrinsic for `svzip` with
`b16`, `b32` and `b64` and the `llvm.aarch64.sve.uzp.bN` intrinsic for
`svuzp` with the same types.
@davidtwco davidtwco changed the title core_arch: redefine svrev_b{16,32,64} core_arch: redefine svrev, svzip and svuzp Jun 16, 2026
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.vector.reverse.nxv8i1")]
fn _svrev_b16(op: svbool8_t) -> svbool8_t;
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.sve.rev.b16")]
fn _svrev_b16(op: svbool_t) -> svbool_t;

@adamgemmell adamgemmell Jun 16, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change away from lane-count-specific svbool types? I think LLVM still uses them

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting a signature mismatch between the LLVM intrinsic and our signature here without this change.

@adamgemmell adamgemmell Jun 16, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, this https://godbolt.org/z/8v1W7TnYq is little odd considering all the other intrinsics seem to use different lane counts for their predicates

@adamgemmell adamgemmell added this pull request to the merge queue Jun 16, 2026
Merged via the queue into rust-lang:main with commit 6332f19 Jun 16, 2026
82 checks passed
@davidtwco davidtwco deleted the intrinsic-redefinition-svrev-svzip-svuzp branch June 16, 2026 14:57
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