(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
darwin-split-ld-stret.c
       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 } } } */
       5  
       6  extern void abort (void);
       7  
       8  /*#define DEBUG*/
       9  
      10  #ifdef DEBUG
      11  extern int printf (const char *, ...);
      12  extern int printf$LDBL128 (const char *, ...);
      13  #endif
      14  
      15  typedef struct fourteen {
      16    long double a, b, c, d, e, f, g;
      17  } fourteen_t ;
      18  
      19  fourteen_t foo (fourteen_t, fourteen_t) __attribute__ ((noinline));
      20  
      21  fourteen_t 
      22  foo (fourteen_t aa, fourteen_t bb) 
      23  {
      24    fourteen_t r;
      25  
      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;
      33  
      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));
      50   
      51  #endif
      52  
      53    __asm__ (""); /* double make sure we don't get inlined */
      54    return r;
      55  }
      56  
      57  int
      58  main (void)
      59  {
      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;
      64    
      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
      81  
      82    /* Yes, we really do want to do an equality test here.  */
      83    if (z.g != zz)
      84      abort ();
      85  
      86    return 0;
      87  }