Arm: Fix ldrd offset range [PR115153]
[official-gcc.git] / gcc / testsuite / gcc.dg / dfp / bid-non-canonical-d128-2.c
blobd2eedce86e086a6e8af6593c1e283411d37e2cae
1 /* Test non-canonical BID significands: _Decimal128, case where
2 combination field starts 11. Bug 91226. */
3 /* { dg-do run { target { lp64 && dfprt } } } */
4 /* { dg-require-effective-target dfp_bid } */
5 /* { dg-options "-std=gnu23 -O2" } */
7 extern void abort (void);
8 extern void exit (int);
10 union u
12 _Decimal128 d128;
13 unsigned __int128 u128;
16 #define U128(hi, lo) (((unsigned __int128) lo) \
17 | (((unsigned __int128) hi) << 64))
19 int
20 main (void)
22 unsigned __int128 i = U128 (0x6e79000000000000ULL, 0x1ULL);
23 union u x;
24 _Decimal128 d128;
25 x.u128 = i;
26 d128 = x.d128;
27 volatile double d = d128;
28 if (d != 0)
29 abort ();
30 /* The above number should have quantum exponent 1234. */
31 _Decimal128 t1233 = 0.e1233DL, t1234 = 0.e1234DL, t1235 = 0.e1235DL;
32 _Decimal128 dx;
33 dx = d128 + t1233;
34 if (__builtin_memcmp (&dx, &t1233, 16) != 0)
35 abort ();
36 dx = d128 + t1234;
37 if (__builtin_memcmp (&dx, &t1234, 16) != 0)
38 abort ();
39 dx = d128 + t1235;
40 if (__builtin_memcmp (&dx, &t1234, 16) != 0)
41 abort ();
42 exit (0);