fp2-struct-check.h: New file.
authorJanis Johnson <janis187@us.ibm.com>
Tue, 10 Jun 2003 21:01:39 +0000 (21:01 +0000)
committerJanis Johnson <janis@gcc.gnu.org>
Tue, 10 Jun 2003 21:01:39 +0000 (21:01 +0000)
* gcc.dg/compat/fp2-struct-check.h: New file.
* gcc.dg/compat/fp2-struct-defs.h: New file.
* gcc.dg/compat/fp2-struct-init.h: New file.
* gcc.dg/compat/struct-by-value-10_main.c: New file.
* gcc.dg/compat/struct-by-value-10_x.c: New file.
* gcc.dg/compat/struct-by-value-10_y.c: New file.
* gcc.dg/compat/struct-return-10_main.c: New file.
* gcc.dg/compat/struct-return-10_x.c: New file.
* gcc.dg/compat/struct-return-10_y.c: New file.

From-SVN: r67734

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/compat/fp2-struct-check.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/fp2-struct-defs.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/fp2-struct-init.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-by-value-10_main.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-by-value-10_x.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-by-value-10_y.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-return-10_main.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-return-10_x.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-return-10_y.c [new file with mode: 0644]

index af4f80792a3338af807a876b4c0103a3e8a6553b..f8bea2f282d513d207f2a4d8bc004b1a99ec00b2 100644 (file)
@@ -1,5 +1,15 @@
 2003-06-10  Janis Johnson  <janis187@us.ibm.com>
 
+       * gcc.dg/compat/fp2-struct-check.h: New file.
+       * gcc.dg/compat/fp2-struct-defs.h: New file.
+       * gcc.dg/compat/fp2-struct-init.h: New file.
+       * gcc.dg/compat/struct-by-value-10_main.c: New file.
+       * gcc.dg/compat/struct-by-value-10_x.c: New file.
+       * gcc.dg/compat/struct-by-value-10_y.c: New file.
+       * gcc.dg/compat/struct-return-10_main.c: New file.
+       * gcc.dg/compat/struct-return-10_x.c: New file.
+       * gcc.dg/compat/struct-return-10_y.c: New file.
+
        * gcc.dg/compat/compat-common.h: New file.
        * gcc.dg/compat/fp-struct-check.h: Improve debugging output.
        * gcc.dg/compat/fp-struct-test-by-value-x.h: Ditto.
