c++: trait as typename scope [PR116052]
[official-gcc.git] / gcc / testsuite / gcc.dg / dfp / bitint-7.c
blob49e8103723cb273c5826b08c947201a76585956c
1 /* PR c/102989 */
2 /* Test non-canonical BID significands. */
3 /* { dg-do run { target bitint } } */
4 /* { dg-require-effective-target dfp_bid } */
5 /* { dg-options "-std=gnu23 -O2" } */
7 union U32
9 _Decimal32 d;
10 unsigned int u;
13 union U64
15 _Decimal64 d;
16 unsigned long long int u;
19 union U128
21 _Decimal128 d;
22 unsigned long long int u[2];
25 int
26 main ()
28 volatile union U32 u32;
29 u32.d = 0.9999999e+27DF;
30 u32.u++;
31 volatile union U64 u64;
32 u64.d = 0.9999999999999999e+90DD;
33 u64.u++;
34 volatile union U128 u128;
35 u128.d = 0.9999999999999999999999999999999999e+39DL;
36 if (u128.u[0] == 0x378d8e63ffffffffULL)
37 u128.u[0]++;
38 else if (u128.u[1] == 0x378d8e63ffffffffULL)
39 u128.u[1]++;
40 else
41 u128.d = 0.DL;
42 #if __BITINT_MAXWIDTH__ >= 192
43 if ((_BitInt(192)) u32.d != 0wb
44 || (unsigned _BitInt(192)) u32.d != 0uwb
45 || (_BitInt(192)) u64.d != 0wb
46 || (unsigned _BitInt(192)) u64.d != 0uwb
47 || (_BitInt(192)) u128.d != 0wb
48 || (unsigned _BitInt(192)) u128.d != 0uwb)
49 __builtin_abort ();
50 #endif
51 #if __BITINT_MAXWIDTH__ >= 575
52 if ((_BitInt(575)) u32.d != 0wb
53 || (unsigned _BitInt(575)) u32.d != 0uwb
54 || (_BitInt(575)) u64.d != 0wb
55 || (unsigned _BitInt(575)) u64.d != 0uwb
56 || (_BitInt(575)) u128.d != 0wb
57 || (unsigned _BitInt(575)) u128.d != 0uwb)
58 __builtin_abort ();
59 #endif
60 u32.u = 0xe59fffffU;
61 u64.u = 0xe3ffffffffffffffULL;
62 if (u128.u[0] == 0x378d8e6400000000ULL)
64 u128.u[0] = -1ULL;
65 u128.u[1] = 0xe1be7fffffffffffULL;
67 else if (u128.u[1] == 0x378d8e6400000000ULL)
69 u128.u[1] = -1ULL;
70 u128.u[0] = 0xe1be7fffffffffffULL;
72 #if __BITINT_MAXWIDTH__ >= 192
73 if ((_BitInt(192)) u32.d != 0wb
74 || (unsigned _BitInt(192)) u32.d != 0uwb
75 || (_BitInt(192)) u64.d != 0wb
76 || (unsigned _BitInt(192)) u64.d != 0uwb
77 || (_BitInt(192)) u128.d != 0wb
78 || (unsigned _BitInt(192)) u128.d != 0uwb)
79 __builtin_abort ();
80 #endif
81 #if __BITINT_MAXWIDTH__ >= 575
82 if ((_BitInt(575)) u32.d != 0wb
83 || (unsigned _BitInt(575)) u32.d != 0uwb
84 || (_BitInt(575)) u64.d != 0wb
85 || (unsigned _BitInt(575)) u64.d != 0uwb
86 || (_BitInt(575)) u128.d != 0wb
87 || (unsigned _BitInt(575)) u128.d != 0uwb)
88 __builtin_abort ();
89 #endif
90 if (u128.u[0] == -1ULL)
92 u128.u[0] = 0;
93 u128.u[1] = 0xe629800000000000ULL;
95 else if (u128.u[1] == -1ULL)
97 u128.u[1] = 0;
98 u128.u[0] = 0xe629800000000000ULL;
100 #if __BITINT_MAXWIDTH__ >= 192
101 if ((_BitInt(192)) u128.d != 0wb
102 || (unsigned _BitInt(192)) u128.d != 0uwb)
103 __builtin_abort ();
104 #endif
105 #if __BITINT_MAXWIDTH__ >= 575
106 if ((_BitInt(575)) u128.d != 0wb
107 || (unsigned _BitInt(575)) u128.d != 0uwb)
108 __builtin_abort ();
109 #endif