aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/darwin-split-ld-stret.c87
2 files changed, 91 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8671f3e7..1e4d1b7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-12-18 Iain Sandoe <iains@gcc.gnu.org>
+
+ * gcc.target/powerpc/darwin-split-ld-stret.c: New test.
+
2010-12-17 Ahmad Sharif <asharif@google.com>
* gcc.target/i386/max-stack-align.c: New testcase.
diff --git a/gcc/testsuite/gcc.target/powerpc/darwin-split-ld-stret.c b/gcc/testsuite/gcc.target/powerpc/darwin-split-ld-stret.c
new file mode 100644
index 0000000..be4e438
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/darwin-split-ld-stret.c
@@ -0,0 +1,87 @@
+/* Check for Darwin m64 that we do not try to pass & return by value for a
+ struct exceeding the number of arg FPRs (the struct here straddles the
+ split-point). */
+/* { dg-do run { target { powerpc*-*-darwin* && lp64 } } } */
+
+extern void abort (void);
+
+/*#define DEBUG*/
+
+#ifdef DEBUG
+extern int printf (const char *, ...);
+extern int printf$LDBL128 (const char *, ...);
+#endif
+
+typedef struct fourteen {
+ long double a, b, c, d, e, f, g;
+} fourteen_t ;
+
+fourteen_t foo (fourteen_t, fourteen_t) __attribute__ ((noinline));
+
+fourteen_t
+foo (fourteen_t aa, fourteen_t bb)
+{
+ fourteen_t r;
+
+ r.a = aa.a + bb.a;
+ r.b = aa.b + bb.b;
+ r.c = aa.c + bb.c;
+ r.d = aa.d + bb.d;
+ r.e = aa.e + bb.e;
+ r.f = aa.f + bb.f;
+ r.g = aa.g + bb.g;
+
+#ifdef DEBUG
+#ifdef __ppc64__
+ printf
+#else
+ printf$LDBL128
+#endif
+ ("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: "
+ "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n",
+ aa.a, aa.b, aa.c, aa.d, aa.e, aa.f, aa.g,
+ bb.a, bb.b, bb.c, bb.d, bb.e, bb.f, bb.g,
+ r.a, r.b, r.c, r.d, r.e, r.f, r.g);
+ printf ("aa.g %ll16x %ll16x\nbb.g %ll16x %ll16x\n",
+ *(unsigned long long*)&aa.g,
+ *(unsigned long long*)(((char *)&aa.g)+8),
+ *(unsigned long long*)&bb.g,
+ *(unsigned long long*)(((char *)&bb.g)+8));
+
+#endif
+
+ __asm__ (""); /* double make sure we don't get inlined */
+ return r;
+}
+
+int
+main (void)
+{
+ fourteen_t x = { 1.L, 2.L, 3.L, 4.L, 5.L, 6.L,-12.3456789123456789L };
+ fourteen_t y = { 8.L, 9.L, 10.L, 11.L, 12.L, 13.L, 12.3456789123456789L };
+ fourteen_t z ;
+ long double zz;
+
+ z = foo (x,y);
+ zz = x.g + y.g;
+#ifdef DEBUG
+#ifdef __ppc64__
+ printf
+#else
+ printf$LDBL128
+#endif
+ (" z: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n"
+ "ret: %ll16x %ll16x\nzz : %ll16x %ll16x\n",
+ z.a, z.b, z.c, z.d, z.e, z.f, z.g,
+ *(unsigned long long*)&z.g,
+ *(unsigned long long*)(((char *)&z.g)+8),
+ *(unsigned long long*)&zz,
+ *(unsigned long long*)(((char *)&zz)+8));
+#endif
+
+ /* Yes, we really do want to do an equality test here. */
+ if (z.g != zz)
+ abort ();
+
+ return 0;
+}