@@ -13,7 +13,7 @@ use rustc_codegen_ssa::traits::*;
13
13
use rustc_data_structures:: fx:: FxHashMap ;
14
14
use rustc_hir as hir;
15
15
use rustc_middle:: ty:: layout:: TyAndLayout ;
16
- use rustc_middle:: { bug, span_bug} ;
16
+ use rustc_middle:: { bug, span_bug, ty :: Instance } ;
17
17
use rustc_span:: { Pos , Span , Symbol } ;
18
18
use rustc_target:: abi:: * ;
19
19
use rustc_target:: asm:: * ;
@@ -120,6 +120,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
120
120
operands : & [ InlineAsmOperandRef < ' tcx , Self > ] ,
121
121
options : InlineAsmOptions ,
122
122
line_spans : & [ Span ] ,
123
+ instance : Instance < ' _ > ,
123
124
) {
124
125
let asm_arch = self . tcx . sess . asm_arch . unwrap ( ) ;
125
126
@@ -135,7 +136,10 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
135
136
let is_target_supported = |reg_class : InlineAsmRegClass | {
136
137
for & ( _, feature) in reg_class. supported_types ( asm_arch) {
137
138
if let Some ( feature) = feature {
138
- if self . tcx . sess . target_features . contains ( & Symbol :: intern ( feature) )
139
+ let codegen_fn_attrs = self . tcx . codegen_fn_attrs ( instance. def_id ( ) ) ;
140
+ let feature_name = Symbol :: intern ( feature) ;
141
+ if self . tcx . sess . target_features . contains ( & feature_name)
142
+ || codegen_fn_attrs. target_features . contains ( & feature_name)
139
143
{
140
144
return true ;
141
145
}
0 commit comments