i386.h (ASM_PRINTF_EXTENSIONS): New macro.
authorUros Bizjak <ubizjak@gmail.com>
Sun, 30 Jul 2017 08:51:37 +0000 (10:51 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Sun, 30 Jul 2017 08:51:37 +0000 (10:51 +0200)
* config/i386/i386.h (ASM_PRINTF_EXTENSIONS): New macro.
(ASM_OUTPUT_REG_PUSH): Rewrite with new operand modifiers.
(ASM_OUTPUT_REG_POP): Ditto.
* config/i386/i386.c (ix86_asm_output_function_label): Use fputs
instead of asm_fprintf to output pure string.

From-SVN: r250720

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.h

index ad347ad9754f8797cdc2c0b35a39522c4db62498..300857938d197fe45dc02d340b6cf99a2e1bdf5f 100644 (file)
@@ -1,3 +1,11 @@
+2017-07-30  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/i386/i386.h (ASM_PRINTF_EXTENSIONS): New macro.
+       (ASM_OUTPUT_REG_PUSH): Rewrite with new operand modifiers.
+       (ASM_OUTPUT_REG_POP): Ditto.
+       * config/i386/i386.c (ix86_asm_output_function_label): Use fputs
+       instead of asm_fprintf to output pure string.
+
 2017-07-29  Jakub Jelinek  <jakub@redhat.com>
 
        * debug.h (struct gcc_debug_hooks): Add IMPLICIT argument
index f1486ff3750dc49799dce44ac0333df2816f399a..c0213a66ae0dd26483b2543230a463b10dd06a67 100644 (file)
@@ -8777,16 +8777,15 @@ ix86_asm_output_function_label (FILE *asm_out_file, const char *fname,
       if (TARGET_64BIT)
        {
          /* leaq [%rsp + 0], %rsp  */
-         asm_fprintf (asm_out_file, ASM_BYTE
-                      "0x48, 0x8d, 0xa4, 0x24, 0x00, 0x00, 0x00, 0x00\n");
+         fputs (ASM_BYTE "0x48, 0x8d, 0xa4, 0x24, 0x00, 0x00, 0x00, 0x00\n",
+                asm_out_file);
        }
       else
        {
           /* movl.s %edi, %edi
             push   %ebp
             movl.s %esp, %ebp */
-         asm_fprintf (asm_out_file, ASM_BYTE
-                      "0x8b, 0xff, 0x55, 0x8b, 0xec\n");
+         fputs (ASM_BYTE "0x8b, 0xff, 0x55, 0x8b, 0xec\n", asm_out_file);
        }
     }
 }
index 682745ae06babc901185aa5a2b47a2b192f7e81e..61501dc8c0b8014f8d8887960cb7bd13b1b74aca 100644 (file)
@@ -2196,29 +2196,33 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL)                     \
   asm_preferred_eh_data_format ((CODE), (GLOBAL))
 
-/* This is how to output an insn to push a register on the stack.
-   It need not be very fast code.  */
-
-#define ASM_OUTPUT_REG_PUSH(FILE, REGNO)  \
-do {                                                                   \
-  if (TARGET_64BIT)                                                    \
-    asm_fprintf ((FILE), "\tpush{q}\t%%r%s\n",                         \
-                reg_names[(REGNO)] + (REX_INT_REGNO_P (REGNO) != 0));  \
-  else                                                                 \
-    asm_fprintf ((FILE), "\tpush{l}\t%%e%s\n", reg_names[(REGNO)]);    \
-} while (0)
+/* These are a couple of extensions to the formats accepted
+   by asm_fprintf:
+     %z prints out opcode suffix for word-mode instruction
+     %r prints out word-mode name for reg_names[arg]  */
+#define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P)          \
+  case 'z':                                            \
+    fputc (TARGET_64BIT ? 'q' : 'l', (FILE));          \
+    break;                                             \
+                                                       \
+  case 'r':                                            \
+    {                                                  \
+      unsigned int regno = va_arg ((ARGS), int);       \
+      if (LEGACY_INT_REGNO_P (regno))                  \
+       fputc (TARGET_64BIT ? 'r' : 'e', (FILE));       \
+      fputs (reg_names[regno], (FILE));                        \
+      break;                                           \
+    }
+
+/* This is how to output an insn to push a register on the stack.  */
 
-/* This is how to output an insn to pop a register from the stack.
-   It need not be very fast code.  */
+#define ASM_OUTPUT_REG_PUSH(FILE, REGNO)               \
+  asm_fprintf ((FILE), "\tpush%z\t%%%r\n", (REGNO))
+
+/* This is how to output an insn to pop a register from the stack.  */
 
 #define ASM_OUTPUT_REG_POP(FILE, REGNO)  \
-do {                                                                   \
-  if (TARGET_64BIT)                                                    \
-    asm_fprintf ((FILE), "\tpop{q}\t%%r%s\n",                          \
-                reg_names[(REGNO)] + (REX_INT_REGNO_P (REGNO) != 0));  \
-  else                                                                 \
-    asm_fprintf ((FILE), "\tpop{l}\t%%e%s\n", reg_names[(REGNO)]);     \
-} while (0)
+  asm_fprintf ((FILE), "\tpop%z\t%%%r\n", (REGNO))
 
 /* This is how to output an element of a case-vector that is absolute.  */