1  /* Test for correct rounding of conversions from __int128 to
       2     float.  */
       3  /* { dg-do run } */
       4  /* { dg-require-effective-target int128 } */
       5  /* { dg-require-effective-target fenv } */
       6  /* { dg-options "-frounding-math" } */
       7  
       8  #include <fenv.h>
       9  #include <stdlib.h>
      10  
      11  int
      12  main (void)
      13  {
      14  #ifdef FE_DOWNWARD
      15    volatile unsigned long long h = 0x8000000000000000LL;
      16    volatile unsigned long long l = 0xdLL;
      17    volatile unsigned __int128 u128 = (((unsigned __int128) h) << 64) | l;
      18    volatile __int128 s128 = u128;
      19    fesetround (FE_DOWNWARD);
      20    float fs = s128;
      21    if (fs != -0x1p+127)
      22      abort ();
      23    double ds = s128;
      24    if (ds != -0x1p+127)
      25      abort ();
      26  #endif
      27    exit (0);
      28  }