OSDN Git Service

* config/ia64/ia64.c (ia64_function_arg): Set up a PARALLEL for a
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 18 Jun 2005 11:56:42 +0000 (11:56 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 18 Jun 2005 11:56:42 +0000 (11:56 +0000)
big-endian unnamed __float80 value.

testsuite:
* gcc.target/ia64/float80-varargs-1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101153 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/ia64/ia64.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/ia64/float80-varargs-1.c [new file with mode: 0644]

index dd22a3f..8ebd800 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-18  Joseph S. Myers  <joseph@codesourcery.com>
+
+       * config/ia64/ia64.c (ia64_function_arg): Set up a PARALLEL for a
+       big-endian unnamed __float80 value.
+
 2005-06-18  Richard Henderson  <rth@redhat.com>
 
        PR tree-opt/22103
 2005-06-18  Richard Henderson  <rth@redhat.com>
 
        PR tree-opt/22103
index 8d20992..0475c94 100644 (file)
@@ -3822,6 +3822,19 @@ ia64_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
                    gen_rtx_EXPR_LIST (VOIDmode,
                     gen_rtx_REG (DImode, basereg + cum->words + offset),
                                      const0_rtx)));
                    gen_rtx_EXPR_LIST (VOIDmode,
                     gen_rtx_REG (DImode, basereg + cum->words + offset),
                                      const0_rtx)));
+      /* Similarly, an anonymous XFmode value must be split into two
+        registers and padded appropriately.  */
+      else if (BYTES_BIG_ENDIAN && mode == XFmode)
+       {
+         rtx loc[2];
+         loc[0] = gen_rtx_EXPR_LIST (VOIDmode,
+                    gen_rtx_REG (DImode, basereg + cum->words + offset),
+                                     const0_rtx);
+         loc[1] = gen_rtx_EXPR_LIST (VOIDmode,
+                    gen_rtx_REG (DImode, basereg + cum->words + offset + 1),
+                                     GEN_INT (UNITS_PER_WORD));
+         return gen_rtx_PARALLEL (mode, gen_rtvec_v (2, loc));
+       }
       else
        return gen_rtx_REG (mode, basereg + cum->words + offset);
     }
       else
        return gen_rtx_REG (mode, basereg + cum->words + offset);
     }
index 98b3d23..992b176 100644 (file)
@@ -1,3 +1,7 @@
+2005-06-18  Joseph S. Myers  <joseph@codesourcery.com>
+
+       * gcc.target/ia64/float80-varargs-1.c: New test.
+
 2005-06-18  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR tree-opt/22035
 2005-06-18  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR tree-opt/22035
diff --git a/gcc/testsuite/gcc.target/ia64/float80-varargs-1.c b/gcc/testsuite/gcc.target/ia64/float80-varargs-1.c
new file mode 100644 (file)
index 0000000..96524be
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test for a bug with passing __float80 in varargs.  The __float80
+   value was wrongly passed, leading to an abort.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do run } */
+/* { dg-options "" } */
+
+#include <stdarg.h>
+
+extern void abort (void);
+extern void exit (int);
+
+__float80 s = 1.234L;
+__float80 d;
+
+void vf (int a0, ...);
+
+int
+main (void)
+{
+  vf (0, s);
+  if (d != s)
+    abort ();
+  exit (0);
+}
+
+void
+vf (int a0, ...)
+{
+  va_list ap;
+  va_start (ap, a0);
+  d = va_arg (ap, __float80);
+  va_end (ap);
+}