[RS6000] Tests that use int128_t and -m32
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / bfp / scalar-test-data-class-14.c
blob84c610de5de33edf0fed21eacac5c40bfbc38d86
1 /* { dg-do run { target { powerpc*-*-* } } } */
2 /* { dg-require-effective-target p9vector_hw } */
3 /* { dg-options "-mdejagnu-cpu=power9" } */
5 #include <altivec.h>
6 #include <stdbool.h>
7 #include <stdlib.h>
9 bool
10 test_nan (__ieee128 *p)
12 __ieee128 source = *p;
15 0x40 Test for NaN
16 0x20 Test for +Infinity
17 0x10 Test for -Infinity
18 0x08 Test for +Zero
19 0x04 Test for -Zero
20 0x02 Test for +Denormal
21 0x01 Test for -Denormal
23 return scalar_test_data_class (source, 0x40);
26 int
27 main ()
29 /* NaN is represented with the maximum biased exponent value and a
30 * non-zero fraction value. The sign bit ignored. If the
31 * high-order bit of the fraction field is 0, then the NaN is a
32 * Signaling NaN. Otherwise, it is a Quiet NaN. */
33 __int128 signal_significand = (__int128) 0xffffffff;
34 __int128 quiet_significand = (((__int128) 0x1) << 112) | 0xffffffff;
35 __int128 a_number_significand = (((__int128) 0x1) << 112);
36 unsigned long long int nan_exponent = 0x7fff;
37 unsigned long long int a_number_exponent = 16383;
39 __ieee128 signaling_nan =
40 scalar_insert_exp (signal_significand, nan_exponent);
41 __ieee128 quiet_nan =
42 scalar_insert_exp (quiet_significand, nan_exponent);
43 __ieee128 a_number =
44 scalar_insert_exp (a_number_significand, a_number_exponent);
46 if (!test_nan (&signaling_nan))
47 abort ();
48 if (!test_nan (&quiet_nan))
49 abort ();
50 if (test_nan (&a_number))
51 abort ();
52 return 0;