Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / darwin-split-ld-stret.c
blobbe4e43892275bb813174d308dc6d4031f33343c3
1 /* Check for Darwin m64 that we do not try to pass & return by value for a
2 struct exceeding the number of arg FPRs (the struct here straddles the
3 split-point). */
4 /* { dg-do run { target { powerpc*-*-darwin* && lp64 } } } */
6 extern void abort (void);
8 /*#define DEBUG*/
10 #ifdef DEBUG
11 extern int printf (const char *, ...);
12 extern int printf$LDBL128 (const char *, ...);
13 #endif
15 typedef struct fourteen {
16 long double a, b, c, d, e, f, g;
17 } fourteen_t ;
19 fourteen_t foo (fourteen_t, fourteen_t) __attribute__ ((noinline));
21 fourteen_t
22 foo (fourteen_t aa, fourteen_t bb)
24 fourteen_t r;
26 r.a = aa.a + bb.a;
27 r.b = aa.b + bb.b;
28 r.c = aa.c + bb.c;
29 r.d = aa.d + bb.d;
30 r.e = aa.e + bb.e;
31 r.f = aa.f + bb.f;
32 r.g = aa.g + bb.g;
34 #ifdef DEBUG
35 #ifdef __ppc64__
36 printf
37 #else
38 printf$LDBL128
39 #endif
40 ("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: "
41 "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n",
42 aa.a, aa.b, aa.c, aa.d, aa.e, aa.f, aa.g,
43 bb.a, bb.b, bb.c, bb.d, bb.e, bb.f, bb.g,
44 r.a, r.b, r.c, r.d, r.e, r.f, r.g);
45 printf ("aa.g %ll16x %ll16x\nbb.g %ll16x %ll16x\n",
46 *(unsigned long long*)&aa.g,
47 *(unsigned long long*)(((char *)&aa.g)+8),
48 *(unsigned long long*)&bb.g,
49 *(unsigned long long*)(((char *)&bb.g)+8));
51 #endif
53 __asm__ (""); /* double make sure we don't get inlined */
54 return r;
57 int
58 main (void)
60 fourteen_t x = { 1.L, 2.L, 3.L, 4.L, 5.L, 6.L,-12.3456789123456789L };
61 fourteen_t y = { 8.L, 9.L, 10.L, 11.L, 12.L, 13.L, 12.3456789123456789L };
62 fourteen_t z ;
63 long double zz;
65 z = foo (x,y);
66 zz = x.g + y.g;
67 #ifdef DEBUG
68 #ifdef __ppc64__
69 printf
70 #else
71 printf$LDBL128
72 #endif
73 (" z: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n"
74 "ret: %ll16x %ll16x\nzz : %ll16x %ll16x\n",
75 z.a, z.b, z.c, z.d, z.e, z.f, z.g,
76 *(unsigned long long*)&z.g,
77 *(unsigned long long*)(((char *)&z.g)+8),
78 *(unsigned long long*)&zz,
79 *(unsigned long long*)(((char *)&zz)+8));
80 #endif
82 /* Yes, we really do want to do an equality test here. */
83 if (z.g != zz)
84 abort ();
86 return 0;