]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/torture/bitint-17.c
testsuite: Refer more consistently to C23 not C2X
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / torture / bitint-17.c
CommitLineData
faff3170
JJ
1/* PR c/102989 */
2/* { dg-do run { target bitint } } */
54bac0ce 3/* { dg-options "-std=c23 -pedantic-errors" } */
faff3170
JJ
4/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
5/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
6
7#if __BITINT_MAXWIDTH__ >= 192
8__attribute__((noipa)) _BitInt(192)
9test192 (int a, int b, int c, int d, int e, int f, int g)
10{
11 _BitInt(192) r;
12 if (a)
13 r = 0wb;
14 else if (b)
15 r = -1wb;
16 else if (c)
17 r = 8509079622807245684wb;
18 else if (d)
19 r = -906140470171472463wb;
20 else if (e)
21 r = 16213049720239626860wb;
22 else if (f)
23 r = 147892183939833533694801609136018843670wb;
24 else if (g)
25 r = -65591640145960897840899726907249505215wb;
26 else
27 r = 2430673202376479588648422478850704999441011825542092986793wb;
28 return r;
29}
30#endif
31
32#if __BITINT_MAXWIDTH__ >= 575
33__attribute__((noipa)) _BitInt(575)
34test575 (int a, int b, int c, int d, int e, int f, int g)
35{
36 _BitInt(575) r;
37 if (a)
38 r = 0wb;
39 else if (b)
40 r = -1wb;
41 else if (c)
42 r = 8509079622807245684wb;
43 else if (d)
44 r = -906140470171472463wb;
45 else if (e)
46 r = 16213049720239626860wb;
47 else if (f)
48 r = 147892183939833533694801609136018843670wb;
49 else if (g)
50 r = -65591640145960897840899726907249505215wb;
51 else
52 r = -61793624342683909782972416440098036406501521208177932544452266579025268523357080574330290352054553626825262073339234752683755828499698570848704076099511077751520231100121930wb;
53 return r;
54}
55#endif
56
57int
58main ()
59{
60#if __BITINT_MAXWIDTH__ >= 192
61 if (test192 (1, 0, 0, 0, 0, 0, 0) != 0wb
62 || test192 (0, 1, 0, 0, 0, 0, 0) != -1wb
63 || test192 (0, 0, 1, 0, 0, 0, 0) != 8509079622807245684wb
64 || test192 (0, 0, 0, 1, 0, 0, 0) != -906140470171472463wb
65 || test192 (0, 0, 0, 0, 1, 0, 0) != 16213049720239626860wb
66 || test192 (0, 0, 0, 0, 0, 1, 0) != 147892183939833533694801609136018843670wb
67 || test192 (0, 0, 0, 0, 0, 0, 1) != -65591640145960897840899726907249505215wb
68 || test192 (0, 0, 0, 0, 0, 0, 0) != 2430673202376479588648422478850704999441011825542092986793wb)
69 __builtin_abort ();
70#endif
71#if __BITINT_MAXWIDTH__ >= 575
72 if (test575 (1, 0, 0, 0, 0, 0, 0) != 0wb
73 || test575 (0, 1, 0, 0, 0, 0, 0) != -1wb
74 || test575 (0, 0, 1, 0, 0, 0, 0) != 8509079622807245684wb
75 || test575 (0, 0, 0, 1, 0, 0, 0) != -906140470171472463wb
76 || test575 (0, 0, 0, 0, 1, 0, 0) != 16213049720239626860wb
77 || test575 (0, 0, 0, 0, 0, 1, 0) != 147892183939833533694801609136018843670wb
78 || test575 (0, 0, 0, 0, 0, 0, 1) != -65591640145960897840899726907249505215wb
79 || test575 (0, 0, 0, 0, 0, 0, 0) != -61793624342683909782972416440098036406501521208177932544452266579025268523357080574330290352054553626825262073339234752683755828499698570848704076099511077751520231100121930wb)
80 __builtin_abort ();
81#endif
82}