| 1 |
/* PR c/102989 */ |
| 2 |
/* { dg-do run { target { bitint && int32plus } } } */ |
| 3 |
/* { dg-options "-std=gnu23" } */ |
| 4 |
/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ |
| 5 |
/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ |
| 6 |
|
| 7 |
#if __BITINT_MAXWIDTH__ >= 251 |
| 8 |
__attribute__((noipa)) _BitInt(251) |
| 9 |
foo_251 (_BitInt(251) x, _BitInt(251) y, _BitInt(251) z) |
| 10 |
{ |
| 11 |
return (x * 42) + (y + z) * -13295847598437589437584395wb; |
| 12 |
} |
| 13 |
|
| 14 |
__attribute__((noipa)) _BitInt(251) |
| 15 |
bar_251 (_BitInt(251) x, unsigned _BitInt(211) y, _BitInt(251) z) |
| 16 |
{ |
| 17 |
if (x >= 139845735984wb || x <= -139845735984wb) |
| 18 |
__builtin_unreachable (); |
| 19 |
return (x * 42) + y * z; |
| 20 |
} |
| 21 |
#endif |
| 22 |
|
| 23 |
#if __BITINT_MAXWIDTH__ >= 274 && defined(__SIZEOF_INT128__) |
| 24 |
__attribute__((noipa)) _BitInt(574) |
| 25 |
foo_574 (_BitInt(574) x, __int128 y, int z) |
| 26 |
{ |
| 27 |
return x * y + x * z; |
| 28 |
} |
| 29 |
#endif |
| 30 |
|
| 31 |
#if __BITINT_MAXWIDTH__ >= 274 |
| 32 |
__attribute__((noipa)) unsigned _BitInt(574) |
| 33 |
bar_574 (unsigned _BitInt(574) x, _BitInt(231) y, unsigned _BitInt(231) z, unsigned _BitInt(574) a) |
| 34 |
{ |
| 35 |
_BitInt(287) w = y; |
| 36 |
_BitInt(231) v = (_BitInt(231)) z; |
| 37 |
_BitInt(287) u = v; |
| 38 |
return x * w + a * u; |
| 39 |
} |
| 40 |
|
| 41 |
__attribute__((noipa)) unsigned _BitInt(271) |
| 42 |
baz_574 (unsigned _BitInt(271) x, _BitInt(574) y) |
| 43 |
{ |
| 44 |
if (y >= 139845735984wb || y <= -139845735984wb) |
| 45 |
__builtin_unreachable (); |
| 46 |
return x * (unsigned _BitInt(271)) y; |
| 47 |
} |
| 48 |
#endif |
| 49 |
|
| 50 |
int |
| 51 |
main () |
| 52 |
{ |
| 53 |
#if __BITINT_MAXWIDTH__ >= 251 |
| 54 |
static _BitInt(251) s251[] = { |
| 55 |
14492268074422240072381201900068160215333038638908804267546082474872103453wb, |
| 56 |
675218251468166080020913826378654880460963853057558284085495091870180550wb, |
| 57 |
-675218251468166080020959605725458087975245668339558473870927889256690061wb, |
| 58 |
-139845735981wb, |
| 59 |
324639141258847384727959753569292057577687203071371684930924253wb, |
| 60 |
1087290800830wb |
| 61 |
}; |
| 62 |
_BitInt(251) a251 = foo_251 (s251[0], s251[1], s251[2]); |
| 63 |
if (a251 != 1217350477377202249120031439408588187131962868502518732097281406269161025871wb) |
| 64 |
__builtin_abort (); |
| 65 |
_BitInt(251) b251 = bar_251 (s251[3], s251[4], s251[5]); |
| 66 |
if (b251 != 352977151880095667263614472150365012179801988966714554955131068402918618788wb) |
| 67 |
__builtin_abort (); |
| 68 |
#endif |
| 69 |
#if __BITINT_MAXWIDTH__ >= 574 |
| 70 |
static _BitInt(574) s574 |
| 71 |
= -219356128782553279814913626158411711140801689317931406799100755440262023325014648411412728943485405803043129187408541215111743475318581wb; |
| 72 |
#ifdef __SIZEOF_INT128__ |
| 73 |
_BitInt(574) a574 = foo_574 (s574, 82625523151678902953603407887262843433wb, -1845137725); |
| 74 |
if (a574 != -18124414897185514989959611747585480593042904176332662608326479231051632926435887114574980277665683285141927551496724599123576825185653577703648854819279658769883513402160348wb) |
| 75 |
__builtin_abort (); |
| 76 |
#endif |
| 77 |
static unsigned _BitInt(574) u574[] = { |
| 78 |
52437079816179410811636905891411754807147405868482583243559735153324503490239312503359712796401481190029201386135205713917847314204739635852931994918423899615130723009259686uwb, |
| 79 |
45269866460552189474732773540973151549203847819115194862112414296072167098695417407106646749337072175534165739911745591080506448641600205866240027517670273657001894552180234uwb, |
| 80 |
9180917912712609437909586196568830786346456714119640856730259437790973527459849487895103863584234525859590698749982125884487194000401583172193548884761272331911564480124878uwb, |
| 81 |
11049512233686559553687636036663446413022165259892524030717648180326957779916930880483808447448446584642734113622685260963900225478745988370450191005955141795745690734947571uwb, |
| 82 |
47663369272354253242910978827267365842851495123515313737663958515768452802250710665542640440990559573730917816406856556730100799652539291367902764980370386873495017607993411uwb, |
| 83 |
18215014622276393791745550421148998901660352490811211087424965165803902184090598141881549641537877241526565777992183348471991467868259791203907545956986039786453071578011434uwb, |
| 84 |
31740235950157332221439070489628722839769958133906789091713734411951000853909663917518016071789015372380206595539133512032995220911059581277451361109633464034310397164665564uwb, |
| 85 |
10450847162543795294901585004050399762545006892613453868263703161802323302908254646557151245191494710406620278412346326386062698341158038281632905480774145352377805385543092uwb, |
| 86 |
19453023158842453405396915599369210861261573519874550548893523502986640805175433191781338575797970717670733269190857402493766307964168520080852675173587364248259309552168430uwb, |
| 87 |
41244368675818170615108799247368989151384052534670384186902588532722396202878099538345240688084993610469542913084982675850069064350042690913662957238816036434888665664037846uwb, |
| 88 |
16719362016737006280008309688585219733130381598157287999202010698266470616548718462522730730476541950851348747767571521700255425942578137654761356039235313588531776459325708uwb, |
| 89 |
10475917472649802727102296550431840421435279490948846996006476240420369031587862359912739671064811272746210509826242404174149288385636488194271969135287801110662285317095981uwb, |
| 90 |
1163912911803352668493394805506325912661919234067386269274323760640925113542354050648690202267829712352143945896104268132186183304256748687336699391633352420957751382619669uwb, |
| 91 |
8802741787945718202007440863180520530918335416409181790035566968168103145420485853909047361251267032896173190843315221928932703515727560628431319297083973682964053958087246uwb, |
| 92 |
19791342948421817380238010195638893503615644292584928829415951859564239969766035100704913746176442012398341262166756998845831007892328794072245007765812537811265165604315700uwb, |
| 93 |
16642284329136906697237309134287786314682533828330755403465475806950133035971596597211127434533311710048393623437103786994963036388804007132262710130242198695003152238215628uwb, |
| 94 |
2155325970411161010229823956524370uwb, |
| 95 |
697446886254974788952071928578631979965uwb, |
| 96 |
108165657554251490446057511316485495uwb, |
| 97 |
9487120152929104576906851118100261958096487535uwb, |
| 98 |
-136538663022088871346045694473572wb, |
| 99 |
-1666960912074801530926062313122413146603wb, |
| 100 |
-15940673946961553912565090695396320wb, |
| 101 |
264462353975419400604468749561884442664wb, |
| 102 |
50826882861731683785919742135963976479884717145067744452535625618737864973658554226615085532399945662542810296565555980855512176679463978891752486331179893311834461777517318uwb, |
| 103 |
16170033701813896205634802741964500343094214191596485883117074926829904835328260995277267910766680743976283458668064421272599104442706448899915189301332650772687724575723182uwb, |
| 104 |
13009027737564179578240898152688856367334005472217232817755080920783012286505432066490161649175068937710374621121911926344239719476459487715714492624089105621335225676985872uwb, |
| 105 |
49336707246523391872334763713437428863232354140618977476842520346079224652928216135156362963444355821534349959448992339768542254081420292190058456423815350822979116396882390uwb, |
| 106 |
1026180591140992942712368030740883182331172637458255292975945323684907793150051875uwb, |
| 107 |
61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761243411314314780717702156716099193191615778530561481120811604064555385654220uwb, |
| 108 |
3635377841759794164811391623635227990564259993543952474130713407348044048553863186uwb, |
| 109 |
-139845735971wb |
| 110 |
}; |
| 111 |
for (int i = 0; i < 6; ++i) |
| 112 |
if (bar_574 (u574[4 * i], u574[4 * i + 1], u574[4 * i + 2], u574[4 * i + 3]) != u574[i + 24]) |
| 113 |
__builtin_abort (); |
| 114 |
if (baz_574 (u574[30], u574[31]) != 1212103790378493380735221770817318414499452864884443699768488049528961780122040714uwb) |
| 115 |
__builtin_abort (); |
| 116 |
#endif |
| 117 |
} |