(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
pr85657-2.c
       1  /* { dg-do compile { target { powerpc*-*-linux* } } } */
       2  /* { dg-require-effective-target ppc_float128_sw } */
       3  /* { dg-options "-mvsx -mfloat128 -O2 -mabi=ieeelongdouble -Wno-psabi" } */
       4  
       5  // PR 85657 -- make sure conversions work between each of the 128-bit floating
       6  // point types.
       7  
       8  __attribute__ ((__noinline__))
       9  __float128
      10  ibm128_to_float128 (__ibm128 a)
      11  {
      12    return (__float128)a;
      13  }
      14  
      15  __attribute__ ((__noinline__))
      16  __float128
      17  ldouble_to_float128 (long double a)
      18  {
      19    return (__float128)a;
      20  }
      21  
      22  __attribute__ ((__noinline__))
      23  __ibm128
      24  float128_to_ibm128 (__float128 a)
      25  {
      26    return (__ibm128)a;
      27  }
      28  
      29  __attribute__ ((__noinline__))
      30  __ibm128
      31  ldouble_to_ibm128 (long double a)
      32  {
      33    return (__ibm128)a;
      34  }
      35  
      36  __attribute__ ((__noinline__))
      37  long double
      38  ibm128_to_ldouble (__ibm128 a)
      39  {
      40    return (long double)a;
      41  }
      42  
      43  __attribute__ ((__noinline__))
      44  long double
      45  float128_to_ldouble (__float128 a)
      46  {
      47    return (long double)a;
      48  }
      49  
      50  #ifdef TEST
      51  #include <stdio.h>
      52  
      53  volatile __float128 f128 = 1.2Q;
      54  volatile __ibm128 i128 = (__ibm128)3.4L;
      55  volatile long double ld = 5.6L;
      56  
      57  int
      58  main (void)
      59  {
      60    printf ("f128 (1.2) = %g (ld), %g (ibm128)\n",
      61  	  (double) float128_to_ldouble (f128),
      62  	  (double) float128_to_ibm128 (f128));
      63  
      64    printf ("i128 (3.4) = %g (ld), %g (float128)\n",
      65  	  (double) ibm128_to_ldouble (i128),
      66  	  (double) ibm128_to_float128 (i128));
      67  
      68    printf ("long double (5.6) = %g (ibm128), %g (float128)\n",
      69  	  (double) ldouble_to_ibm128 (ld),
      70  	  (double) ldouble_to_float128 (ld));
      71  
      72    return 0;
      73  }
      74  #endif