Implement C _FloatN, _FloatNx types.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / float128-extend-inf.c
blob35f6efc18b8f81937176190d1795987bd4eacdf4
1 /* Test infinities convert to __float128 infinity. Bug 77265. */
2 /* { dg-do run } */
3 /* { dg-require-effective-target __float128 } */
4 /* { dg-require-effective-target base_quadfloat_support } */
5 /* { dg-add-options __float128 } */
7 extern void abort (void);
8 extern void exit (int);
10 volatile float finf = __builtin_inff ();
11 volatile double dinf = __builtin_inf ();
12 volatile long double ldinf = __builtin_infl ();
13 volatile float nfinf = -__builtin_inff ();
14 volatile double ndinf = -__builtin_inf ();
15 volatile long double nldinf = -__builtin_infl ();
17 int
18 main (void)
20 volatile __float128 r;
21 r = (__float128) finf;
22 if (!__builtin_isinf (r) || __builtin_signbit (r) != 0)
23 abort ();
24 r = (__float128) dinf;
25 if (!__builtin_isinf (r) || __builtin_signbit (r) != 0)
26 abort ();
27 r = (__float128) ldinf;
28 if (!__builtin_isinf (r) || __builtin_signbit (r) != 0)
29 abort ();
30 r = (__float128) nfinf;
31 if (!__builtin_isinf (r) || __builtin_signbit (r) == 0)
32 abort ();
33 r = (__float128) ndinf;
34 if (!__builtin_isinf (r) || __builtin_signbit (r) == 0)
35 abort ();
36 r = (__float128) nldinf;
37 if (!__builtin_isinf (r) || __builtin_signbit (r) == 0)
38 abort ();
39 exit (0);