@@ -104,22 +104,33 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, target_info: Lock
104
104
}
105
105
} ;
106
106
107
+ let disable_cpu_feature = |feature : & str | {
108
+ if disabled_features. contains ( feature) {
109
+ context. add_command_line_option ( & format ! ( "-mno-{}" , feature) ) ;
110
+ }
111
+ } ;
112
+
107
113
// TODO(antoyo): only set on x86 platforms.
108
114
context. add_command_line_option ( "-masm=intel" ) ;
109
115
110
116
// TODO: instead of setting the features manually, set the correct -march flag.
111
- /* let features = ["64", "avxvnni", "bmi", "sse2", "avx2", "sha", "fma", "fma4", "gfni", "f16c", "aes", "bmi2", "pclmul", "rtm",
117
+ let features = [ "64" , "avxvnni" , "bmi" , "sse2" , "avx2" , "sha" , "fma" , "fma4" , "gfni" , "f16c" , "aes" , "bmi2" , "pclmul" , "rtm" ,
112
118
"vaes" , "vpclmulqdq" , "xsavec" ,
113
119
] ;
114
120
121
+
115
122
for feature in & features {
116
- add_cpu_feature_flag(feature);
117
- }*/
123
+ disable_cpu_feature ( feature) ;
118
124
119
- // NOTE: we always enable AVX because the equivalent of llvm.x86.sse2.cmp.pd in GCC for
120
- // SSE2 is multiple builtins, so we use the AVX __builtin_ia32_cmppd instead.
121
- // FIXME(antoyo): use the proper builtins for llvm.x86.sse2.cmp.pd and similar.
122
- context. add_command_line_option ( "-mavx" ) ;
125
+ //add_cpu_feature_flag(feature);
126
+ }
127
+
128
+ if !disabled_features. contains ( "avx" ) {
129
+ // NOTE: we always enable AVX because the equivalent of llvm.x86.sse2.cmp.pd in GCC for
130
+ // SSE2 is multiple builtins, so we use the AVX __builtin_ia32_cmppd instead.
131
+ // FIXME(antoyo): use the proper builtins for llvm.x86.sse2.cmp.pd and similar.
132
+ context. add_command_line_option ( "-mavx" ) ;
133
+ }
123
134
124
135
for arg in & tcx. sess . opts . cg . llvm_args {
125
136
context. add_command_line_option ( arg) ;
0 commit comments