@@ -81,7 +81,9 @@ unsafe fn configure_llvm(sess: &Session) {
81
81
82
82
const ARM_WHITELIST : & ' static [ & ' static str ] = & [ "neon" , "v7" , "vfp2" , "vfp3" , "vfp4" ] ;
83
83
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" ] ;
85
87
86
88
const X86_WHITELIST : & ' static [ & ' static str ] = & [ "aes" , "avx" , "avx2" , "avx512bw" ,
87
89
"avx512cd" , "avx512dq" , "avx512er" ,
@@ -104,12 +106,18 @@ const POWERPC_WHITELIST: &'static [&'static str] = &["altivec",
104
106
105
107
const MIPS_WHITELIST : & ' static [ & ' static str ] = & [ "msa" ] ;
106
108
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,
113
121
}
114
122
}
115
123
@@ -118,7 +126,7 @@ pub fn target_features(sess: &Session) -> Vec<Symbol> {
118
126
target_feature_whitelist ( sess)
119
127
. iter ( )
120
128
. filter ( |feature| {
121
- let llvm_feature = to_llvm_feature ( feature) ;
129
+ let llvm_feature = to_llvm_feature ( sess , feature) ;
122
130
let cstr = CString :: new ( llvm_feature) . unwrap ( ) ;
123
131
unsafe { llvm:: LLVMRustHasFeature ( target_machine, cstr. as_ptr ( ) ) }
124
132
} )
0 commit comments