@@ -116,7 +116,6 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
116
116
let asm_arch = self . tcx . sess . asm_arch . unwrap ( ) ;
117
117
let is_x86 = matches ! ( asm_arch, InlineAsmArch :: X86 | InlineAsmArch :: X86_64 ) ;
118
118
let att_dialect = is_x86 && options. contains ( InlineAsmOptions :: ATT_SYNTAX ) ;
119
- let intel_dialect = is_x86 && !options. contains ( InlineAsmOptions :: ATT_SYNTAX ) ;
120
119
121
120
// GCC index of an output operand equals its position in the array
122
121
let mut outputs = vec ! [ ] ;
@@ -354,7 +353,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
354
353
// 3. Build the template string
355
354
356
355
let mut template_str = String :: with_capacity ( estimate_template_length ( template, constants_len, att_dialect) ) ;
357
- if !intel_dialect {
356
+ if att_dialect {
358
357
template_str. push_str ( ATT_SYNTAX_INS ) ;
359
358
}
360
359
@@ -436,7 +435,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
436
435
}
437
436
}
438
437
439
- if !intel_dialect {
438
+ if att_dialect {
440
439
template_str. push_str ( INTEL_SYNTAX_INS ) ;
441
440
}
442
441
@@ -661,8 +660,8 @@ impl<'gcc, 'tcx> AsmMethods for CodegenCx<'gcc, 'tcx> {
661
660
let asm_arch = self . tcx . sess . asm_arch . unwrap ( ) ;
662
661
663
662
// Default to Intel syntax on x86
664
- let intel_syntax = matches ! ( asm_arch, InlineAsmArch :: X86 | InlineAsmArch :: X86_64 )
665
- && ! options. contains ( InlineAsmOptions :: ATT_SYNTAX ) ;
663
+ let att_dialect = matches ! ( asm_arch, InlineAsmArch :: X86 | InlineAsmArch :: X86_64 )
664
+ && options. contains ( InlineAsmOptions :: ATT_SYNTAX ) ;
666
665
667
666
// Build the template string
668
667
let mut template_str = String :: new ( ) ;
@@ -696,11 +695,11 @@ impl<'gcc, 'tcx> AsmMethods for CodegenCx<'gcc, 'tcx> {
696
695
}
697
696
698
697
let template_str =
699
- if intel_syntax {
700
- format ! ( "{}\n \t .intel_syntax noprefix" , template_str)
698
+ if att_dialect {
699
+ format ! ( ".att_syntax \n \t {}\n \t .intel_syntax noprefix" , template_str)
701
700
}
702
701
else {
703
- format ! ( ".att_syntax \n \t {} \n \t .intel_syntax noprefix" , template_str)
702
+ template_str
704
703
} ;
705
704
// NOTE: seems like gcc will put the asm in the wrong section, so set it to .text manually.
706
705
let template_str = format ! ( ".pushsection .text\n {}\n .popsection" , template_str) ;
0 commit comments