On Wed, Apr 18, 2012 at 11:34 AM, Kirill Yukhin <kirill.yuk...@gmail.com> wrote: > Hello guys, > Since there is no more objections to my RFC, started here [1], > I've implemented rest __atomic builtins in the same way. > It corresponds to Spec, which can be found here [2].
Can you please implement printing of HLE prefix with %K operand modifier, like sync.md example in attached (untested) patch? Uros.
Index: i386/i386.md =================================================================== --- i386/i386.md (revision 186558) +++ i386/i386.md (working copy) @@ -58,6 +58,7 @@ ;; X -- don't print any sort of PIC '@' suffix for a symbol. ;; & -- print some in-use local-dynamic symbol name. ;; H -- print a memory address offset by 8; used for sse high-parts +;; K -- print HLE lock prefix ;; Y -- print condition for XOP pcom* instruction. ;; + -- print a branch hint as 'cs' or 'ds' prefix ;; ; -- print a semicolon (after prefixes due to bug in older gas). Index: i386/sync.md =================================================================== --- i386/sync.md (revision 186558) +++ i386/sync.md (working copy) @@ -455,7 +455,7 @@ (match_operand:SWI 2 "nonmemory_operand" "0"))) (clobber (reg:CC FLAGS_REG))] "TARGET_XADD" - "lock{%;} xadd{<imodesuffix>}\t{%0, %1|%1, %0}") + "lock{%;} %K3xadd{<imodesuffix>}\t{%0, %1|%1, %0}") ;; This peephole2 and following insn optimize ;; __sync_fetch_and_add (x, -N) == N into just lock {add,sub,inc,dec} Index: i386/i386.c =================================================================== @@ -13938,6 +13944,7 @@ get_some_local_dynamic_name (void) X -- don't print any sort of PIC '@' suffix for a symbol. & -- print some in-use local-dynamic symbol name. H -- print a memory address offset by 8; used for sse high-parts + K -- print HLE lock prefix Y -- print condition for XOP pcom* instruction. + -- print a branch hint as 'cs' or 'ds' prefix ; -- print a semicolon (after prefixes due to bug in older gas). @@ -14340,6 +14347,22 @@ ix86_print_operand (FILE *file, rtx x, int code) x = adjust_address_nv (x, DImode, 8); break; + case 'K': + gcc_assert (CONST_INT_P (x)); + + if (INTVAL (x) & IX86_HLE_ACQUIRE) +#ifdef HAVE_AS_IX86_HLE + fputs ("xacquire ", file); +#else + fputs ("\n" ASM_BYTE "0xf2\n\t", file); + else if (INTVAL (x) & IX86_HLE_RELEASE) +#ifdef HAVE_AS_IX86_HLE + fputs ("xrelease ", file); +#else + fputs ("\n" ASM_BYTE "0xf3\n\t"); +#endif + break; + case '+': { rtx x;