sparc.c (function_arg_slotno): Align TImode arguments on a 16-byte boundary in the...
authorEric Botcazou <ebotcazou@libertysurf.fr>
Mon, 2 Feb 2004 12:20:52 +0000 (13:20 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 2 Feb 2004 12:20:52 +0000 (12:20 +0000)
* config/sparc/sparc.c (function_arg_slotno): Align TImode
arguments on a 16-byte boundary in the parameter array if ARCH64.
Split handling of TFmode.

From-SVN: r77107

gcc/ChangeLog
gcc/config/sparc/sparc.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/titype-1.c [new file with mode: 0644]

index bbd7f72..c750598 100644 (file)
@@ -1,3 +1,9 @@
+2004-02-02  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * config/sparc/sparc.c (function_arg_slotno): Align TImode
+       arguments on a 16-byte boundary in the parameter array if ARCH64.
+       Split handling of TFmode.
+
 2004-02-02  Paolo Bonzini  <bonzini@gnu.org>
 
        * rtlanal.c (reg_overlap_mentioned_p) [!ENABLE_CHECKING]:
index 369f11a..e7dd4fa 100644 (file)
@@ -4979,19 +4979,27 @@ function_arg_slotno (const struct sparc_args *cum, enum machine_mode mode,
         See emit_call_1.  */
       return -1;
 
+    case TImode : case CTImode :
+      if (TARGET_ARCH64 && (slotno & 1) != 0)
+       slotno++, *ppadding = 1;
+      /* fallthrough */
+
     case QImode : case CQImode :
     case HImode : case CHImode :
     case SImode : case CSImode :
     case DImode : case CDImode :
-    case TImode : case CTImode :
       if (slotno >= SPARC_INT_ARG_MAX)
        return -1;
       regno = regbase + slotno;
       break;
 
+    case TFmode : case TCmode :
+      if (TARGET_ARCH64 && (slotno & 1) != 0)
+       slotno++, *ppadding = 1;
+      /* fallthrough */
+
     case SFmode : case SCmode :
     case DFmode : case DCmode :
-    case TFmode : case TCmode :
       if (TARGET_ARCH32)
        {
          if (slotno >= SPARC_INT_ARG_MAX)
@@ -5000,9 +5008,6 @@ function_arg_slotno (const struct sparc_args *cum, enum machine_mode mode,
        }
       else
        {
-         if ((mode == TFmode || mode == TCmode)
-             && (slotno & 1) != 0)
-           slotno++, *ppadding = 1;
          if (TARGET_FPU && named)
            {
              if (slotno >= SPARC_FP_ARG_MAX)
index 87fe8b7..c748d78 100644 (file)
@@ -1,3 +1,7 @@
+2004-02-02  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.dg/titype-1.c: New test.
+
 2004-02-01  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        PR c++/13957
diff --git a/gcc/testsuite/gcc.dg/titype-1.c b/gcc/testsuite/gcc.dg/titype-1.c
new file mode 100644 (file)
index 0000000..ab38f1f
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+
+/* Not all platforms support TImode integers.  */
+#if defined(__LP64__) || defined(__sparc__)
+typedef int TItype __attribute__ ((mode (TI)));  /* { dg-error "no data type for mode" "TI" { target sparc-sun-solaris2.[0-6]* } } */
+#else
+typedef long TItype;
+#endif
+
+#include <stdarg.h>
+
+extern void abort(void);
+
+
+void foo(int i, ...)
+{
+  TItype q;
+  va_list va;
+
+  va_start(va, i);
+  q = va_arg(va, TItype);
+  va_end(va);
+
+  if (q != 5)
+    abort();
+}
+
+int main(void)
+{
+  TItype q = 5;
+
+  foo(1, q);
+  return 0;
+}