diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-11-13 21:04:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-13 21:04:23 +0100 |
| commit | a5372ed938b71b62a4dbc3fb01297ba6f32d66b3 (patch) | |
| tree | 81747791bdc08835d38aa1631ff480269332617f /compiler/rustc_target/src | |
| parent | 3376edac6d2c3648b398f59ac599dc6562faacdc (diff) | |
| parent | 295cffc4b4042edbbd24e1a2aa28ef84ffcd38ac (diff) | |
| download | rust-a5372ed938b71b62a4dbc3fb01297ba6f32d66b3.tar.gz rust-a5372ed938b71b62a4dbc3fb01297ba6f32d66b3.zip | |
Rollup merge of #132842 - veluca93:abi-checks-tier2, r=workingjubilee
ABI checks: add support for tier2 arches See #131800 for the data collection behind this change. r? RalfJung
Diffstat (limited to 'compiler/rustc_target/src')
| -rw-r--r-- | compiler/rustc_target/src/target_features.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index b7588b01814..88536926b11 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -586,9 +586,20 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> { // certain size to have their "proper" ABI on each architecture. // Note that they must be kept sorted by vector size. const X86_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = - &[(128, "sse"), (256, "avx"), (512, "avx512f")]; + &[(128, "sse"), (256, "avx"), (512, "avx512f")]; // FIXME: might need changes for AVX10. const AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "neon")]; +// We might want to add "helium" too. +const ARM_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "neon")]; + +const POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "altivec")]; +const WASM_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "simd128")]; +const S390X_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "vector")]; +const RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = + &[/*(64, "zvl64b"), */ (128, "v")]; +// Always warn on SPARC, as the necessary target features cannot be enabled in Rust at the moment. +const SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[/*(128, "vis")*/]; + impl super::spec::Target { pub fn rust_target_features(&self) -> &'static [(&'static str, Stability, ImpliedFeatures)] { match &*self.arch { @@ -613,8 +624,15 @@ impl super::spec::Target { pub fn features_for_correct_vector_abi(&self) -> Option<&'static [(u64, &'static str)]> { match &*self.arch { "x86" | "x86_64" => Some(X86_FEATURES_FOR_CORRECT_VECTOR_ABI), - "aarch64" => Some(AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI), - // FIXME: add support for non-tier1 architectures + "aarch64" | "arm64ec" => Some(AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI), + "arm" => Some(ARM_FEATURES_FOR_CORRECT_VECTOR_ABI), + "powerpc" | "powerpc64" => Some(POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI), + "loongarch64" => Some(&[]), // on-stack ABI, so we complain about all by-val vectors + "riscv32" | "riscv64" => Some(RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI), + "wasm32" | "wasm64" => Some(WASM_FEATURES_FOR_CORRECT_VECTOR_ABI), + "s390x" => Some(S390X_FEATURES_FOR_CORRECT_VECTOR_ABI), + "sparc" | "sparc64" => Some(SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI), + // FIXME: add support for non-tier2 architectures _ => None, } } |
