Implement C _FloatN, _FloatNx types.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / fp-int-convert-float128-timode-3.c
blobfa6eb6b72bf3b0eb0fec67be67ecb1e4b0101199
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 } */
10 #include <fenv.h>
11 #include <stdlib.h>
13 int
14 main (void)
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);