Skip to content

Commit ee0505d

Browse files
committed
ABI checks: add support for tier2 arches
See #131800 for the data collection behind this change.
1 parent 6689597 commit ee0505d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

compiler/rustc_target/src/target_features.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,12 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> {
582582
const X86_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] =
583583
&[(128, "sse"), (256, "avx"), (512, "avx512f")];
584584
const AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "neon")];
585+
const POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "altivec")];
586+
const RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] =
587+
&[(32, "zve32x"), (64, "zve64x"), (128, "zvl128b")];
588+
const WASM_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "simd128")];
589+
const S390X_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "vector")];
590+
const SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[(64, "v9")];
585591

586592
impl super::spec::Target {
587593
pub fn rust_target_features(&self) -> &'static [(&'static str, Stability, ImpliedFeatures)] {
@@ -607,8 +613,14 @@ impl super::spec::Target {
607613
pub fn features_for_correct_vector_abi(&self) -> Option<&'static [(u64, &'static str)]> {
608614
match &*self.arch {
609615
"x86" | "x86_64" => Some(X86_FEATURES_FOR_CORRECT_VECTOR_ABI),
610-
"aarch64" => Some(AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI),
611-
// FIXME: add support for non-tier1 architectures
616+
"arm" | "aarch64" => Some(AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI),
617+
"powerpc" | "powerpc64" => Some(POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI),
618+
"loongarch" => Some(&[]), // on-stack ABI, should never pass-by-vec.
619+
"riscv32" | "riscv64" => Some(RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI),
620+
"wasm32" | "wasm64" => Some(WASM_FEATURES_FOR_CORRECT_VECTOR_ABI),
621+
"s390x" => Some(S390X_FEATURES_FOR_CORRECT_VECTOR_ABI),
622+
"sparc" | "sparc64" => Some(SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI),
623+
// FIXME: add support for non-tier2 architectures
612624
_ => None,
613625
}
614626
}

0 commit comments

Comments
 (0)