Skip to content

preseve SIMD element type information#155005

Draft
folkertdev wants to merge 1 commit intorust-lang:mainfrom
folkertdev:simd-element-type-llvm
Draft

preseve SIMD element type information#155005
folkertdev wants to merge 1 commit intorust-lang:mainfrom
folkertdev:simd-element-type-llvm

Conversation

@folkertdev
Copy link
Copy Markdown
Contributor

Preserve the SIMD element type and provide it to LLVM for better optimization.

This is relevant for AArch64 types like int16x4x2_t, see also llvm/llvm-project#181514. Such types are defined like so:

#[repr(simd)]
struct int16x4_t([i16; 4]);

#[repr(C)]
struct int16x4x2_t(pub int16x4_t, pub int16x4_t);

Previously this would be translated to the opaque [2 x <8 x i8>], with this PR it is instead [2 x <4 x i16>]. That change is not relevant for the ABI, but using the correct type prevents bitcasts that can (indeed, do) confuse the LLVM pattern matcher.

This change will make it possible to implement the deinterleaving loads on AArch64 in a portable way (without neon-specific intrinsics), which means that e.g. Miri or the cranelift backend can run them without additional support.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 8, 2026
@rust-log-analyzer

This comment has been minimized.

@folkertdev folkertdev force-pushed the simd-element-type-llvm branch from c1444a0 to 05b0368 Compare April 8, 2026 20:40
@rust-log-analyzer

This comment has been minimized.

and provide it to LLVM for better optimization
@folkertdev folkertdev force-pushed the simd-element-type-llvm branch from 05b0368 to 93d1e47 Compare April 8, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants