1 /* Test for correct rounding of conversions from __int128 to 2 __float128. */ 3 /* { dg-do run } */ 4 /* { dg-require-effective-target __float128 } */ 5 /* { dg-require-effective-target base_quadfloat_support } */ 6 /* { dg-require-effective-target int128 } */ 7 /* { dg-options "-frounding-math" } */ 8 /* { dg-add-options __float128 } */ 9 10 #include <fenv.h> 11 #include <stdlib.h> 12 13 int main(void)14main (void) 15 { 16 volatile unsigned long long h = -1ULL; 17 volatile unsigned __int128 u128 = (((unsigned __int128) h) << 64) | h; 18 volatile __int128 s128 = u128 >> 1; 19 fesetround (FE_TOWARDZERO); 20 __float128 ru = u128, rs = s128; 21 if (ru != 0x1.ffffffffffffffffffffffffffffp127q) 22 abort (); 23 if (rs != 0x1.ffffffffffffffffffffffffffffp126q) 24 abort (); 25 exit (0); 26 } 27