1 /* Test non-canonical BID significands: _Decimal128, case where
2 combination field starts 11. Bug 91226. */
3 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
4 /* { dg-options "-std=gnu2x -O2" } */
5
6 extern void abort (void);
7 extern void exit (int);
8
9 union u
10 {
11 _Decimal128 d128;
12 unsigned __int128 u128;
13 };
14
15 #define U128(hi, lo) (((unsigned __int128) lo) \
16 | (((unsigned __int128) hi) << 64))
17
18 int
main(void)19 main (void)
20 {
21 unsigned __int128 i = U128 (0x6e79000000000000ULL, 0x1ULL);
22 union u x;
23 _Decimal128 d128;
24 x.u128 = i;
25 d128 = x.d128;
26 volatile double d = d128;
27 if (d != 0)
28 abort ();
29 /* The above number should have quantum exponent 1234. */
30 _Decimal128 t1233 = 0.e1233DL, t1234 = 0.e1234DL, t1235 = 0.e1235DL;
31 _Decimal128 dx;
32 dx = d128 + t1233;
33 if (__builtin_memcmp (&dx, &t1233, 16) != 0)
34 abort ();
35 dx = d128 + t1234;
36 if (__builtin_memcmp (&dx, &t1234, 16) != 0)
37 abort ();
38 dx = d128 + t1235;
39 if (__builtin_memcmp (&dx, &t1234, 16) != 0)
40 abort ();
41 exit (0);
42 }
43