(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
float128-hw2.c
       1  /* { dg-do compile { target lp64 } } */
       2  /* { dg-require-effective-target powerpc_p9vector_ok } */
       3  /* { dg-require-effective-target float128 } */
       4  /* { dg-options "-mpower9-vector -O2 -ffast-math -std=gnu11" } */
       5  
       6  /* Test to make sure the compiler handles the standard _Float128 functions that
       7     have hardware support in ISA 3.0/power9.  */
       8  
       9  #define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
      10  
      11  #ifndef __FP_FAST_FMAF128
      12  #error "__FP_FAST_FMAF128 should be defined."
      13  #endif
      14  
      15  extern _Float128 copysignf128 (_Float128, _Float128);
      16  extern _Float128 sqrtf128 (_Float128);
      17  extern _Float128 fmaf128 (_Float128, _Float128, _Float128);
      18  extern _Float128 ceilf128 (_Float128);
      19  extern _Float128 floorf128 (_Float128);
      20  extern _Float128 truncf128 (_Float128);
      21  extern _Float128 roundf128 (_Float128);
      22  
      23  _Float128
      24  do_copysign (_Float128 a, _Float128 b)
      25  {
      26    return copysignf128 (a, b);
      27  }
      28  
      29  _Float128
      30  do_sqrt (_Float128 a)
      31  {
      32    return sqrtf128 (a);
      33  }
      34  
      35  _Float128
      36  do_fma (_Float128 a, _Float128 b, _Float128 c)
      37  {
      38    return fmaf128 (a, b, c);
      39  }
      40  
      41  _Float128
      42  do_fms (_Float128 a, _Float128 b, _Float128 c)
      43  {
      44    return fmaf128 (a, b, -c);
      45  }
      46  
      47  _Float128
      48  do_nfma (_Float128 a, _Float128 b, _Float128 c)
      49  {
      50    return -fmaf128 (a, b, c);
      51  }
      52  
      53  _Float128
      54  do_nfms (_Float128 a, _Float128 b, _Float128 c)
      55  {
      56    return -fmaf128 (a, b, -c);
      57  }
      58  
      59  _Float128
      60  do_ceil (_Float128 a)
      61  {
      62    return ceilf128 (a);
      63  }
      64  
      65  _Float128
      66  do_floor (_Float128 a)
      67  {
      68    return floorf128 (a);
      69  }
      70  
      71  _Float128
      72  do_trunc (_Float128 a)
      73  {
      74    return truncf128 (a);
      75  }
      76  
      77  _Float128
      78  do_round (_Float128 a)
      79  {
      80    return roundf128 (a);
      81  }
      82  
      83  /* { dg-final { scan-assembler     {\mxscpsgnqp\M} } } */
      84  /* { dg-final { scan-assembler     {\mxssqrtqp\M}  } } */
      85  /* { dg-final { scan-assembler     {\mxsmaddqp\M}  } } */
      86  /* { dg-final { scan-assembler     {\mxsmsubqp\M}  } } */
      87  /* { dg-final { scan-assembler     {\mxsnmaddqp\M} } } */
      88  /* { dg-final { scan-assembler     {\mxsnmsubqp\M} } } */
      89  /* { dg-final { scan-assembler     {\mxsrqpi\M}    } } */
      90  /* { dg-final { scan-assembler-not {\mbl\M}        } } */