-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Neon types generate bad code if the "neon" target feature is disabled. #118249
Copy link
Copy link
Closed
Labels
A-target-featureArea: Enabling/disabling target features like AVX, Neon, etc.Area: Enabling/disabling target features like AVX, Neon, etc.C-bugCategory: This is a bug.Category: This is a bug.O-AArch64Armv8-A or later processors in AArch64 modeArmv8-A or later processors in AArch64 modeT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-target-featureArea: Enabling/disabling target features like AVX, Neon, etc.Area: Enabling/disabling target features like AVX, Neon, etc.C-bugCategory: This is a bug.Category: This is a bug.O-AArch64Armv8-A or later processors in AArch64 modeArmv8-A or later processors in AArch64 modeT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Compiled with
RUSTFLAGS=-Ctarget_feature=-neon(foraarch64-unknown-linux-gnu):Ideally,
trampolinewould fail to compile, because it does not have Neon and shouldn't be able to represent the vector types.trampoline(a, b)passes the arguments in memory (using the Rust ABI).add(a, b)tries to pass each argument in fourwregisters (each holding au32), as if they are tuples(u32, u32, u32, u32).v0andv1), so the result is unpredictable.If
test()— which has "neon" enabled — callsadd(a, b)directly, it usesv0andv1, as per AAPCS64.This is the AArch64 counterpart to #116344 and #114479, with the twist that on AArch64, it's preferable for Neon-specific types to fail to compile without the proper features. These aren't general-purpose types. At least some C compilers refuse to compile code that uses Neon types when
-mcpu=+nosimd+nofpis specified.Meta
This came out of a Zulip discussion.
rustc --version --verbose: