aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-1.c
blob: f8da7022213091fadb250548a729190bae10c550 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Test non-canonical BID significands: _Decimal128.  Bug 91226.  */
/* { dg-do run { target lp64 } } */
/* { dg-require-effective-target dfp_bid } */
/* { dg-options "-std=gnu2x -O2" } */

extern void abort (void);
extern void exit (int);

union u
{
  _Decimal128 d128;
  unsigned __int128 u128;
};

#define U128(hi, lo) (((unsigned __int128) lo) \
		      | (((unsigned __int128) hi) << 64))

int
main (void)
{
  unsigned __int128 i = U128 (0x3041ed09bead87c0ULL, 0x378d8e6400000001ULL);
  union u x;
  _Decimal128 d128;
  x.u128 = i;
  d128 = x.d128;
  volatile double d = d128;
  if (d == 0)
    exit (0);
  else
    abort ();
}