Debian Codegraph @

gcc/testsuite/gcc.dg/torture/bitint-19.c

raw
1 /* PR c/102989 */
2 /* { dg-do run { target { bitint && int32plus } } } */
3 /* { dg-options "-std=c23 -pedantic-errors" } */
4 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
5 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
6
7 #if __BITINT_MAXWIDTH__ >= 135
8 __attribute__((noipa)) void
9 test_135 (unsigned _BitInt(135) *p, unsigned _BitInt(39) *q, int i)
10 {
11 p[3] = p[0] / p[1];
12 p[4] = p[2] / *q;
13 p[5] = p[i] % p[1 + i];
14 p[6] = p[2 + i] % q[i];
15 }
16 #endif
17
18 #if __BITINT_MAXWIDTH__ >= 192
19 __attribute__((noipa)) void
20 test_192 (unsigned _BitInt(192) *p, unsigned _BitInt(62) *q, int i)
21 {
22 p[3] = p[0] / p[1];
23 p[4] = p[2] / *q;
24 p[5] = p[i] % p[1 + i];
25 p[6] = p[2 + i] % q[i];
26 }
27 #endif
28
29 #if __BITINT_MAXWIDTH__ >= 575
30 __attribute__((noipa)) void
31 test_575 (unsigned _BitInt(575) *p, unsigned _BitInt(125) *q, int i)
32 {
33 p[3] = p[0] / p[1];
34 p[4] = p[2] / *q;
35 p[5] = p[i] % p[1 + i];
36 p[6] = p[2 + i] % q[i];
37 }
38 #endif
39
40 int
41 main ()
42 {
43 #if __BITINT_MAXWIDTH__ >= 135
44 static unsigned _BitInt(135) s135[] = {
45 39967592296255191197035336461290090324829uwb,
46 312558523056789678960549094065358uwb,
47 32832062726968675550596542626872563693099uwb,
48 0, 0, 0, 0,
49 39684305085076546670125468925068uwb,
50 6804617795530664696186192571276807994017uwb,
51 908900452537968951389639987294090uwb,
52 0, 0, 0, 0,
53 20395215776806618633686937572550377003558uwb,
54 1uwb,
55 2017874535031304931048003948865783841241uwb,
56 0, 0, 0, 0,
57 16804502949303659647220377886348649uwb,
58 15969624846496231063802991739581uwb,
59 12583271616670577644431817717623569600333uwb,
60 0, 0, 0, 0,
61 127872348uwb,
62 89851078235647451008683745245uwb,
63 65571357606183724433879897404245uwb,
64 87071527329uwb,
65 0uwb,
66 2093478262068616207802533uwb,
67 39684305085076546670125468925068uwb,
68 228138242uwb,
69 20395215776806618633686937572550377003558uwb,
70 12999486295301452164134194354389uwb,
71 0uwb,
72 65232213uwb,
73 1052uwb,
74 299601705158823277248376612324370704769uwb,
75 4457610789624568099630576309437uwb,
76 35uwb
77 };
78 static unsigned _BitInt(39) s39[] = {
79 365405328146uwb,
80 434158056uwb,
81 155227252uwb,
82 42uwb
83 };
84 for (int i = 0; i < 4; ++i)
85 {
86 test_135 (s135 + 7 * i, s39 + i, 0);
87 for (int j = 0; j < 4; ++j)
88 if (s135[7 * i + 3 + j] != s135[7 * 4 + 4 * i + j])
89 __builtin_abort ();
90 }
91 #endif
92 #if __BITINT_MAXWIDTH__ >= 192
93 static unsigned _BitInt(192) s192[] = {
94 1124505164324393257294640774883626666393496137407657383285uwb,
95 267770052679215918410877624132556357420375522461819642uwb,
96 4639722531344459905931256257525470190970246632351027146771uwb,
97 0, 0, 0, 0,
98 37076404019741709360338653279977uwb,
99 4017103983634913740425503780735862298200532685100197316953uwb,
100 3278541912894246916134094695331450716143029898422059693966uwb,
101 0, 0, 0, 0,
102 181260360652955273548771772757571198044332327135683350561uwb,
103 3uwb,
104 278424729322219534657080470631020618602047522343uwb,
105 0, 0, 0, 0,
106 1546922522984382736106987324181069322701408057466881095437uwb,
107 2859498891267655913293729558067200232488079281528uwb,
108 3754903553201168811081807274774774084224112858563658575772uwb,
109 0, 0, 0, 0,
110 4199uwb,
111 1361868478710180046608174894774272890845uwb,
112 138713124365615887365631151022521585339318590476706527uwb,
113 704022636372799201uwb,
114 0uwb,
115 1800071738275562493471915107371110587374384505uwb,
116 37076404019741709360338653279977uwb,
117 989224815596uwb,
118 60420120217651757849590590919190399348110775711894450187uwb,
119 35811149155369659378220712438655uwb,
120 0uwb,
121 971271817233568uwb,
122 540976787uwb,
123 268207396657226343648700519626769577444579489897404183983uwb,
124 356343883111794920610945410844353911944595204901uwb,
125 10uwb
126 };
127 static unsigned _BitInt(62) s62[] = {
128 3406880035683564506uwb,
129 1821339585074uwb,
130 7774805776666105uwb,
131 14uwb
132 };
133 for (int i = 0; i < 4; ++i)
134 {
135 test_192 (s192 + 7 * i, s62 + i, 0);
136 for (int j = 0; j < 4; ++j)
137 if (s192[7 * i + 3 + j] != s192[7 * 4 + 4 * i + j])
138 __builtin_abort ();
139 }
140 #endif
141 #if __BITINT_MAXWIDTH__ >= 575
142 static unsigned _BitInt(575) s575[] = {
143 68262105478469356136430990337792292171975154797241096882998520215082649730969604949380226799284423285674920339289406073226899446201591827481846481242318203838114185414101609uwb,
144 522191246473430521641066810210970739255168853016819760532584735359478867620239849176927824047731938802486584777452655079470889576128018146184619338332252916338uwb,
145 3435470059299599312416077239534464560179043115309368866437635382063534713476732558299272800804091725646363342046360614869573337710790812486381755554721429381220646362uwb,
146 0, 0, 0, 0,
147 1395593888697848626057320338038084790564831152710988743807319327067660279846004696629681887779842129545558985841571482256386uwb,
148 21441995702257150447349407715894435455050772126685461031315827571889336447926694701361700730379084806621691641000793333457504299685338550064151630805530260276144722300318378uwb,
149 1810496946211232933828329287232831944898449501818263455079805575961543103376888822223202088001971904867510317357383306521333499198279246848350610021364570531uwb,
150 0, 0, 0, 0,
151 49645180073615279861687094823459626955281549193691328477580826482861925123118554141451230055925103484376691314925103229496483975307219087542024089047037648064847114147876643uwb,
152 5uwb,
153 107934287940096962208124285810972463665238866518161589834947495273979231095066254158254278656128778606292981405785821524489035396101282777095285918056890626313652996363360635uwb,
154 0, 0, 0, 0,
155 23608107814490548232484082204335368855445148092939475311496653239338164906367806895605948777993633707136572413097677855946274968766053297446456942019070196462866449343995194uwb,
156 2583203116898176965174690967993977971553570592649244007260134674599130988578292547989776393639164uwb,
157 275574884364090029934989506452294812428150053792728044335881034126425125444715551780251783116966457185581504439797097624639857491748084495990405201247685674533629814uwb,
158 0, 0, 0, 0,
159 130722423900191uwb,
160 98209305532955450849963417931387543706587302562952677389372338515039360888927455577958981902466648551427758908831114835123178381uwb,
161 452871192905895539483003814306315901853065835276102489810630370966701886335873219401733574293829636677996055324174200714778800368052970790656772945453428881051uwb,
162 22873946842052620485494389199978222125uwb,
163 0uwb,
164 47552124733256427939572722329767524480111793387357122806941820665877774450470824535764237662603507442099431904312121406656289uwb,
165 1395593888697848626057320338038084790564831152710988743807319327067660279846004696629681887779842129545558985841571482256386uwb,
166 12402931424678892069400953011343uwb,
167 9929036014723055972337418964691925391056309838738265695516165296572385024623710828290246011185020696875338262985020645899296795061443817508404817809407529612969422829575328uwb,
168 765676291859168654790768770138076157159515580930329832291016877204190990758886004368955392441159337179098419446671535422387547862111454482076132380462913464uwb,
169 3uwb,
170 139483670059084867uwb,
171 9139083047731208433628027573752517850138452745189939065766817977544782897707uwb,
172 582502183871265798930967135317783829723227597448966288820692884195884049998974821351103238544771373433464199926206342695349404216240804690670860uwb,
173 331751853749540937734694164624358910388009028150635800666238028944699092436048473910402462998246uwb,
174 30656037717616877434uwb
175 };
176 static unsigned _BitInt(125) s125[] = {
177 34981105310298535974120492274604066977uwb,
178 38073944253116192522082228985492uwb,
179 140965952697865937uwb,
180 473088156567311094933uwb
181 };
182 for (int i = 0; i < 4; ++i)
183 {
184 test_575 (s575 + 7 * i, s125 + i, 0);
185 for (int j = 0; j < 4; ++j)
186 if (s575[7 * i + 3 + j] != s575[7 * 4 + 4 * i + j])
187 __builtin_abort ();
188 }
189 #endif
190 }