@@ -797,17 +797,22 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> {
797
797
// These arrays represent the least-constraining feature that is required for vector types up to a
798
798
// certain size to have their "proper" ABI on each architecture.
799
799
// Note that they must be kept sorted by vector size.
800
- const X86_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
800
+ const X86_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
801
801
& [ ( 128 , "sse" ) , ( 256 , "avx" ) , ( 512 , "avx512f" ) ] ; // FIXME: might need changes for AVX10.
802
- const AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "neon" ) ] ;
802
+ const AARCH64_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
803
+ & [ ( 128 , "neon" ) ] ;
803
804
804
805
// We might want to add "helium" too.
805
- const ARM_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "neon" ) ] ;
806
+ const ARM_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
807
+ & [ ( 128 , "neon" ) ] ;
806
808
807
- const POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "altivec" ) ] ;
808
- const WASM_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "simd128" ) ] ;
809
- const S390X_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "vector" ) ] ;
810
- const RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [
809
+ const POWERPC_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
810
+ & [ ( 128 , "altivec" ) ] ;
811
+ const WASM_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
812
+ & [ ( 128 , "simd128" ) ] ;
813
+ const S390X_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
814
+ & [ ( 128 , "vector" ) ] ;
815
+ const RISCV_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [
811
816
( 32 , "zvl32b" ) ,
812
817
( 64 , "zvl64b" ) ,
813
818
( 128 , "zvl128b" ) ,
@@ -822,13 +827,16 @@ const RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] = &[
822
827
( 65536 , "zvl65536b" ) ,
823
828
] ;
824
829
// Always error on SPARC, as the necessary target features cannot be enabled in Rust at the moment.
825
- const SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ /*(64, "vis")*/ ] ;
830
+ const SPARC_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
831
+ & [ /*(64, "vis")*/ ] ;
826
832
827
- const HEXAGON_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
833
+ const HEXAGON_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
828
834
& [ /*(512, "hvx-length64b"),*/ ( 1024 , "hvx-length128b" ) ] ;
829
- const MIPS_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "msa" ) ] ;
830
- const CSKY_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] = & [ ( 128 , "vdspv1" ) ] ;
831
- const LOONGARCH_FEATURES_FOR_CORRECT_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
835
+ const MIPS_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
836
+ & [ ( 128 , "msa" ) ] ;
837
+ const CSKY_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
838
+ & [ ( 128 , "vdspv1" ) ] ;
839
+ const LOONGARCH_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI : & ' static [ ( u64 , & ' static str ) ] =
832
840
& [ ( 128 , "lsx" ) , ( 256 , "lasx" ) ] ;
833
841
834
842
#[ derive( Copy , Clone , Debug ) ]
@@ -860,27 +868,38 @@ impl Target {
860
868
}
861
869
}
862
870
863
- pub fn features_for_correct_vector_abi ( & self ) -> & ' static [ ( u64 , & ' static str ) ] {
871
+ pub fn features_for_correct_fixed_length_vector_abi ( & self ) -> & ' static [ ( u64 , & ' static str ) ] {
864
872
match & * self . arch {
865
- "x86" | "x86_64" => X86_FEATURES_FOR_CORRECT_VECTOR_ABI ,
866
- "aarch64" | "arm64ec" => AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI ,
867
- "arm" => ARM_FEATURES_FOR_CORRECT_VECTOR_ABI ,
868
- "powerpc" | "powerpc64" => POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI ,
869
- "loongarch32" | "loongarch64" => LOONGARCH_FEATURES_FOR_CORRECT_VECTOR_ABI ,
870
- "riscv32" | "riscv64" => RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI ,
871
- "wasm32" | "wasm64" => WASM_FEATURES_FOR_CORRECT_VECTOR_ABI ,
872
- "s390x" => S390X_FEATURES_FOR_CORRECT_VECTOR_ABI ,
873
- "sparc" | "sparc64" => SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI ,
874
- "hexagon" => HEXAGON_FEATURES_FOR_CORRECT_VECTOR_ABI ,
875
- "mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_FEATURES_FOR_CORRECT_VECTOR_ABI ,
873
+ "x86" | "x86_64" => X86_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
874
+ "aarch64" | "arm64ec" => AARCH64_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
875
+ "arm" => ARM_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
876
+ "powerpc" | "powerpc64" => POWERPC_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
877
+ "loongarch32" | "loongarch64" => LOONGARCH_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
878
+ "riscv32" | "riscv64" => RISCV_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
879
+ "wasm32" | "wasm64" => WASM_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
880
+ "s390x" => S390X_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
881
+ "sparc" | "sparc64" => SPARC_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
882
+ "hexagon" => HEXAGON_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
883
+ "mips" | "mips32r6" | "mips64" | "mips64r6" => {
884
+ MIPS_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI
885
+ }
876
886
"bpf" | "m68k" => & [ ] , // no vector ABI
877
- "csky" => CSKY_FEATURES_FOR_CORRECT_VECTOR_ABI ,
887
+ "csky" => CSKY_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI ,
878
888
// FIXME: for some tier3 targets, we are overly cautious and always give warnings
879
889
// when passing args in vector registers.
880
890
_ => & [ ] ,
881
891
}
882
892
}
883
893
894
+ pub fn features_for_correct_scalable_vector_abi ( & self ) -> Option < & ' static str > {
895
+ match & * self . arch {
896
+ "aarch64" | "arm64ec" => Some ( "sve" ) ,
897
+ "riscv32" | "riscv64" => todo ! ( ) ,
898
+ // Other targets have no scalable vectors.
899
+ _ => None ,
900
+ }
901
+ }
902
+
884
903
pub fn tied_target_features ( & self ) -> & ' static [ & ' static [ & ' static str ] ] {
885
904
match & * self . arch {
886
905
"aarch64" | "arm64ec" => AARCH64_TIED_FEATURES ,
0 commit comments