Debian Codegraph @

gcc/testsuite/gcc.dg/dfp/bitint-2.c

raw
1 /* PR c/102989 */
2 /* { dg-require-effective-target bitint } */
3 /* { dg-options "-O2 -std=c23 -pedantic-errors" } */
4
5 #if __BITINT_MAXWIDTH__ >= 192
6 __attribute__((noipa)) _BitInt(192)
7 tests192 (_Decimal32 d)
8 {
9 return d;
10 }
11
12 __attribute__((noipa)) unsigned _BitInt(192)
13 testu192 (_Decimal32 d)
14 {
15 return d;
16 }
17 #endif
18
19 #if __BITINT_MAXWIDTH__ >= 575
20 __attribute__((noipa)) _BitInt(575)
21 tests575 (_Decimal32 d)
22 {
23 return d;
24 }
25
26 __attribute__((noipa)) unsigned _BitInt(575)
27 testu575 (_Decimal32 d)
28 {
29 return d;
30 }
31 #endif
32
33 int
34 main ()
35 {
36 #if __BITINT_MAXWIDTH__ >= 192
37 if (tests192 (0.DF) != 0wb
38 || tests192 (0.9999999DF) != 0wb
39 || tests192 (7.999999DF) != 7wb
40 || tests192 (-0.000DF) != 0wb
41 || tests192 (-0.9999999DF) != 0wb
42 || tests192 (-1.DF) != -1wb
43 || tests192 (-42.5DF) != -42wb
44 || tests192 (-3424.231e+27DF) != -3424231000000000000000000000000wb
45 || tests192 (-213855.9e+43DF) != -2138559000000000000000000000000000000000000000000wb
46 || tests192 (313855.0e+52DF) != 3138550000000000000000000000000000000000000000000000000000wb
47 || tests192 (-3138550.e+51DF) != -3138550000000000000000000000000000000000000000000000000000wb)
48 __builtin_abort ();
49 if (tests192 (313855.1e+52DF) != 3138550867693340381917894711603833208051177722232017256447wb
50 || tests192 (9999999e+90DF) != 3138550867693340381917894711603833208051177722232017256447wb
51 || tests192 (-3138551e+51DF) != -3138550867693340381917894711603833208051177722232017256447wb - 1wb
52 || tests192 (-9999999e+90DF) != -3138550867693340381917894711603833208051177722232017256447wb - 1wb)
53 __builtin_abort ();
54 if (testu192 (0.DF) != 0uwb
55 || testu192 (0.9999999DF) != 0uwb
56 || testu192 (-0.9999999DF) != 0uwb
57 || testu192 (-0.5DF) != 0uwb
58 || testu192 (-0.0000DF) != 0uwb
59 || testu192 (-0.99999DF) != 0uwb
60 || testu192 (42.99999DF) != 42uwb
61 || testu192 (42.e+21DF) != 42000000000000000000000uwb
62 || testu192 (3427.231e+29DF) != 342723100000000000000000000000000uwb
63 || testu192 (6277101.0e+51DF) != 6277101000000000000000000000000000000000000000000000000000uwb)
64 __builtin_abort ();
65 if (testu192 (-1.DF) != 0uwb
66 || testu192 (-42.5e+15DF) != 0uwb
67 || testu192 (-9999999e+90DF) != 0uwb
68 || testu192 (6277102.0e+51DF) != 6277101735386680763835789423207666416102355444464034512895uwb
69 || testu192 (9999999e+90DF) != 6277101735386680763835789423207666416102355444464034512895uwb)
70 __builtin_abort ();
71 #endif
72 #if __BITINT_MAXWIDTH__ >= 575
73 if (tests575 (0.DF) != 0wb
74 || tests575 (0.999999DF) != 0wb
75 || tests575 (12.9999DF) != 12wb
76 || tests575 (-0.DF) != 0wb
77 || tests575 (-0.999DF) != 0wb
78 || tests575 (-1.0000DF) != -1wb
79 || tests575 (-89.5DF) != -89wb
80 || tests575 (-34242.31e+37DF) != -342423100000000000000000000000000000000000wb
81 || tests575 (-518326.2e+88DF) != -5183262000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb
82 || tests575 (9999999e+90DF) != 9999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb
83 || tests575 (-9999999e+90DF) != -9999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb)
84 __builtin_abort ();
85 if (testu575 (0.DF) != 0uwb
86 || testu575 (0.5555555DF) != 0uwb
87 || testu575 (-0.7777777DF) != 0uwb
88 || testu575 (-0.99DF) != 0uwb
89 || testu575 (-0.DF) != 0uwb
90 || testu575 (-0.7777777DF) != 0uwb
91 || testu575 (-0.9999999DF) != 0uwb
92 || testu575 (42.99999DF) != 42uwb
93 || testu575 (42.e+21DF) != 42000000000000000000000uwb
94 || testu575 (9427.231e+27DF) != 9427231000000000000000000000000uwb
95 || testu575 (9999999e+90DF) != 9999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000uwb)
96 __builtin_abort ();
97 if (testu575 (-1.DF) != 0uwb
98 || testu575 (-42.5e+15DF) != 0uwb
99 || testu575 (-9999999e+90DF) != 0uwb)
100 __builtin_abort ();
101 #endif
102 }