c: Update checks on constexpr floating-point initializers
[platform/upstream/gcc.git] / gcc / testsuite / gcc.dg / dfp / c2x-constexpr-dfp-1.c
1 /* Test C2x constexpr.  Valid code, compilation tests, DFP.  */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c2x -pedantic-errors" } */
4
5 constexpr _Decimal32 v1 = __DEC32_MIN__;
6 constexpr _Decimal32 v2 = __DEC32_SUBNORMAL_MIN__;
7 constexpr _Decimal32 v3 = -__DEC32_MAX__;
8 constexpr _Decimal64 v4 = __DEC32_MIN__;
9 constexpr _Decimal64 v5 = __DEC32_SUBNORMAL_MIN__;
10 constexpr _Decimal64 v6 = -__DEC32_MAX__;
11 constexpr _Decimal64 v7 = __DEC64_MIN__;
12 constexpr _Decimal64 v8 = __DEC64_SUBNORMAL_MIN__;
13 constexpr _Decimal64 v9 = -__DEC64_MAX__;
14 constexpr _Decimal128 v10 = __DEC32_MIN__;
15 constexpr _Decimal128 v11 = __DEC32_SUBNORMAL_MIN__;
16 constexpr _Decimal128 v12 = -__DEC32_MAX__;
17 constexpr _Decimal128 v13 = __DEC64_MIN__;
18 constexpr _Decimal128 v14 = __DEC64_SUBNORMAL_MIN__;
19 constexpr _Decimal128 v15 = -__DEC64_MAX__;
20 constexpr _Decimal128 v16 = __DEC128_MIN__;
21 constexpr _Decimal128 v17 = __DEC128_SUBNORMAL_MIN__;
22 constexpr _Decimal128 v18 = -__DEC128_MAX__;
23 constexpr _Decimal32 v19 = 1234567L;
24 constexpr _Decimal32 v20 = -123456700000LL;
25 constexpr _Decimal64 v21 = 1234567890123456LL;
26 constexpr _Decimal64 v22 = -123456789012345600LL;
27 constexpr _Decimal128 v23 = (unsigned long long) -1;
28 constexpr _Decimal32 v24 = 1e-101DL;
29 constexpr _Decimal64 v25 = 1e-398DL;
30 constexpr _Decimal32 v26 = __builtin_infd128 ();
31 constexpr _Decimal128 v27 = __builtin_infd32 ();
32 constexpr _Decimal64 v28 = __builtin_nand128 ("");
33 constexpr _Decimal128 v29 = __builtin_nand32 ("");
34 constexpr _Decimal32 v30 = __builtin_nansd32 ("");
35 constexpr _Decimal64 v31 = __builtin_nansd64 ("");
36 constexpr _Decimal128 v32 = __builtin_nansd128 ("");
37 constexpr _Decimal32 v33 = {};
38 constexpr _Decimal64 v34 = {};
39 constexpr _Decimal128 v35 = {};
40 constexpr _Decimal32 v36 = 0.0;
41 constexpr _Decimal32 v37 = 0.0009765625;
42 constexpr _Decimal64 v38 = 6.103515625e-05;
43 constexpr _Decimal32 v39 = __builtin_inf ();
44 constexpr _Decimal32 v40 = __builtin_nan ("");
45
46 void
47 f0 ()
48 {
49   (constexpr _Decimal32) { __DEC32_MIN__ };
50   (constexpr _Decimal32) { __DEC32_SUBNORMAL_MIN__ };
51   (constexpr _Decimal32) { -__DEC32_MAX__ };
52   (constexpr _Decimal64) { __DEC32_MIN__ };
53   (constexpr _Decimal64) { __DEC32_SUBNORMAL_MIN__ };
54   (constexpr _Decimal64) { -__DEC32_MAX__ };
55   (constexpr _Decimal64) { __DEC64_MIN__ };
56   (constexpr _Decimal64) { __DEC64_SUBNORMAL_MIN__ };
57   (constexpr _Decimal64) { -__DEC64_MAX__ };
58   (constexpr _Decimal128) { __DEC32_MIN__ };
59   (constexpr _Decimal128) { __DEC32_SUBNORMAL_MIN__ };
60   (constexpr _Decimal128) { -__DEC32_MAX__ };
61   (constexpr _Decimal128) { __DEC64_MIN__ };
62   (constexpr _Decimal128) { __DEC64_SUBNORMAL_MIN__ };
63   (constexpr _Decimal128) { -__DEC64_MAX__ };
64   (constexpr _Decimal128) { __DEC128_MIN__ };
65   (constexpr _Decimal128) { __DEC128_SUBNORMAL_MIN__ };
66   (constexpr _Decimal128) { -__DEC128_MAX__ };
67   (constexpr _Decimal32) { 1234567L };
68   (constexpr _Decimal32) { -123456700000LL };
69   (constexpr _Decimal64) { 1234567890123456LL };
70   (constexpr _Decimal64) { -123456789012345600LL };
71   (constexpr _Decimal128) { (unsigned long long) -1 };
72   (constexpr _Decimal32) { 1e-101DL };
73   (constexpr _Decimal64) { 1e-398DL };
74   (constexpr _Decimal32) { __builtin_infd128 () };
75   (constexpr _Decimal128) { __builtin_infd32 () };
76   (constexpr _Decimal64) { __builtin_nand128 ("") };
77   (constexpr _Decimal128) { __builtin_nand32 ("") };
78   (constexpr _Decimal32) { __builtin_nansd32 ("") };
79   (constexpr _Decimal64) { __builtin_nansd64 ("") };
80   (constexpr _Decimal128) { __builtin_nansd128 ("") };
81   (constexpr _Decimal32) {};
82   (constexpr _Decimal64) {};
83   (constexpr _Decimal128) {};
84   (constexpr _Decimal32) { 0.0 };
85   (constexpr _Decimal32) { 0.0009765625 };
86   (constexpr _Decimal64) { 6.103515625e-05 };
87   (constexpr _Decimal32) { __builtin_inf () };
88   (constexpr _Decimal32) { __builtin_nan ("") };
89 }