@@ -116,7 +116,6 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
116116 let asm_arch = self . tcx . sess . asm_arch . unwrap ( ) ;
117117 let is_x86 = matches ! ( asm_arch, InlineAsmArch :: X86 | InlineAsmArch :: X86_64 ) ;
118118 let att_dialect = is_x86 && options. contains ( InlineAsmOptions :: ATT_SYNTAX ) ;
119- let intel_dialect = is_x86 && !options. contains ( InlineAsmOptions :: ATT_SYNTAX ) ;
120119
121120 // GCC index of an output operand equals its position in the array
122121 let mut outputs = vec ! [ ] ;
@@ -354,7 +353,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
354353 // 3. Build the template string
355354
356355 let mut template_str = String :: with_capacity ( estimate_template_length ( template, constants_len, att_dialect) ) ;
357- if !intel_dialect {
356+ if att_dialect {
358357 template_str. push_str ( ATT_SYNTAX_INS ) ;
359358 }
360359
@@ -436,7 +435,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
436435 }
437436 }
438437
439- if !intel_dialect {
438+ if att_dialect {
440439 template_str. push_str ( INTEL_SYNTAX_INS ) ;
441440 }
442441
@@ -661,8 +660,8 @@ impl<'gcc, 'tcx> AsmMethods for CodegenCx<'gcc, 'tcx> {
661660 let asm_arch = self . tcx . sess . asm_arch . unwrap ( ) ;
662661
663662 // 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 ) ;
666665
667666 // Build the template string
668667 let mut template_str = String :: new ( ) ;
@@ -696,11 +695,11 @@ impl<'gcc, 'tcx> AsmMethods for CodegenCx<'gcc, 'tcx> {
696695 }
697696
698697 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)
701700 }
702701 else {
703- format ! ( ".att_syntax \n \t {} \n \t .intel_syntax noprefix" , template_str)
702+ template_str
704703 } ;
705704 // NOTE: seems like gcc will put the asm in the wrong section, so set it to .text manually.
706705 let template_str = format ! ( ".pushsection .text\n {}\n .popsection" , template_str) ;
0 commit comments