From c1ea31e3a56b860b19443fdc83497342bd75eda6 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sat, 18 Dec 2010 08:48:06 +0000 Subject: [PATCH] add new test missed from r167682 testsuite: * gcc.target/powerpc/darwin-split-ld-stret.c: New test. From-SVN: r168015 --- gcc/testsuite/ChangeLog | 4 + .../powerpc/darwin-split-ld-stret.c | 87 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/darwin-split-ld-stret.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8671f3e7ba6..1e4d1b79446 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-12-18 Iain Sandoe + + * gcc.target/powerpc/darwin-split-ld-stret.c: New test. + 2010-12-17 Ahmad Sharif * 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 00000000000..be4e4389227 --- /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; +}