@@ -559,6 +559,7 @@ fn tied_output_operand_idx(
559559/// {0:y} (and wrapping mem-only references in square brackets).
560560fn rewrite_asm < F : Fn ( & str ) -> bool , M : Fn ( usize ) -> usize > (
561561 asm : & str ,
562+ att_syntax : bool ,
562563 input_op_mapper : M ,
563564 is_mem_only : F ,
564565 arch : Arch ,
@@ -647,7 +648,10 @@ fn rewrite_asm<F: Fn(&str) -> bool, M: Fn(usize) -> usize>(
647648 }
648649 let mem_only = is_mem_only ( index_str) ;
649650 // Push the reference wrapped in {}, or in [{}] if mem-only
650- out. push_str ( if mem_only { "[{" } else { "{" } ) ;
651+ if mem_only {
652+ out. push ( if att_syntax { '(' } else { '[' } ) ;
653+ } ;
654+ out. push ( '{' ) ;
651655 let idx: usize = index_str
652656 . parse ( )
653657 . map_err ( |_| TranslationError :: generic ( "could not parse operand idx" ) ) ?;
@@ -656,7 +660,10 @@ fn rewrite_asm<F: Fn(&str) -> bool, M: Fn(usize) -> usize>(
656660 out. push ( ':' ) ;
657661 out. push_str ( & new_modifiers) ;
658662 }
659- out. push_str ( if mem_only { "}]" } else { "}" } ) ;
663+ out. push ( '}' ) ;
664+ if mem_only {
665+ out. push ( if att_syntax { ')' } else { ']' } ) ;
666+ } ;
660667 // Push the rest of the chunk
661668 out. push_str ( & chunk[ end_idx..] ) ;
662669 continue ;
@@ -832,6 +839,7 @@ impl<'c> Translation<'c> {
832839 // Rewrite arg references in assembly template
833840 let rewritten_asm = rewrite_asm (
834841 asm,
842+ att_syntax,
835843 |idx : usize | {
836844 new_idx_for_orig ( tied_output_operand_idx ( idx, outputs. len ( ) , & tied_operands) )
837845 } ,
0 commit comments