diff --git a/gcc/testsuite/gcc.dg/compat/fp2-struct-check.h b/gcc/testsuite/gcc.dg/compat/fp2-struct-check.h
new file mode 100644 (file)
index 0000000..c00f705
--- /dev/null
@@ -0,0 +1,27 @@
+/* Function definitions that are used by multiple tests.  */
+
+void checkSfd (Sfd x, double y)
+{ if (x.f != y || x.d != y+1) DEBUG_CHECK }
+void checkSfl (Sfl x, double y)
+{ if (x.f != y || x.l != y+1) DEBUG_CHECK }
+void checkSdf (Sdf x, double y)
+{ if (x.d != y || x.f != y+1) DEBUG_CHECK }
+void checkSdl (Sdl x, double y)
+{ if (x.d != y || x.l != y+1) DEBUG_CHECK }
+void checkSlf (Slf x, double y)
+{ if (x.l != y || x.f != y+1) DEBUG_CHECK }
+void checkSld (Sld x, double y)
+{ if (x.l != y || x.d != y+1) DEBUG_CHECK }
+
+void checkSfdl (Sfdl x, double y)
+{ if (x.f != y || x.d != y+1 || x.l != y+2) DEBUG_CHECK }
+void checkSfld (Sfld x, double y)
+{ if (x.f != y || x.l != y+1 || x.d != y+2) DEBUG_CHECK }
+void checkSdfl (Sdfl x, double y)
+{ if (x.d != y || x.f != y+1 || x.l != y+2) DEBUG_CHECK }
+void checkSdlf (Sdlf x, double y)
+{ if (x.d != y || x.l != y+1 || x.f != y+2) DEBUG_CHECK }
+void checkSlfd (Slfd x, double y)
+{ if (x.l != y || x.f != y+1 || x.d != y+2) DEBUG_CHECK }
+void checkSldf (Sldf x, double y)
+{ if (x.l != y || x.d != y+1 || x.f != y+2) DEBUG_CHECK }
diff --git a/gcc/testsuite/gcc.dg/compat/fp2-struct-defs.h b/gcc/testsuite/gcc.dg/compat/fp2-struct-defs.h
new file mode 100644 (file)
index 0000000..be387a7
--- /dev/null
@@ -0,0 +1,15 @@
+/* Type definitions that are used by multiple tests.  */
+
+typedef struct { float f; double d; } Sfd;
+typedef struct { float f; long double l; } Sfl;
+typedef struct { double d; float f; } Sdf;
+typedef struct { double d; long double l; } Sdl;
+typedef struct { long double l; float f; } Slf;
+typedef struct { long double l; double d; } Sld;
+
+typedef struct { float f; double d; long double l; } Sfdl;
+typedef struct { float f; long double l; double d; } Sfld;
+typedef struct { double d; float f; long double l; } Sdfl;
+typedef struct { double d; long double l; float f; } Sdlf;
+typedef struct { long double l; float f; double d; } Slfd;
+typedef struct { long double l; double d; float f; } Sldf;
diff --git a/gcc/testsuite/gcc.dg/compat/fp2-struct-init.h b/gcc/testsuite/gcc.dg/compat/fp2-struct-init.h
new file mode 100644 (file)
index 0000000..35fe77e
--- /dev/null
@@ -0,0 +1,27 @@
+/* Function definitions that are used by multiple tests.  */
+
+void initSfd (Sfd *p, double y)
+{ p->f = y; p->d = y+1; }
+void initSfl (Sfl *p, double y)
+{ p->f = y; p->l = y+1; }
+void initSdf (Sdf *p, double y)
+{ p->d = y; p->f = y+1; }
+void initSdl (Sdl *p, double y)
+{ p->d = y; p->l = y+1; }
+void initSlf (Slf *p, double y)
+{ p->l = y; p->f = y+1; }
+void initSld (Sld *p, double y)
+{ p->l = y; p->d = y+1; }
+
+void initSfdl (Sfdl *p, double y)
+{ p->f = y; p->d = y+1; p->l = y+2; }
+void initSfld (Sfld *p, double y)
+{ p->f = y; p->l = y+1; p->d = y+2; }
+void initSdfl (Sdfl *p, double y)
+{ p->d = y; p->f = y+1; p->l = y+2; }
+void initSdlf (Sdlf *p, double y)
+{ p->d = y; p->l = y+1; p->f = y+2; }
+void initSlfd (Slfd *p, double y)
+{ p->l = y; p->f = y+1; p->d = y+2; }
+void initSldf (Sldf *p, double y)
+{ p->l = y; p->d = y+1; p->f = y+2; }
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-10_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-10_main.c
new file mode 100644 (file)
index 0000000..e41b93c
--- /dev/null
@@ -0,0 +1,14 @@
+/* Test structures passed by value, including to a function with a
+   variable-length argument lists.  All struct members are floating
+   point scalars.  */
+
+extern void struct_by_value_10_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+  struct_by_value_10_x ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-10_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-10_x.c
new file mode 100644 (file)
index 0000000..7468dc7
--- /dev/null
@@ -0,0 +1,180 @@
+#include "compat-common.h"
+
+#include "fp2-struct-defs.h"
+#include "fp2-struct-check.h"
+
+#define TEST(TYPE)                                             \
+TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE;               \
+TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE;               \
+TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE;            \
+TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE;           \
+                                                               \
+extern void init##TYPE (TYPE *p, double x);                    \
+extern void checkg##TYPE (void);                               \
+extern void                                                    \
+test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4,                        \
+           TYPE s5, TYPE s6, TYPE s7, TYPE s8,                 \
+           TYPE s9, TYPE s10, TYPE s11, TYPE s12,              \
+           TYPE s13, TYPE s14, TYPE s15, TYPE s16);            \
+extern void testva##TYPE (int n, ...);                         \
+                                                               \
+void                                                           \
+test2_##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4,              \
+             TYPE s5, TYPE s6, TYPE s7, TYPE s8)               \
+{                                                              \
+  test##TYPE (s1, g2s##TYPE, s2, g4s##TYPE,                    \
+             s3, g6s##TYPE, s4, g8s##TYPE,                     \
+             s5, g10s##TYPE, s6, g12s##TYPE,                   \
+             s7, g14s##TYPE, s8, g16s##TYPE);                  \
+}                                                              \
+                                                               \
+void                                                           \
+testit##TYPE (void)                                            \
+{                                                              \
+  DEBUG_FPUTS (#TYPE);                                         \
+  DEBUG_FPUTS (" init: ");                                     \
+  init##TYPE  ( &g1s##TYPE,  (double)1);                       \
+  init##TYPE  ( &g2s##TYPE,  (double)2);                       \
+  init##TYPE  ( &g3s##TYPE,  (double)3);                       \
+  init##TYPE  ( &g4s##TYPE,  (double)4);                       \
+  init##TYPE  ( &g5s##TYPE,  (double)5);                       \
+  init##TYPE  ( &g6s##TYPE,  (double)6);                       \
+  init##TYPE  ( &g7s##TYPE,  (double)7);                       \
+  init##TYPE  ( &g8s##TYPE,  (double)8);                       \
+  init##TYPE  ( &g9s##TYPE,  (double)9);                       \
+  init##TYPE  (&g10s##TYPE, (double)10);                       \
+  init##TYPE  (&g11s##TYPE, (double)11);                       \
+  init##TYPE  (&g12s##TYPE, (double)12);                       \
+  init##TYPE  (&g13s##TYPE, (double)13);                       \
+  init##TYPE  (&g14s##TYPE, (double)14);                       \
+  init##TYPE  (&g15s##TYPE, (double)15);                       \
+  init##TYPE  (&g16s##TYPE, (double)16);                       \
+  checkg##TYPE ();                                             \
+  DEBUG_NL;                                                    \
+  DEBUG_FPUTS (#TYPE);                                         \
+  DEBUG_FPUTS (" test: ");                                     \
+  test##TYPE (g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,      \
+             g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE,       \
+             g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE,    \
+             g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE);  \
+  DEBUG_NL;                                                    \
+  DEBUG_FPUTS (#TYPE);                                         \
+  DEBUG_FPUTS (" testva:");                                    \
+  DEBUG_NL;                                                    \
+  testva##TYPE (1,                                             \
+               g1s##TYPE);                                     \
+  DEBUG_NL;                                                    \
+  testva##TYPE (2,                                             \
+               g1s##TYPE, g2s##TYPE);                          \
+  DEBUG_NL;                                                    \
+  testva##TYPE (3,                                             \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE);               \
+  DEBUG_NL;                                                    \
+  testva##TYPE (4,                                             \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE);    \
+  DEBUG_NL;                                                    \
+  testva##TYPE (5,                                             \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE);                                     \
+  DEBUG_NL;                                                    \
+  testva##TYPE (6,                                             \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE);                          \
+  DEBUG_NL;                                                    \
+  testva##TYPE (7,                                             \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE);               \
+  DEBUG_NL;                                                    \
+  testva##TYPE (8,                                             \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE);    \
+  DEBUG_NL;                                                    \
+  testva##TYPE (9,                                             \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE,     \
+               g9s##TYPE);                                     \
+  DEBUG_NL;                                                    \
+  testva##TYPE (10,                                            \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE,     \
+               g9s##TYPE, g10s##TYPE);                         \
+  DEBUG_NL;                                                    \
+  testva##TYPE (11,                                            \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE,     \
+               g9s##TYPE, g10s##TYPE, g11s##TYPE);             \
+  DEBUG_NL;                                                    \
+  testva##TYPE (12,                                            \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE,     \
+               g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE); \
+  DEBUG_NL;                                                    \
+  testva##TYPE (13,                                            \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE,     \
+               g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE,  \
+               g13s##TYPE);                                    \
+  DEBUG_NL;                                                    \
+  testva##TYPE (14,                                            \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE,     \
+               g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE,  \
+               g13s##TYPE, g14s##TYPE);                        \
+  DEBUG_NL;                                                    \
+  testva##TYPE (15,                                            \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE,     \
+               g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE,  \
+               g13s##TYPE, g14s##TYPE, g15s##TYPE);            \
+  DEBUG_NL;                                                    \
+  testva##TYPE (16,                                            \
+               g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE,     \
+               g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE,     \
+               g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE,  \
+               g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE); \
+  DEBUG_NL;                                                    \
+  DEBUG_FPUTS (#TYPE);                                         \
+  DEBUG_FPUTS (" test2: ");                                    \
+  test2_##TYPE (g1s##TYPE, g3s##TYPE, g5s##TYPE, g7s##TYPE,    \
+               g9s##TYPE, g11s##TYPE, g13s##TYPE, g15s##TYPE); \
+  DEBUG_NL;                                                    \
+}
+
+TEST(Sfd)
+TEST(Sfl)
+TEST(Sdf)
+TEST(Sdl)
+TEST(Slf)
+TEST(Sld)
+TEST(Sfdl)
+TEST(Sfld)
+TEST(Sdfl)
+TEST(Sdlf)
+TEST(Slfd)
+TEST(Sldf)
+
+#undef T
+
+void
+struct_by_value_10_x ()
+{
+#define T(TYPE) testit##TYPE ();
+
+T(Sfd)
+T(Sfl)
+T(Sdf)
+T(Sdl)
+T(Slf)
+T(Sld)
+T(Sfdl)
+T(Sfld)
+T(Sdfl)
+T(Sdlf)
+T(Slfd)
+T(Sldf)
+
+if (fails != 0)
+  abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-10_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-10_y.c
new file mode 100644 (file)
index 0000000..30ad45f
--- /dev/null
@@ -0,0 +1,96 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+/* Turn off checking for variable arguments with -DSKIPVA.  */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp2-struct-defs.h"
+#include "fp2-struct-init.h"
+
+#define TEST(TYPE)                                             \
+extern TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE;                \
+extern TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE;                \
+extern TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE;     \
+extern TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE;    \
+                                                               \
+extern void check##TYPE (TYPE x, double y);                    \
+                                                               \
+void                                                           \
+checkg##TYPE (void)                                            \
+{                                                              \
+  check##TYPE (  g1s##TYPE,  (double)1);                       \
+  check##TYPE (  g2s##TYPE,  (double)2);                       \
+  check##TYPE (  g3s##TYPE,  (double)3);                       \
+  check##TYPE (  g4s##TYPE,  (double)4);                       \
+  check##TYPE (  g5s##TYPE,  (double)5);                       \
+  check##TYPE (  g6s##TYPE,  (double)6);                       \
+  check##TYPE (  g7s##TYPE,  (double)7);                       \
+  check##TYPE (  g8s##TYPE,  (double)8);                       \
+  check##TYPE (  g9s##TYPE,  (double)9);                       \
+  check##TYPE ( g10s##TYPE, (double)10);                       \
+  check##TYPE ( g11s##TYPE, (double)11);                       \
+  check##TYPE ( g12s##TYPE, (double)12);                       \
+  check##TYPE ( g13s##TYPE, (double)13);                       \
+  check##TYPE ( g14s##TYPE, (double)14);                       \
+  check##TYPE ( g15s##TYPE, (double)15);                       \
+  check##TYPE ( g16s##TYPE, (double)16);                       \
+}                                                              \
+                                                               \
+void                                                           \
+test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4,                        \
+           TYPE s5, TYPE s6, TYPE s7, TYPE s8,                 \
+           TYPE s9, TYPE s10, TYPE s11, TYPE s12,              \
+           TYPE s13, TYPE s14, TYPE s15, TYPE s16)             \
+{                                                              \
+  check##TYPE (s1, (double)1);                                 \
+  check##TYPE (s2, (double)2);                                 \
+  check##TYPE (s3, (double)3);                                 \
+  check##TYPE (s4, (double)4);                                 \
+  check##TYPE (s5, (double)5);                                 \
+  check##TYPE (s6, (double)6);                                 \
+  check##TYPE (s7, (double)7);                                 \
+  check##TYPE (s8, (double)8);                                 \
+  check##TYPE (s9, (double)9);                                 \
+  check##TYPE (s10, (double)10);                               \
+  check##TYPE (s11, (double)11);                               \
+  check##TYPE (s12, (double)12);                               \
+  check##TYPE (s13, (double)13);                               \
+  check##TYPE (s14, (double)14);                               \
+  check##TYPE (s15, (double)15);                               \
+  check##TYPE (s16, (double)16);                               \
+}                                                              \
+                                                               \
+void                                                           \
+testva##TYPE (int n, ...)                                      \
+{                                                              \
+  int i;                                                       \
+  va_list ap;                                                  \
+  if (test_va)                                                 \
+    {                                                          \
+      va_start (ap, n);                                                \
+      for (i = 0; i < n; i++)                                  \
+       {                                                       \
+         TYPE t = va_arg (ap, TYPE);                           \
+         check##TYPE (t, (double)i+1);                         \
+       }                                                       \
+      va_end (ap);                                             \
+    }                                                          \
+}
+
+TEST(Sfd)
+TEST(Sfl)
+TEST(Sdf)
+TEST(Sdl)
+TEST(Slf)
+TEST(Sld)
+TEST(Sfdl)
+TEST(Sfld)
+TEST(Sdfl)
+TEST(Sdlf)
+TEST(Slfd)
+TEST(Sldf)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-10_main.c b/gcc/testsuite/gcc.dg/compat/struct-return-10_main.c
new file mode 100644 (file)
index 0000000..fca6828
--- /dev/null
@@ -0,0 +1,13 @@
+/* Test function return values.  For this test, all struct members are
+   scalar floating point types.  */
+
+extern void struct_return_10_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+  struct_return_10_x ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-10_x.c b/gcc/testsuite/gcc.dg/compat/struct-return-10_x.c
new file mode 100644 (file)
index 0000000..f3e375b
--- /dev/null
@@ -0,0 +1,115 @@
+#include "compat-common.h"
+
+#define T(TYPE)                                                        \
+TYPE g01##TYPE, g02##TYPE, g03##TYPE, g04##TYPE;               \
+TYPE g05##TYPE, g06##TYPE, g07##TYPE, g08##TYPE;               \
+TYPE g09##TYPE, g10##TYPE, g11##TYPE, g12##TYPE;               \
+TYPE g13##TYPE, g14##TYPE, g15##TYPE, g16##TYPE;               \
+                                                               \
+extern void init##TYPE (TYPE *p, double y);                    \
+extern void checkg##TYPE (void);                               \
+extern TYPE test0##TYPE (void);                                        \
+extern TYPE test1##TYPE (TYPE);                                        \
+extern TYPE testva##TYPE (int n, ...);                         \
+                                                               \
+void                                                           \
+testit##TYPE (void)                                            \
+{                                                              \
+  TYPE rslt;                                                   \
+  DEBUG_FPUTS (#TYPE);                                         \
+  DEBUG_FPUTS (" init: ");                                     \
+  init##TYPE  (&g01##TYPE,  1.0);                              \
+  init##TYPE  (&g02##TYPE,  2.0);                              \
+  init##TYPE  (&g03##TYPE,  3.0);                              \
+  init##TYPE  (&g04##TYPE,  4.0);                              \
+  init##TYPE  (&g05##TYPE,  5.0);                              \
+  init##TYPE  (&g06##TYPE,  6.0);                              \
+  init##TYPE  (&g07##TYPE,  7.0);                              \
+  init##TYPE  (&g08##TYPE,  8.0);                              \
+  init##TYPE  (&g09##TYPE,  9.0);                              \
+  init##TYPE  (&g10##TYPE, 10.0);                              \
+  init##TYPE  (&g11##TYPE, 11.0);                              \
+  init##TYPE  (&g12##TYPE, 12.0);                              \
+  init##TYPE  (&g13##TYPE, 13.0);                              \
+  init##TYPE  (&g14##TYPE, 14.0);                              \
+  init##TYPE  (&g15##TYPE, 15.0);                              \
+  init##TYPE  (&g16##TYPE, 16.0);                              \
+  checkg##TYPE ();                                             \
+  DEBUG_NL;                                                    \
+  DEBUG_FPUTS (#TYPE);                                         \
+  DEBUG_FPUTS (" test0: ");                                    \
+  rslt = test0##TYPE ();                                       \
+  check##TYPE (rslt, 1.0);                                     \
+  DEBUG_NL;                                                    \
+  DEBUG_FPUTS (#TYPE);                                         \
+  DEBUG_FPUTS (" test1: ");                                    \
+  rslt = test1##TYPE (g01##TYPE);                              \
+  check##TYPE (rslt, 1.0);                                     \
+  DEBUG_NL;                                                    \
+  DEBUG_FPUTS (#TYPE);                                         \
+  DEBUG_FPUTS (" testva:");                                    \
+  rslt = testva##TYPE (1, g01##TYPE);                          \
+  check##TYPE (rslt, 1.0);                                     \
+  rslt = testva##TYPE (5, g01##TYPE, g02##TYPE,                        \
+                         g03##TYPE, g04##TYPE,                 \
+                         g05##TYPE);                           \
+  check##TYPE (rslt, 5.0);                                     \
+  rslt = testva##TYPE (9, g01##TYPE, g02##TYPE,                        \
+                         g03##TYPE, g04##TYPE,                 \
+                         g05##TYPE, g06##TYPE,                 \
+                         g07##TYPE, g08##TYPE,                 \
+                         g09##TYPE);                           \
+  check##TYPE (rslt, 9.0);                                     \
+  rslt = testva##TYPE (16, g01##TYPE, g02##TYPE,               \
+                         g03##TYPE, g04##TYPE,                 \
+                         g05##TYPE, g06##TYPE,                 \
+                         g07##TYPE, g08##TYPE,                 \
+                         g09##TYPE, g10##TYPE,                 \
+                         g11##TYPE, g12##TYPE,                 \
+                         g13##TYPE, g14##TYPE,                 \
+                         g15##TYPE, g16##TYPE);                \
+  check##TYPE (rslt, 16.0);                                    \
+  DEBUG_NL;                                                    \
+}
+
+#include "fp2-struct-defs.h"
+#include "fp2-struct-check.h"
+
+T(Sfd);
+T(Sfl);
+T(Sdf);
+T(Sdl);
+T(Slf);
+T(Sld);
+T(Sfdl);
+T(Sfld);
+T(Sdfl);
+T(Sdlf);
+T(Slfd);
+T(Sldf);
+
+#undef T
+
+void
+struct_return_10_x ()
+{
+#define T(TYPE) testit##TYPE ();
+
+T(Sfd);
+T(Sfl);
+T(Sdf);
+T(Sdl);
+T(Slf);
+T(Sld);
+T(Sfdl);
+T(Sfld);
+T(Sdfl);
+T(Sdlf);
+T(Slfd);
+T(Sldf);
+
+if (fails != 0)
+  return;
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-10_y.c b/gcc/testsuite/gcc.dg/compat/struct-return-10_y.c
new file mode 100644 (file)
index 0000000..2cd9c60
--- /dev/null
@@ -0,0 +1,85 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+/* Turn off checking for variable arguments with -DSKIPVA.  */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp2-struct-defs.h"
+#include "fp2-struct-init.h"
+
+#define T(TYPE)                                                        \
+extern TYPE g01##TYPE, g02##TYPE, g03##TYPE, g04##TYPE;                \
+extern TYPE g05##TYPE, g06##TYPE, g07##TYPE, g08##TYPE;                \
+extern TYPE g09##TYPE, g10##TYPE, g11##TYPE, g12##TYPE;                \
+extern TYPE g13##TYPE, g14##TYPE, g15##TYPE, g16##TYPE;                \
+                                                               \
+extern void check##TYPE (TYPE x, double y);                    \
+                                                               \
+void                                                           \
+checkg##TYPE (void)                                            \
+{                                                              \
+  check##TYPE (g01##TYPE,  1.0);                                       \
+  check##TYPE (g02##TYPE,  2.0);                                       \
+  check##TYPE (g03##TYPE,  3.0);                                       \
+  check##TYPE (g04##TYPE,  4.0);                                       \
+  check##TYPE (g05##TYPE,  5.0);                                       \
+  check##TYPE (g06##TYPE,  6.0);                                       \
+  check##TYPE (g07##TYPE,  7.0);                                       \
+  check##TYPE (g08##TYPE,  8.0);                                       \
+  check##TYPE (g09##TYPE,  9.0);                                       \
+  check##TYPE (g10##TYPE, 10.0);                                       \
+  check##TYPE (g11##TYPE, 11.0);                                       \
+  check##TYPE (g12##TYPE, 12.0);                                       \
+  check##TYPE (g13##TYPE, 13.0);                                       \
+  check##TYPE (g14##TYPE, 14.0);                                       \
+  check##TYPE (g15##TYPE, 15.0);                                       \
+  check##TYPE (g16##TYPE, 16.0);                                       \
+}                                                              \
+                                                               \
+TYPE                                                           \
+test0##TYPE (void)                                             \
+{                                                              \
+  return g01##TYPE;                                            \
+}                                                              \
+                                                               \
+TYPE                                                           \
+test1##TYPE (TYPE x01)                                         \
+{                                                              \
+  return x01;                                                  \
+}                                                              \
+                                                               \
+TYPE                                                           \
+testva##TYPE (int n, ...)                                      \
+{                                                              \
+  int i;                                                       \
+  TYPE rslt;                                                   \
+  va_list ap;                                                  \
+  if (test_va)                                                 \
+    {                                                          \
+      va_start (ap, n);                                                \
+      for (i = 0; i < n; i++)                                  \
+       {                                                       \
+         rslt = va_arg (ap, TYPE);                             \
+       }                                                       \
+      va_end (ap);                                             \
+    }                                                          \
+  return rslt;                                                 \
+}
+
+T(Sfd)
+T(Sfl)
+T(Sdf)
+T(Sdl)
+T(Slf)
+T(Sld)
+T(Sfdl)
+T(Sfld)
+T(Sdfl)
+T(Sdlf)
+T(Slfd)
+T(Sldf)