@@ -863,17 +863,22 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> {
863
863
// These arrays represent the least-constraining feature that is required for vector types up to a
864
864
// certain size to have their "proper" ABI on each architecture.
865
865
// Note that they must be kept sorted by vector size.
866
- const X86_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
866
+ const X86_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
867
867
& [ ( 128 , "sse" ) , ( 256 , "avx" ) , ( 512 , "avx512f" ) ] ; // FIXME: might need changes for AVX10.
868
- const AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "neon" ) ] ;
868
+ const AARCH64_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
869
+ & [ ( 128 , "neon" ) ] ;
869
870
870
871
// We might want to add "helium" too.
871
- const ARM_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "neon" ) ] ;
872
+ const ARM_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
873
+ & [ ( 128 , "neon" ) ] ;
872
874
873
- const POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "altivec" ) ] ;
874
- const WASM_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "simd128" ) ] ;
875
- const S390X_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "vector" ) ] ;
876
- const RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [
875
+ const POWERPC_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
876
+ & [ ( 128 , "altivec" ) ] ;
877
+ const WASM_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
878
+ & [ ( 128 , "simd128" ) ] ;
879
+ const S390X_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
880
+ & [ ( 128 , "vector" ) ] ;
881
+ const RISCV_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [
877
882
( 32 , "zvl32b" ) ,
878
883
( 64 , "zvl64b" ) ,
879
884
( 128 , "zvl128b" ) ,
@@ -888,13 +893,16 @@ const RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[
888
893
( 65536 , "zvl65536b" ) ,
889
894
] ;
890
895
// Always error on SPARC, as the necessary target features cannot be enabled in Rust at the moment.
891
- const SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ /*(64, "vis")*/ ] ;
896
+ const SPARC_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
897
+ & [ /*(64, "vis")*/ ] ;
892
898
893
- const HEXAGON_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
899
+ const HEXAGON_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
894
900
& [ /*(512, "hvx-length64b"),*/ ( 1024 , "hvx-length128b" ) ] ;
895
- const MIPS_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "msa" ) ] ;
896
- const CSKY_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "vdspv1" ) ] ;
897
- const LOONGARCH_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
901
+ const MIPS_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
902
+ & [ ( 128 , "msa" ) ] ;
903
+ const CSKY_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
904
+ & [ ( 128 , "vdspv1" ) ] ;
905
+ const LOONGARCH_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
898
906
& [ ( 128 , "lsx" ) , ( 256 , "lasx" ) ] ;
899
907
900
908
#[ derive( Copy , Clone , Debug ) ]
@@ -927,27 +935,38 @@ impl Target {
927
935
}
928
936
}
929
937
930
- pub fn features_for_correct_vector_abi ( & self ) -> & ' static [ ( u64 , & ' static str ) ] {
938
+ pub fn features_for_correct_fixed_length_vector_abi ( & self ) -> & ' static [ ( u64 , & ' static str ) ] {
931
939
match & * self . arch {
932
- "x86" | "x86_64" => X86_FEATURES_FOR_CORRECT_VECTOR_ABI ,
933
- "aarch64" | "arm64ec" => AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI ,
934
- "arm" => ARM_FEATURES_FOR_CORRECT_VECTOR_ABI ,
935
- "powerpc" | "powerpc64" => POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI ,
936
- "loongarch32" | "loongarch64" => LOONGARCH_FEATURES_FOR_CORRECT_VECTOR_ABI ,
937
- "riscv32" | "riscv64" => RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI ,
938
- "wasm32" | "wasm64" => WASM_FEATURES_FOR_CORRECT_VECTOR_ABI ,
939
- "s390x" => S390X_FEATURES_FOR_CORRECT_VECTOR_ABI ,
940
- "sparc" | "sparc64" => SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI ,
941
- "hexagon" => HEXAGON_FEATURES_FOR_CORRECT_VECTOR_ABI ,
942
- "mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_FEATURES_FOR_CORRECT_VECTOR_ABI ,
940
+ "x86" | "x86_64" => X86_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
941
+ "aarch64" | "arm64ec" => AARCH64_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
942
+ "arm" => ARM_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
943
+ "powerpc" | "powerpc64" => POWERPC_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
944
+ "loongarch32" | "loongarch64" => LOONGARCH_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
945
+ "riscv32" | "riscv64" => RISCV_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
946
+ "wasm32" | "wasm64" => WASM_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
947
+ "s390x" => S390X_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
948
+ "sparc" | "sparc64" => SPARC_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
949
+ "hexagon" => HEXAGON_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
950
+ "mips" | "mips32r6" | "mips64" | "mips64r6" => {
951
+ MIPS_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI
952
+ }
943
953
"nvptx64" | "bpf" | "m68k" => & [ ] , // no vector ABI
944
- "csky" => CSKY_FEATURES_FOR_CORRECT_VECTOR_ABI ,
954
+ "csky" => CSKY_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
945
955
// FIXME: for some tier3 targets, we are overly cautious and always give warnings
946
956
// when passing args in vector registers.
947
957
_ => & [ ] ,
948
958
}
949
959
}
950
960
961
+ pub fn features_for_correct_scalable_vector_abi ( & self ) -> Option < & ' static str > {
962
+ match & * self . arch {
963
+ "aarch64" | "arm64ec" => Some ( "sve" ) ,
964
+ "riscv32" | "riscv64" => todo ! ( ) ,
965
+ // Other targets have no scalable vectors.
966
+ _ => None ,
967
+ }
968
+ }
969
+
951
970
pub fn tied_target_features ( & self ) -> & ' static [ & ' static [ & ' static str ] ] {
952
971
match & * self . arch {
953
972
"aarch64" | "arm64ec" => AARCH64_TIED_FEATURES ,
0 commit comments