@@ -81,7 +81,9 @@ unsafe fn configure_llvm(sess: &Session) {
8181
8282const ARM_WHITELIST : & ' static [ & ' static str ] = & [ "neon" , "v7" , "vfp2" , "vfp3" , "vfp4" ] ;
8383
84- const AARCH64_WHITELIST : & ' static [ & ' static str ] = & [ "neon" , "v7" ] ;
84+ const AARCH64_WHITELIST : & ' static [ & ' static str ] = & [ "fp" , "neon" , "sve" , "crc" , "crypto" ,
85+ "ras" , "lse" , "rdm" , "fp16" , "rcpc" ,
86+ "dotprod" , "v8.1a" , "v8.2a" , "v8.3a" ] ;
8587
8688const X86_WHITELIST : & ' static [ & ' static str ] = & [ "aes" , "avx" , "avx2" , "avx512bw" ,
8789 "avx512cd" , "avx512dq" , "avx512er" ,
@@ -104,12 +106,18 @@ const POWERPC_WHITELIST: &'static [&'static str] = &["altivec",
104106
105107const MIPS_WHITELIST : & ' static [ & ' static str ] = & [ "msa" ] ;
106108
107- pub fn to_llvm_feature ( s : & str ) -> & str {
108- match s {
109- "pclmulqdq" => "pclmul" ,
110- "rdrand" => "rdrnd" ,
111- "bmi1" => "bmi" ,
112- s => s,
109+ pub fn to_llvm_feature < ' a > ( sess : & Session , s : & ' a str ) -> & ' a str {
110+ let arch = if sess. target . target . arch == "x86_64" {
111+ "x86"
112+ } else {
113+ & * sess. target . target . arch
114+ } ;
115+ match ( arch, s) {
116+ ( "x86" , "pclmulqdq" ) => "pclmul" ,
117+ ( "x86" , "rdrand" ) => "rdrnd" ,
118+ ( "x86" , "bmi1" ) => "bmi" ,
119+ ( "aarch64" , "fp16" ) => "fullfp16" ,
120+ ( _, s) => s,
113121 }
114122}
115123
@@ -118,7 +126,7 @@ pub fn target_features(sess: &Session) -> Vec<Symbol> {
118126 target_feature_whitelist ( sess)
119127 . iter ( )
120128 . filter ( |feature| {
121- let llvm_feature = to_llvm_feature ( feature) ;
129+ let llvm_feature = to_llvm_feature ( sess , feature) ;
122130 let cstr = CString :: new ( llvm_feature) . unwrap ( ) ;
123131 unsafe { llvm:: LLVMRustHasFeature ( target_machine, cstr. as_ptr ( ) ) }
124132 } )
0 commit comments