i386.h (ASM_OUTPUT_REG_PUSH, [...]): Handle TARGET_64BIT.
authorJakub Jelinek <jakub@redhat.com>
Mon, 14 Oct 2002 10:07:58 +0000 (12:07 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 14 Oct 2002 10:07:58 +0000 (12:07 +0200)
* config/i386/i386.h (ASM_OUTPUT_REG_PUSH, ASM_OUTPUT_REG_POP):
Handle TARGET_64BIT.

* gcc.dg/20021014-1.c: New test.

From-SVN: r58120

gcc/ChangeLog
gcc/config/i386/i386.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20021014-1.c [new file with mode: 0644]

index c19a7b040cb7364be0533c619d4749013fb61ae8..dee8908e55e9c3da784991bdf942f6a0cc4f6e65 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * config/i386/i386.h (ASM_OUTPUT_REG_PUSH, ASM_OUTPUT_REG_POP):
+       Handle TARGET_64BIT.
+
 2002-10-14  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/vr.h (DRIVER_SELF_SPECS): Define.
index a2f1cc2e5ce8b7fb0e1b4833c4a5cb05d43b5702..13f900cec5ab1967ad08d64480d103d0fd3647b6 100644 (file)
@@ -3017,13 +3017,25 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
    It need not be very fast code.  */
 
 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO)  \
-  asm_fprintf ((FILE), "\tpush{l}\t%%e%s\n", reg_names[(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)
 
 /* 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_POP(FILE, REGNO)  \
-  asm_fprintf ((FILE), "\tpop{l}\t%%e%s\n", reg_names[(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)
 
 /* This is how to output an element of a case-vector that is absolute.  */
 
index f04daad57d380701f8e7b98b4fbb4c71af14a46e..76df36f02b8f4abeefc2ad15385d99945bed17f0 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.dg/20021014-1.c: New test.
+
 2002-10-11  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/5661
diff --git a/gcc/testsuite/gcc.dg/20021014-1.c b/gcc/testsuite/gcc.dg/20021014-1.c
new file mode 100644 (file)
index 0000000..9194aab
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -p" } */
+
+extern void abort (void);
+extern void exit (int);
+
+int foo (void)
+{
+  static int bar (int x)
+  {
+    return x + 3;
+  }
+  return bar (1) + bar (2);
+}
+
+int main (void)
+{
+  if (foo () != 9)
+    abort ();
+  exit (0);
+}