diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture')
29 files changed, 1333 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/bitint-77.c b/gcc/testsuite/gcc.dg/torture/bitint-77.c new file mode 100644 index 0000000..3e2523f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-77.c @@ -0,0 +1,26 @@ +/* PR tree-optimization/119722 */ +/* { dg-do run { target bitint } } */ +/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-copy-prop -fno-tree-fre" } */ + +#if __BITINT_MAXWIDTH__ >= 33300 +unsigned _BitInt(33300) g; + +unsigned +foo (long c) +{ + unsigned _BitInt(33300) b + = __builtin_stdc_rotate_left ((unsigned _BitInt(13)) 8, c); + return ((unsigned _BitInt(50)) (g >> 50) + + ({ unsigned _BitInt(300) unused; b; })); +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 33300 + unsigned x = foo (0); + if (x != 8) + __builtin_abort (); +#endif +} diff --git a/gcc/testsuite/gcc.dg/torture/bitint-78.c b/gcc/testsuite/gcc.dg/torture/bitint-78.c new file mode 100644 index 0000000..de092d6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-78.c @@ -0,0 +1,102 @@ +/* { dg-do run { target bitint } } */ +/* { dg-options "-std=c23 -pedantic-errors" } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ + +#if __BITINT_MAXWIDTH__ >= 156 +struct S156 { unsigned _BitInt(156) a : 135; _BitInt(156) b : 2; }; +struct S156 s1 = { 18071796389618321960417503813958783219759uwb, 0 }; +struct S156 s2 = { 18071796389618321960417503813958783219759uwb, -1 }; +struct T156 { _BitInt(156) a : 2; unsigned _BitInt(156) b : 135; _BitInt(156) c : 2; }; +struct T156 s3 = { -1, 10623570996611319062233232245276988766900uwb, -1 }; +struct T156 s4 = { 0, 10623570996611319062233232245276988766900uwb, 0 }; +#endif +#if __BITINT_MAXWIDTH__ >= 230 +struct U230 { _BitInt(230) a : 140, b : 140, c : 168; unsigned _BitInt(230) d : 135; _BitInt(230) e : 2; }; +struct U230 s5 = { -1, -1, -167793869854583920719725244652254633450201662238868wb, -1, -1 }; +struct U230 s6 = { 0, 0, -167793869854583920719725244652254633450201662238868wb, 0, 0 }; +#endif +#if __BITINT_MAXWIDTH__ >= 412 +struct S412 { unsigned _BitInt(412) a : 391; _BitInt(412) b : 2; }; +struct S412 s7 = { 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb, 0 }; +struct S412 s8 = { 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb, -1 }; +struct T412 { _BitInt(412) a : 2; unsigned _BitInt(412) b : 391; _BitInt(412) c : 2; }; +struct T412 s9 = { -1, 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb, -1 }; +struct T412 s10 = { 0, 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb, 0 }; +#endif +#if __BITINT_MAXWIDTH__ >= 486 +struct U486 { _BitInt(486) a : 396, b : 396, c : 424; unsigned _BitInt(486) d : 391; _BitInt(486) e : 2; }; +struct U486 s11 = { -1, -1, -13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb, -1, -1 }; +struct U486 s12 = { 0, 0, 13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb, 0, 0 }; +#endif + +#if __BITINT_MAXWIDTH__ >= 156 +__attribute__((noipa)) _BitInt(156) +f1 (struct S156 *p) +{ + return p->a; +} + +__attribute__((noipa)) _BitInt(156) +f2 (struct T156 *q) +{ + return q->b; +} +#endif + +#if __BITINT_MAXWIDTH__ >= 230 +__attribute__((noipa)) _BitInt(230) +f3 (struct U230 *q) +{ + return q->c; +} +#endif + +#if __BITINT_MAXWIDTH__ >= 412 +__attribute__((noipa)) _BitInt(412) +f4 (struct S412 *p) +{ + return p->a; +} +#endif + +#if __BITINT_MAXWIDTH__ >= 486 +__attribute__((noipa)) _BitInt(412) +f5 (struct T412 *q) +{ + return q->b; +} + +__attribute__((noipa)) _BitInt(486) +f6 (struct U486 *q) +{ + return q->c; +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 156 + if (f1 (&s1) != 18071796389618321960417503813958783219759wb + || f1 (&s2) != 18071796389618321960417503813958783219759wb + || f2 (&s3) != 10623570996611319062233232245276988766900wb + || f2 (&s4) != 10623570996611319062233232245276988766900wb +#if __BITINT_MAXWIDTH__ >= 230 + || f3 (&s5) != -167793869854583920719725244652254633450201662238868wb + || f3 (&s6) != -167793869854583920719725244652254633450201662238868wb +#if __BITINT_MAXWIDTH__ >= 412 + || f4 (&s7) != 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb + || f4 (&s8) != 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb + || f5 (&s9) != 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb + || f5 (&s10) != 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb +#if __BITINT_MAXWIDTH__ >= 486 + || f6 (&s11) != -13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb + || f6 (&s12) != 13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb +#endif +#endif +#endif + || 0) + __builtin_abort (); +#endif +} diff --git a/gcc/testsuite/gcc.dg/torture/bitint-79.c b/gcc/testsuite/gcc.dg/torture/bitint-79.c new file mode 100644 index 0000000..bba686c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-79.c @@ -0,0 +1,191 @@ +/* { dg-do run { target bitint } } */ +/* { dg-options "-std=c23 -pedantic-errors" } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ + +#if __BITINT_MAXWIDTH__ >= 255 +struct S255 { unsigned _BitInt(255) a : 255, b : 255, c : 3, d : 254, e : 255; }; +struct T255 { unsigned _BitInt(255) a : 255, b : 255, c : 4, d : 254, e : 255; }; + +__attribute__((noipa)) void +foo255 (struct S255 *p, unsigned _BitInt(129) x, unsigned _BitInt(129) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +bar255 (struct S255 *p, _BitInt(129) x, _BitInt(129) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +baz255 (struct T255 *p, unsigned _BitInt(129) x, unsigned _BitInt(129) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +qux255 (struct T255 *p, _BitInt(129) x, _BitInt(129) y) +{ + p->d = x + y; +} +#endif + +#if __BITINT_MAXWIDTH__ >= 2047 +struct S2047 { unsigned _BitInt(2047) a : 2047, b : 2047, c : 3, d : 2046, e : 2047; }; +struct T2047 { unsigned _BitInt(2047) a : 2047, b : 2047, c : 4, d : 2046, e : 2047; }; + +__attribute__((noipa)) void +foo2047 (struct S2047 *p, unsigned _BitInt(1025) x, unsigned _BitInt(1025) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +bar2047 (struct S2047 *p, _BitInt(1025) x, _BitInt(1025) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +baz2047 (struct T2047 *p, unsigned _BitInt(1025) x, unsigned _BitInt(1025) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +qux2047 (struct T2047 *p, _BitInt(1025) x, _BitInt(1025) y) +{ + p->d = x + y; +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 255 + static struct S255 a255 = { + 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb, + 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb, + 3uwb, + 17651150055872917163600085508331814696406799705501438675213623161539428467390uwb, + 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb }; + foo255 (&a255, 173345522902299812179061392904021723586uwb, + 594746496877065132561656166247698268802uwb); + if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb + || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb + || a255.c != 3uwb + || a255.d != 87527285937488017813968344288183569476uwb + || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb) + __builtin_abort (); + bar255 (&a255, -295860968706196796751570199618630311203wb, + 250268150248006479289572648514855658614wb); + if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb + || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb + || a255.c != 3uwb + || a255.d != (unsigned _BitInt(254)) -45592818458190317461997551103774652589wb + || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb) + __builtin_abort (); + bar255 (&a255, 295860968706196796751570199618630311203wb, + -250268150248006479289572648514855658614wb); + if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb + || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb + || a255.c != 3uwb + || a255.d != 45592818458190317461997551103774652589uwb + || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb) + __builtin_abort (); + static struct T255 b255 = { + 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb, + 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb, + 6uwb, + 6417359791441959589900236647374232949533098859647531540992238539547709629124uwb, + 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb }; + baz255 (&b255, 173345522902299812179061392904021723586uwb, + 594746496877065132561656166247698268802uwb); + if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb + || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb + || b255.c != 6uwb + || b255.d != 87527285937488017813968344288183569476uwb + || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb) + __builtin_abort (); + qux255 (&b255, -295860968706196796751570199618630311203wb, + 250268150248006479289572648514855658614wb); + if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb + || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb + || b255.c != 6uwb + || b255.d != (unsigned _BitInt(254)) -45592818458190317461997551103774652589wb + || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb) + __builtin_abort (); + qux255 (&b255, 295860968706196796751570199618630311203wb, + -250268150248006479289572648514855658614wb); + if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb + || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb + || b255.c != 6uwb + || b255.d != 45592818458190317461997551103774652589uwb + || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb) + __builtin_abort (); +#endif +#if __BITINT_MAXWIDTH__ >= 2047 + static struct S2047 a2047 = { + 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb, + 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb, + 3uwb, + 6027932121334914635743339798880634252001805340729236895908762444931865425992696360235548021447010270668149256635939999300326200737504862260957633927388112496321971644966176683706157552952742280869614447269028472263989432814406774181406202808062071176855917679050674332601759393282662520975644731312673967504693282468829790640767337337034204803704166900503628236123530078970304726919353159515533927888332084146716799866923553963246718794615364679636847688259516328750007477730553522038211483545111062280575802233656499706325920957127992496464266910119716144273601228015094027167828327389981800000899763861435249388920uwb, + 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb }; + foo2047 (&a2047, 96870374520559877232425023232449835594772020210727763784623672383466424139699010793947506821373137871851733734526750376478351875022731872925672817923968593208680325422683755493846732186980639465537989170494450817375451735480623479375546788222637312722297995519801563871171551494848869504437926131454949049313uwb, + 204286879211705664548598471253516036336450894944461293280538653272096106720692442407887688865006198655779005102679360128685207761954177030702942577918382309453894659175068179209177965184955019555984495374852658981484737374893252503438668707548935382902024863626525041196947938897658146003104268181146061978016uwb); + if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb + || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb + || a2047.c != 3uwb + || a2047.d != 301157253732265541781023494485965871931222915155189057065162325655562530860391453201835195686379336527630738837206110505163559636976908903628615395842350902662574984597751934703024697371935659021522484545347109798860189110373875982814215495771572695624322859146326605068119490392507015507542194312601011027329uwb + || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb) + __builtin_abort (); + bar2047 (&a2047, -107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb, + 96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb); + if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb + || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb + || a2047.c != 3uwb + || a2047.d != (unsigned _BitInt(2046)) -10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199wb + || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb) + __builtin_abort (); + bar2047 (&a2047, 107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb, + -96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb); + if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb + || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb + || a2047.c != 3uwb + || a2047.d != 10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199uwb + || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb) + __builtin_abort (); + static struct T2047 b2047 = { + 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb, + 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb, + 6uwb, + 1798606950844195951030147598716811800015390660201512984851557206864623721164989116948214829831055619900979074616094715381713391051224334567599207518472773713480234276843296532963502302260253812173281125356773927761753111061777042155804806450961801268007533997704354588298664178382846967154936072745865025151298603472616831313827334985310238278265915811572231968955884887803234251471721609470596625338729927904093760632638752495449600773608705401930965052661588038833654673216098348474051355299310614202768960945808114868594476620223714044944623832011798187517371569683635328094981109544466514952661762483375701709483uwb, + 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb }; + baz2047 (&b2047, 96870374520559877232425023232449835594772020210727763784623672383466424139699010793947506821373137871851733734526750376478351875022731872925672817923968593208680325422683755493846732186980639465537989170494450817375451735480623479375546788222637312722297995519801563871171551494848869504437926131454949049313uwb, + 204286879211705664548598471253516036336450894944461293280538653272096106720692442407887688865006198655779005102679360128685207761954177030702942577918382309453894659175068179209177965184955019555984495374852658981484737374893252503438668707548935382902024863626525041196947938897658146003104268181146061978016uwb); + if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb + || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb + || b2047.c != 6uwb + || b2047.d != 301157253732265541781023494485965871931222915155189057065162325655562530860391453201835195686379336527630738837206110505163559636976908903628615395842350902662574984597751934703024697371935659021522484545347109798860189110373875982814215495771572695624322859146326605068119490392507015507542194312601011027329uwb + || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb) + __builtin_abort (); + qux2047 (&b2047, -107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb, + 96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb); + if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb + || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb + || b2047.c != 6uwb + || b2047.d != (unsigned _BitInt(2046)) -10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199wb + || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb) + __builtin_abort (); + qux2047 (&b2047, 107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb, + -96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb); + if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb + || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb + || b2047.c != 6uwb + || b2047.d != 10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199uwb + || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb) + __builtin_abort (); +#endif +} diff --git a/gcc/testsuite/gcc.dg/torture/bitint-80.c b/gcc/testsuite/gcc.dg/torture/bitint-80.c new file mode 100644 index 0000000..283c0e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-80.c @@ -0,0 +1,191 @@ +/* { dg-do run { target bitint } } */ +/* { dg-options "-std=c23 -pedantic-errors" } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ + +#if __BITINT_MAXWIDTH__ >= 255 +struct S255 { unsigned _BitInt(255) a : 255, b : 255, c : 3, d : 235, e : 255; }; +struct T255 { unsigned _BitInt(255) a : 255, b : 255, c : 4, d : 235, e : 255; }; + +__attribute__((noipa)) void +foo255 (struct S255 *p, unsigned _BitInt(129) x, unsigned _BitInt(129) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +bar255 (struct S255 *p, _BitInt(129) x, _BitInt(129) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +baz255 (struct T255 *p, unsigned _BitInt(129) x, unsigned _BitInt(129) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +qux255 (struct T255 *p, _BitInt(129) x, _BitInt(129) y) +{ + p->d = x + y; +} +#endif + +#if __BITINT_MAXWIDTH__ >= 2047 +struct S2047 { unsigned _BitInt(2047) a : 2047, b : 2047, c : 3, d : 2027, e : 2047; }; +struct T2047 { unsigned _BitInt(2047) a : 2047, b : 2047, c : 4, d : 2027, e : 2047; }; + +__attribute__((noipa)) void +foo2047 (struct S2047 *p, unsigned _BitInt(1025) x, unsigned _BitInt(1025) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +bar2047 (struct S2047 *p, _BitInt(1025) x, _BitInt(1025) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +baz2047 (struct T2047 *p, unsigned _BitInt(1025) x, unsigned _BitInt(1025) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +qux2047 (struct T2047 *p, _BitInt(1025) x, _BitInt(1025) y) +{ + p->d = x + y; +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 255 + static struct S255 a255 = { + 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb, + 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb, + 3uwb, + 34443349379822557022031657812343704881254613790161917350775948942333289uwb, + 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb }; + foo255 (&a255, 173345522902299812179061392904021723586uwb, + 594746496877065132561656166247698268802uwb); + if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb + || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb + || a255.c != 3uwb + || a255.d != 87527285937488017813968344288183569476uwb + || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb) + __builtin_abort (); + bar255 (&a255, -295860968706196796751570199618630311203wb, + 250268150248006479289572648514855658614wb); + if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb + || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb + || a255.c != 3uwb + || a255.d != (unsigned _BitInt(235)) -45592818458190317461997551103774652589wb + || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb) + __builtin_abort (); + bar255 (&a255, 295860968706196796751570199618630311203wb, + -250268150248006479289572648514855658614wb); + if (a255.a != 53186120754797186577260219566323862446223402596797491351049671033889795175625uwb + || a255.b != 11016010833798237411188512410350787877773522870186169967060431559664794296995uwb + || a255.c != 3uwb + || a255.d != 45592818458190317461997551103774652589uwb + || a255.e != 46115238973717368082068120592131885017219615546561407012172308861631873123384uwb) + __builtin_abort (); + static struct T255 b255 = { + 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb, + 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb, + 6uwb, + 43803954908428856867451333914918080831779977386765104822182973124878391uwb, + 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb }; + baz255 (&b255, 173345522902299812179061392904021723586uwb, + 594746496877065132561656166247698268802uwb); + if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb + || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb + || b255.c != 6uwb + || b255.d != 87527285937488017813968344288183569476uwb + || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb) + __builtin_abort (); + qux255 (&b255, -295860968706196796751570199618630311203wb, + 250268150248006479289572648514855658614wb); + if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb + || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb + || b255.c != 6uwb + || b255.d != (unsigned _BitInt(235)) -45592818458190317461997551103774652589wb + || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb) + __builtin_abort (); + qux255 (&b255, 295860968706196796751570199618630311203wb, + -250268150248006479289572648514855658614wb); + if (b255.a != 22432197631110620165030705848624667816774533044127974798775792394287682890132uwb + || b255.b != 10434238915154367848470352793005517845706642883922785811579699218726683347492uwb + || b255.c != 6uwb + || b255.d != 45592818458190317461997551103774652589uwb + || b255.e != 54440198277989626545578993065515754280754976615499904095101607562511754302923uwb) + __builtin_abort (); +#endif +#if __BITINT_MAXWIDTH__ >= 2047 + static struct S2047 a2047 = { + 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb, + 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb, + 3uwb, + 12047384745489858064414933953772839663477391272220883177150545757891750042677302445853708145531378904722301054376282458120945425051863649661639155209306286061040930046981057924193785105670446755260062214289266936409272622894864999608677838455560347293246296031941665889508903566959506861861990700494312980351508620223759760110137977058814130413350438372974774697932180418893315998700082240773617767158952812989924561352269321428579880535410771704240937834451503845844374401535603729059202374734334220483209556455967311418585395828630127849722973959209786392861438763563084218683015947661969541113478500403696370uwb, + 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb }; + foo2047 (&a2047, 96870374520559877232425023232449835594772020210727763784623672383466424139699010793947506821373137871851733734526750376478351875022731872925672817923968593208680325422683755493846732186980639465537989170494450817375451735480623479375546788222637312722297995519801563871171551494848869504437926131454949049313uwb, + 204286879211705664548598471253516036336450894944461293280538653272096106720692442407887688865006198655779005102679360128685207761954177030702942577918382309453894659175068179209177965184955019555984495374852658981484737374893252503438668707548935382902024863626525041196947938897658146003104268181146061978016uwb); + if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb + || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb + || a2047.c != 3uwb + || a2047.d != 301157253732265541781023494485965871931222915155189057065162325655562530860391453201835195686379336527630738837206110505163559636976908903628615395842350902662574984597751934703024697371935659021522484545347109798860189110373875982814215495771572695624322859146326605068119490392507015507542194312601011027329uwb + || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb) + __builtin_abort (); + bar2047 (&a2047, -107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb, + 96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb); + if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb + || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb + || a2047.c != 3uwb + || a2047.d != (unsigned _BitInt(2027)) -10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199wb + || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb) + __builtin_abort (); + bar2047 (&a2047, 107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb, + -96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb); + if (a2047.a != 6604638284533196604244471973541013618281533226364189685792053875666894057803336566484436573497392167130748586543934163550741401484647771763676964459636106203955755250170376364799937601505200975989859891863753738684249106942944581800126298385951473900411874226237184667785129620838843419470788411304260887793015638605531226504875060604515688332205834200447655374389292019856450089734989539345196623908433705347894829346923489476140677375811732806834772686417478318575505181306534740760690417577911023605293314367340174835343740361087598377394743326663660990223372181490299731215729287633035024377246940630447830332400uwb + || a2047.b != 9137501476482024007629903428591441562584201678803339450640010852682968378249451929368153750949595739310161107210507212794786347440833584007494934546214718055568442143768955715008628409876512331822501562467361613930394370954908550544883438576618916222169914979225020080371038560790263823334259485417483979863747127011670904476684110186667537336894469993151951433629276229957132898606324321221679211292427020775709202822704838337025228478551871438202955358400266599772607383213562964473056897194903298404105599382719634865500654814014675018495924284439422068568299533611891298495087865671200109507464285856856659661117uwb + || a2047.c != 3uwb + || a2047.d != 10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199uwb + || a2047.e != 8804033128404257319436391796247922558656097909723817946206424086107376571363985431643405988715302457119922790818911593984275867659318063980148880188381721682101222175837894550825446110314568257002910318459491664340963523476389547801300395551742633087402381375954250806472095890015415996293082500961651310239841690830469614433038572525199550599988220404857171911882800074918573055686438920724369407729906538787728042731530804134671860407095239208695638067647644314590947763517887856674430537735913123875082727985637440472517467667915231517115684103964725547766722895041192409825339825853271319679650626338206521967332uwb) + __builtin_abort (); + static struct T2047 b2047 = { + 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb, + 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb, + 6uwb, + 4790880321170629055903750609772895026632672846986739280016249738812459613115379765419988023638270768078558232945132784525166570715169427772424711358221632774714634926039540434297354515015370752168718157581893336796591613729772599089792047050683360727021739900497232167845699737421642365115219385074831571286354899965772412143441270198896667545966629183706673530731718536536465082401940906390967469028437946614351467520839911469740329315914999526738976943417735745760153747243156855057165807147066483580752278526914784843144575299178410593465362653960651398775135718996282702371931556709069927057814215337263088uwb, + 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb }; + baz2047 (&b2047, 96870374520559877232425023232449835594772020210727763784623672383466424139699010793947506821373137871851733734526750376478351875022731872925672817923968593208680325422683755493846732186980639465537989170494450817375451735480623479375546788222637312722297995519801563871171551494848869504437926131454949049313uwb, + 204286879211705664548598471253516036336450894944461293280538653272096106720692442407887688865006198655779005102679360128685207761954177030702942577918382309453894659175068179209177965184955019555984495374852658981484737374893252503438668707548935382902024863626525041196947938897658146003104268181146061978016uwb); + if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb + || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb + || b2047.c != 6uwb + || b2047.d != 301157253732265541781023494485965871931222915155189057065162325655562530860391453201835195686379336527630738837206110505163559636976908903628615395842350902662574984597751934703024697371935659021522484545347109798860189110373875982814215495771572695624322859146326605068119490392507015507542194312601011027329uwb + || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb) + __builtin_abort (); + qux2047 (&b2047, -107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb, + 96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb); + if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb + || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb + || b2047.c != 6uwb + || b2047.d != (unsigned _BitInt(2027)) -10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199wb + || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb) + __builtin_abort (); + qux2047 (&b2047, 107041399279853750538644610804872546664073777262361485051257422505445403341239911024662125357507942225958473152601813095133468813115195351301813567477804225231126164403591882793618380878832817133932293901187006756344358795625819716260192657246036383263988109408466592090784140040462306716053681955947029302372wb, + -96987190807622698460264889519367881890066987668370388919983053615401815945974432823964979317479611113155186555311657934933783458381323251774060867490977621487683905191843744141366245874982592954856173370276396645258076888821241836201856003528789429151224936212560775299953235914854472460555840121467482998173wb); + if (b2047.a != 8996238020280292957328835089241644192878840856627816196416318709508683098169814577226365258620493076815319486990268281142171221215928011006756119353814278158963533314155524133150379539663994828642659406032292079638106530616220996959709130065598293192861447528701351308436811527532025724876557041408124206634994855959829536357239366288943458437338903780905785942866502425145885283981390432237293769793723111403979497735186231144097215953553454988205125026498825957157417441121856068152040712774023846606695947287461796712589836037950807125680967643300197810011211640702778647554744354944603685620923084456614104269511uwb + || b2047.b != 10984318785160035171394274834520714981439611497142275792263219471171187866412794220589679181825290825434476603425001179842844662351028314167468349845879235198018132318905212119916242949709604719322253068999148260324480265586748667860001776565543787645340459243545680867668449541033392329858909661211654102449948990901244396803735089889644860800279108718607804327932252678544915255476214419499336896882183024344391755469834019036074623457176720435331996267496468629393048786381035430672504168120874305682383085268282415424323567923620247616970537420522283962923432940154412293415792945236923677598283314889480184388928uwb + || b2047.c != 6uwb + || b2047.d != 10054208472231052078379721285504664774006789593991096131274368890043587395265478200697146040028331112803286597290155160199685354733872099527752699986826603743442259211748138652252135003850224179076120530910610111086281906804577880058336653717246954112763173195905816790830904125607834255497841834479546304199uwb + || b2047.e != 15898795864009764874305090919753114555137700112966361953790245810709040722233816733280023885873997896242958848192251646902459137691931517631544750216012143606605819071183153530372060489236262856491973841038138316548406269164589694469032205076355057742341341656583075897561909452907012289408703280249378682882696627977625379823499910638320190471165330121795134411615134572598658797215197404325870770080826927165671269527854053737471231889250113654062195345706056764060545970124448748001325886598996898661788527149728584429285239380904550684885882592015572632423663763016881296460620776131666328013362700459054902525252uwb) + __builtin_abort (); +#endif +} diff --git a/gcc/testsuite/gcc.dg/torture/bitint-81.c b/gcc/testsuite/gcc.dg/torture/bitint-81.c new file mode 100644 index 0000000..9e7fa53 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-81.c @@ -0,0 +1,174 @@ +/* { dg-do run { target bitint } } */ +/* { dg-options "-std=c23 -pedantic-errors" } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ + +#if __BITINT_MAXWIDTH__ >= 2048 +struct S { unsigned _BitInt(2048) a : 2048, b : 2048, c : 17, d : 1984, e : 47; }; + +__attribute__((noipa)) void +foo (struct S *p, unsigned _BitInt(1024) x, unsigned _BitInt(1024) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +bar (struct S *p, _BitInt(1024) x, _BitInt(1024) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +baz (struct S *p, unsigned _BitInt(1920) x, unsigned _BitInt(1920) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +qux (struct S *p, _BitInt(1920) x, _BitInt(1920) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +corge (struct S *p, unsigned _BitInt(1900) x, unsigned _BitInt(1900) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +garply (struct S *p, _BitInt(1900) x, _BitInt(1900) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +freddy (struct S *p, unsigned _BitInt(1856) x, unsigned _BitInt(1856) y) +{ + p->d = x + y; +} + +__attribute__((noipa)) void +waldo (struct S *p, _BitInt(1856) x, _BitInt(1856) y) +{ + p->d = x + y; +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 2048 + static struct S a = { + -1, -1, 0, + 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb, + 0 }; + a.c = -1; a.e = -1; + foo (&a, 104931473307998568376284944455816272419276290777426540227909077072607565781305910683656824567560123753706639375583615231475830225655977968417978331508801616912246729932071770026909197561252489929164753507156163716727743848177523298403504040861948797263925263359073704810875557925737265337616304489108966376158uwb, + 59920243355458337710161417863366293718453205838526168844643867766614610356796955200643446741760592218738700475637131838188996966576023003439875232851999584726009865342375796439481941924864368246882381830388251975603959739534065212652254710711469239923127731536814696621712112440700123429434845131596418309393uwb); + if (a.c != (unsigned _BitInt(17)) -1 + || a.d != (unsigned _BitInt(1024)) (104931473307998568376284944455816272419276290777426540227909077072607565781305910683656824567560123753706639375583615231475830225655977968417978331508801616912246729932071770026909197561252489929164753507156163716727743848177523298403504040861948797263925263359073704810875557925737265337616304489108966376158uwb + + 59920243355458337710161417863366293718453205838526168844643867766614610356796955200643446741760592218738700475637131838188996966576023003439875232851999584726009865342375796439481941924864368246882381830388251975603959739534065212652254710711469239923127731536814696621712112440700123429434845131596418309393uwb) + || a.e != (unsigned _BitInt(47)) -1) + __builtin_abort (); + a.c = 0; a.e = 0; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + bar (&a, 57696900052508731507403549405758598034300143658103207319023779669222605350088754701899236130746881446668609696540074847952256437939432895408791375123523927312623997545422223335393957708478037810305856074599089747771505132758755976367296302409566647338223622914274236998855494169815473992397952258483243021302wb, + -72842517138334828284807942772540307802590837121353434029836391595120471219334627505967145432766876195584374614127318095866715782180696170716375533225237916165551049842450106822314457638403968810895466326295894575989547864175819099455892706907142084137837126096115084189997686278911334555694779991889737914097wb); + if (a.c != 0 + || a.d != (unsigned _BitInt(1984)) (57696900052508731507403549405758598034300143658103207319023779669222605350088754701899236130746881446668609696540074847952256437939432895408791375123523927312623997545422223335393957708478037810305856074599089747771505132758755976367296302409566647338223622914274236998855494169815473992397952258483243021302wb + - 72842517138334828284807942772540307802590837121353434029836391595120471219334627505967145432766876195584374614127318095866715782180696170716375533225237916165551049842450106822314457638403968810895466326295894575989547864175819099455892706907142084137837126096115084189997686278911334555694779991889737914097wb) + || a.e != 0) + __builtin_abort (); + a.c = -1; a.e = -1; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + bar (&a, -57696900052508731507403549405758598034300143658103207319023779669222605350088754701899236130746881446668609696540074847952256437939432895408791375123523927312623997545422223335393957708478037810305856074599089747771505132758755976367296302409566647338223622914274236998855494169815473992397952258483243021302wb, + 72842517138334828284807942772540307802590837121353434029836391595120471219334627505967145432766876195584374614127318095866715782180696170716375533225237916165551049842450106822314457638403968810895466326295894575989547864175819099455892706907142084137837126096115084189997686278911334555694779991889737914097wb); + if (a.c != (unsigned _BitInt(17)) -1 + || a.d != (unsigned _BitInt(1984)) (-57696900052508731507403549405758598034300143658103207319023779669222605350088754701899236130746881446668609696540074847952256437939432895408791375123523927312623997545422223335393957708478037810305856074599089747771505132758755976367296302409566647338223622914274236998855494169815473992397952258483243021302wb + + 72842517138334828284807942772540307802590837121353434029836391595120471219334627505967145432766876195584374614127318095866715782180696170716375533225237916165551049842450106822314457638403968810895466326295894575989547864175819099455892706907142084137837126096115084189997686278911334555694779991889737914097wb) + || a.e != (unsigned _BitInt(47)) -1) + __builtin_abort (); + a.c = -1; a.e = -1; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + baz (&a, 10046674427769604624104256297198144686571499244626667928387309298929376098027029576279399593953275611749179759608292175423884771453122373428446900092238297028886595955833507301142748242755116804512085361142982476735378897659094772516348752033708523603210976749488948779512595019051543682808058468854071972247830133684340816736701518783450117953852153823310129790997309466493287853621568286299778852505115809372004493209067461371542082762075506285274124778581566591915544298148128752861519967454244034597718098760883258950102015993032472578845214796865351706334956028690073732824uwb, + 30612973315144170166058778463435127763223804285434461900113576569307167284342964585999954156672087142162949891238018140546663093988389394093653346239026903138243323723125156926788354976614671206441524235029939884520999076249737807760807371468017378301855151655697275608111727393644387426955142126548487675753916845926686394733479586127697929204917657250622879488360082650822591661695896650131839942739510727482535722456341390110272939230980001298487239399637003898555616301235680415285050104075063794523896618439667653475267312346144285918918555551560640876816454019806981149346uwb); + if (a.c != (unsigned _BitInt(17)) -1 + || a.d != (unsigned _BitInt(1920)) (10046674427769604624104256297198144686571499244626667928387309298929376098027029576279399593953275611749179759608292175423884771453122373428446900092238297028886595955833507301142748242755116804512085361142982476735378897659094772516348752033708523603210976749488948779512595019051543682808058468854071972247830133684340816736701518783450117953852153823310129790997309466493287853621568286299778852505115809372004493209067461371542082762075506285274124778581566591915544298148128752861519967454244034597718098760883258950102015993032472578845214796865351706334956028690073732824uwb + + 30612973315144170166058778463435127763223804285434461900113576569307167284342964585999954156672087142162949891238018140546663093988389394093653346239026903138243323723125156926788354976614671206441524235029939884520999076249737807760807371468017378301855151655697275608111727393644387426955142126548487675753916845926686394733479586127697929204917657250622879488360082650822591661695896650131839942739510727482535722456341390110272939230980001298487239399637003898555616301235680415285050104075063794523896618439667653475267312346144285918918555551560640876816454019806981149346uwb) + || a.e != (unsigned _BitInt(47)) -1) + __builtin_abort (); + a.c = 0; a.e = 0; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + qux (&a, 13016013079173103291099614189980806323842381205278317530930273134000041840366629398775140035115843810473709567772778302693082141789947769432915075175055773162235275161483274294215337459035077170772792870300959580270341613989326562524225424508425190735941052267862958598262374659588227320019762607908610630268016655402141784434304726674259917365365145444188910006023308330624708207712990521956652004155313903306577312390098183139445953080974727140041686581923442658014291404592915933601121276930660194063673671653456001711834226809501680465040298012239797363611423758621282776913wb, + -28446813692377976500941113458061042520266991028095510595278491516213231833343127954947958697833886839482306777092401391414122947073667300047514166155274861575977000665767593771951017640475352507402509527609607984675986413277164234921816991523476344394719439798762757430434241059844235758595109405173122010749636425151730743690113153472777458440898097338588818905573968955113497483813484624809156428527476374283821364764837699711517717561791530220504756111060769224676146577608338385717008304034083639716040512354106392262091939683382939797913585450175899702396573011461697333034wb); + if (a.c != 0 + || a.d != (unsigned _BitInt(1984)) (13016013079173103291099614189980806323842381205278317530930273134000041840366629398775140035115843810473709567772778302693082141789947769432915075175055773162235275161483274294215337459035077170772792870300959580270341613989326562524225424508425190735941052267862958598262374659588227320019762607908610630268016655402141784434304726674259917365365145444188910006023308330624708207712990521956652004155313903306577312390098183139445953080974727140041686581923442658014291404592915933601121276930660194063673671653456001711834226809501680465040298012239797363611423758621282776913wb + - 28446813692377976500941113458061042520266991028095510595278491516213231833343127954947958697833886839482306777092401391414122947073667300047514166155274861575977000665767593771951017640475352507402509527609607984675986413277164234921816991523476344394719439798762757430434241059844235758595109405173122010749636425151730743690113153472777458440898097338588818905573968955113497483813484624809156428527476374283821364764837699711517717561791530220504756111060769224676146577608338385717008304034083639716040512354106392262091939683382939797913585450175899702396573011461697333034wb) + || a.e != 0) + __builtin_abort (); + a.c = -1; a.e = -1; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + qux (&a, -13016013079173103291099614189980806323842381205278317530930273134000041840366629398775140035115843810473709567772778302693082141789947769432915075175055773162235275161483274294215337459035077170772792870300959580270341613989326562524225424508425190735941052267862958598262374659588227320019762607908610630268016655402141784434304726674259917365365145444188910006023308330624708207712990521956652004155313903306577312390098183139445953080974727140041686581923442658014291404592915933601121276930660194063673671653456001711834226809501680465040298012239797363611423758621282776913wb, + 28446813692377976500941113458061042520266991028095510595278491516213231833343127954947958697833886839482306777092401391414122947073667300047514166155274861575977000665767593771951017640475352507402509527609607984675986413277164234921816991523476344394719439798762757430434241059844235758595109405173122010749636425151730743690113153472777458440898097338588818905573968955113497483813484624809156428527476374283821364764837699711517717561791530220504756111060769224676146577608338385717008304034083639716040512354106392262091939683382939797913585450175899702396573011461697333034wb); + if (a.c != (unsigned _BitInt(17)) -1 + || a.d != (unsigned _BitInt(1984)) (-13016013079173103291099614189980806323842381205278317530930273134000041840366629398775140035115843810473709567772778302693082141789947769432915075175055773162235275161483274294215337459035077170772792870300959580270341613989326562524225424508425190735941052267862958598262374659588227320019762607908610630268016655402141784434304726674259917365365145444188910006023308330624708207712990521956652004155313903306577312390098183139445953080974727140041686581923442658014291404592915933601121276930660194063673671653456001711834226809501680465040298012239797363611423758621282776913wb + + 28446813692377976500941113458061042520266991028095510595278491516213231833343127954947958697833886839482306777092401391414122947073667300047514166155274861575977000665767593771951017640475352507402509527609607984675986413277164234921816991523476344394719439798762757430434241059844235758595109405173122010749636425151730743690113153472777458440898097338588818905573968955113497483813484624809156428527476374283821364764837699711517717561791530220504756111060769224676146577608338385717008304034083639716040512354106392262091939683382939797913585450175899702396573011461697333034wb) + || a.e != (unsigned _BitInt(47)) -1) + __builtin_abort (); + a.c = -1; a.e = -1; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + corge (&a, 64171754625068989919140837000994640111727112880534508544592426680368730902810558177004927067680584241787685314155807083650755609249723856651964519183899537071234738837290542998681042547778311707239561819724556440611184192044964070498288365795284868545819938858772217225078359446215623326392822749370924397592547178151227397770818626413099911326742674650698762654686406157275035696691347162817031065585247142657560604671730554635740625725423122837711895800895711658181231623745755808749163225238686251279789200140461667130974133295022126714627199940806900473151584805415195uwb, + 10507418314822331271773044775475398971761862686484059883353388622395900044257992245406697831431608445492518374055670273513238951235394317339987011165612885709605626614512380143227176716397144020233730021138060515517588833982427087228530305874044854732163307726421040484981309646463788817170356084893284995027973314236302612849097075836350102359164874937708745757469764621885202447442513857862352391464614086255770773793956362777147243363233935961477956934790795000772957425970578395645388729306937175617548119494347932433902865451670299375626936811709188316328877711066266uwb); + if (a.c != (unsigned _BitInt(17)) -1 + || a.d != (unsigned _BitInt(1900)) (64171754625068989919140837000994640111727112880534508544592426680368730902810558177004927067680584241787685314155807083650755609249723856651964519183899537071234738837290542998681042547778311707239561819724556440611184192044964070498288365795284868545819938858772217225078359446215623326392822749370924397592547178151227397770818626413099911326742674650698762654686406157275035696691347162817031065585247142657560604671730554635740625725423122837711895800895711658181231623745755808749163225238686251279789200140461667130974133295022126714627199940806900473151584805415195uwb + + 10507418314822331271773044775475398971761862686484059883353388622395900044257992245406697831431608445492518374055670273513238951235394317339987011165612885709605626614512380143227176716397144020233730021138060515517588833982427087228530305874044854732163307726421040484981309646463788817170356084893284995027973314236302612849097075836350102359164874937708745757469764621885202447442513857862352391464614086255770773793956362777147243363233935961477956934790795000772957425970578395645388729306937175617548119494347932433902865451670299375626936811709188316328877711066266uwb) + || a.e != (unsigned _BitInt(47)) -1) + __builtin_abort (); + a.c = 0; a.e = 0; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + garply (&a, 5868498364266506524577605439874476245426686973426700959109780040518579902459120222835694740563157202759355683256866704897404738166990697509006899291520655587106188792963812978958796524525114633868734394698171505881029257971723149816101834255875674028498733002531852425394712442344661593840806267795078353686464213122490607069539130187483435521707186417019607510065332996787510980236995794693748424754247983911372699143281367405983607540070016093272958998509389591623580441329207441967951990849359776649279644251163115935521494220792988120247084691082546041345346792010242wb, + -11347197387388289958753680375659873990863802565165926783885510745013060725984194141674849668356803935504502347397858539486502925095461636911844100666788607295568532884580882894109301976999229938210427880195738078809053637249087573583682429867587279531387832617988923148433372488547498087660777174110005800619288934623468273334771375199931835359341800380427942391213375221877238129575165007900737487381149085076124736500637930425093008055570334609463897282935446073021835731133748226290709813024590427968994174853094349555317945926316079817123209552512780636562105208387802wb); + if (a.c != 0 + || a.d != (unsigned _BitInt(1984)) (5868498364266506524577605439874476245426686973426700959109780040518579902459120222835694740563157202759355683256866704897404738166990697509006899291520655587106188792963812978958796524525114633868734394698171505881029257971723149816101834255875674028498733002531852425394712442344661593840806267795078353686464213122490607069539130187483435521707186417019607510065332996787510980236995794693748424754247983911372699143281367405983607540070016093272958998509389591623580441329207441967951990849359776649279644251163115935521494220792988120247084691082546041345346792010242wb + - 11347197387388289958753680375659873990863802565165926783885510745013060725984194141674849668356803935504502347397858539486502925095461636911844100666788607295568532884580882894109301976999229938210427880195738078809053637249087573583682429867587279531387832617988923148433372488547498087660777174110005800619288934623468273334771375199931835359341800380427942391213375221877238129575165007900737487381149085076124736500637930425093008055570334609463897282935446073021835731133748226290709813024590427968994174853094349555317945926316079817123209552512780636562105208387802wb) + || a.e != 0) + __builtin_abort (); + a.c = -1; a.e = -1; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + garply (&a, -5868498364266506524577605439874476245426686973426700959109780040518579902459120222835694740563157202759355683256866704897404738166990697509006899291520655587106188792963812978958796524525114633868734394698171505881029257971723149816101834255875674028498733002531852425394712442344661593840806267795078353686464213122490607069539130187483435521707186417019607510065332996787510980236995794693748424754247983911372699143281367405983607540070016093272958998509389591623580441329207441967951990849359776649279644251163115935521494220792988120247084691082546041345346792010242wb, + 11347197387388289958753680375659873990863802565165926783885510745013060725984194141674849668356803935504502347397858539486502925095461636911844100666788607295568532884580882894109301976999229938210427880195738078809053637249087573583682429867587279531387832617988923148433372488547498087660777174110005800619288934623468273334771375199931835359341800380427942391213375221877238129575165007900737487381149085076124736500637930425093008055570334609463897282935446073021835731133748226290709813024590427968994174853094349555317945926316079817123209552512780636562105208387802wb); + if (a.c != (unsigned _BitInt(17)) -1 + || a.d != (unsigned _BitInt(1984)) (-5868498364266506524577605439874476245426686973426700959109780040518579902459120222835694740563157202759355683256866704897404738166990697509006899291520655587106188792963812978958796524525114633868734394698171505881029257971723149816101834255875674028498733002531852425394712442344661593840806267795078353686464213122490607069539130187483435521707186417019607510065332996787510980236995794693748424754247983911372699143281367405983607540070016093272958998509389591623580441329207441967951990849359776649279644251163115935521494220792988120247084691082546041345346792010242wb + + 11347197387388289958753680375659873990863802565165926783885510745013060725984194141674849668356803935504502347397858539486502925095461636911844100666788607295568532884580882894109301976999229938210427880195738078809053637249087573583682429867587279531387832617988923148433372488547498087660777174110005800619288934623468273334771375199931835359341800380427942391213375221877238129575165007900737487381149085076124736500637930425093008055570334609463897282935446073021835731133748226290709813024590427968994174853094349555317945926316079817123209552512780636562105208387802wb) + || a.e != (unsigned _BitInt(47)) -1) + __builtin_abort (); + a.c = -1; a.e = -1; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + freddy (&a, 469252210556625900395321429768118373804271568886989705934619437372829749132450328525095591418777876663202724364753274041797120201435942727547992144282707964490547818365755687730365454828375134854279482853064804665151021915981446605629215712706942096964289300397645214217794960755102650152979365923262599694610536124094997394321315947501858977257060703103733108840085012396782596975471783978125423726167181925777731261440167038194119207611413091278559852866397229440000783332669637577092646062124696818736270717467013532501981408774198349957822434112647379005uwb, + 94070362846521859801705045906377514499678063439381376804210675777018147620560698746550277910632595473262065531986582027530889487288929548537551849350646108895807918918852446632833846575499156686904909401606895792588697611268444788607535104014712049735819470354574164068246431532229132503353457795214808974265484177085433521985873683760061889599206572475727862420333264989214721uwb); + if (a.c != (unsigned _BitInt(17)) -1 + || a.d != (unsigned _BitInt(1856)) (469252210556625900395321429768118373804271568886989705934619437372829749132450328525095591418777876663202724364753274041797120201435942727547992144282707964490547818365755687730365454828375134854279482853064804665151021915981446605629215712706942096964289300397645214217794960755102650152979365923262599694610536124094997394321315947501858977257060703103733108840085012396782596975471783978125423726167181925777731261440167038194119207611413091278559852866397229440000783332669637577092646062124696818736270717467013532501981408774198349957822434112647379005uwb + + 94070362846521859801705045906377514499678063439381376804210675777018147620560698746550277910632595473262065531986582027530889487288929548537551849350646108895807918918852446632833846575499156686904909401606895792588697611268444788607535104014712049735819470354574164068246431532229132503353457795214808974265484177085433521985873683760061889599206572475727862420333264989214721uwb) + || a.e != (unsigned _BitInt(47)) -1) + __builtin_abort (); + a.c = 0; a.e = 0; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + waldo (&a, 1077348803036394846628052386931031477092268876025321812336873307109206087913752615224874421161444982772998789879219858386748806555972198085260006113906211122468615028890545260489793232067037450746579377138953792376873515309768581358563731155642172915978701005830989320122620476563103717896150506580888344726125553209010077521592754225575655834325745455132336873236702283266289571810538207635029653566169955010183651423213982024692540900019767542204779117227674016120820660909981982885062591878726323250427606511922288639386683242905759109753373254316490315520wb, + -1985135610193680083664291948423326826338570203155603158942205167041487273165308445801199835862136626921357451386015509681859914819637185970790210070511326605854081763286684508027882510126294034064385106397322907046379158342618996640895074355907730050734884021065120984859890403437402777612953035357875244537844302334232817294878831239344832373356172440988052876809100011735694217824097948414358681171509506376373643145643902181072431032225879081947415698025494088413669737484685311564937312541325716542256136502054579138572508697290597615704140203423671499131wb); + if (a.c != 0 + || a.d != (unsigned _BitInt(1984)) (1077348803036394846628052386931031477092268876025321812336873307109206087913752615224874421161444982772998789879219858386748806555972198085260006113906211122468615028890545260489793232067037450746579377138953792376873515309768581358563731155642172915978701005830989320122620476563103717896150506580888344726125553209010077521592754225575655834325745455132336873236702283266289571810538207635029653566169955010183651423213982024692540900019767542204779117227674016120820660909981982885062591878726323250427606511922288639386683242905759109753373254316490315520wb + - 1985135610193680083664291948423326826338570203155603158942205167041487273165308445801199835862136626921357451386015509681859914819637185970790210070511326605854081763286684508027882510126294034064385106397322907046379158342618996640895074355907730050734884021065120984859890403437402777612953035357875244537844302334232817294878831239344832373356172440988052876809100011735694217824097948414358681171509506376373643145643902181072431032225879081947415698025494088413669737484685311564937312541325716542256136502054579138572508697290597615704140203423671499131wb) + || a.e != 0) + __builtin_abort (); + a.c = -1; a.e = -1; + a.d = 463917970028583783130221282302564969130016367896792751313667391101541961539304534496983866855440713410002431069759936351630526612549721249569957606098639059197777177066032356317311377246348044640151413769734055367388430457406812743413172658955449268511488689032363320539418931719008983635641503449973939023326362877468919468283037515857633928783609142892025498615118950347461620276675520332352617645525539262850089419854851129987768363578088495582892780293031963532530279743528517338149433293940566560543044220727331056862486476880117725416278405160480429664896200335164399009026428547582688918275uwb; + waldo (&a, -1077348803036394846628052386931031477092268876025321812336873307109206087913752615224874421161444982772998789879219858386748806555972198085260006113906211122468615028890545260489793232067037450746579377138953792376873515309768581358563731155642172915978701005830989320122620476563103717896150506580888344726125553209010077521592754225575655834325745455132336873236702283266289571810538207635029653566169955010183651423213982024692540900019767542204779117227674016120820660909981982885062591878726323250427606511922288639386683242905759109753373254316490315520wb, + 1985135610193680083664291948423326826338570203155603158942205167041487273165308445801199835862136626921357451386015509681859914819637185970790210070511326605854081763286684508027882510126294034064385106397322907046379158342618996640895074355907730050734884021065120984859890403437402777612953035357875244537844302334232817294878831239344832373356172440988052876809100011735694217824097948414358681171509506376373643145643902181072431032225879081947415698025494088413669737484685311564937312541325716542256136502054579138572508697290597615704140203423671499131wb); + if (a.c != (unsigned _BitInt(17)) -1 + || a.d != (unsigned _BitInt(1984)) (-1077348803036394846628052386931031477092268876025321812336873307109206087913752615224874421161444982772998789879219858386748806555972198085260006113906211122468615028890545260489793232067037450746579377138953792376873515309768581358563731155642172915978701005830989320122620476563103717896150506580888344726125553209010077521592754225575655834325745455132336873236702283266289571810538207635029653566169955010183651423213982024692540900019767542204779117227674016120820660909981982885062591878726323250427606511922288639386683242905759109753373254316490315520wb + + 1985135610193680083664291948423326826338570203155603158942205167041487273165308445801199835862136626921357451386015509681859914819637185970790210070511326605854081763286684508027882510126294034064385106397322907046379158342618996640895074355907730050734884021065120984859890403437402777612953035357875244537844302334232817294878831239344832373356172440988052876809100011735694217824097948414358681171509506376373643145643902181072431032225879081947415698025494088413669737484685311564937312541325716542256136502054579138572508697290597615704140203423671499131wb) + || a.e != (unsigned _BitInt(47)) -1) + __builtin_abort (); +#endif +} diff --git a/gcc/testsuite/gcc.dg/torture/bitint-82.c b/gcc/testsuite/gcc.dg/torture/bitint-82.c new file mode 100644 index 0000000..851d57a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-82.c @@ -0,0 +1,94 @@ +/* { dg-do run { target bitint } } */ +/* { dg-options "-std=c23 -pedantic-errors" } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ + +#if __BITINT_MAXWIDTH__ >= 532 +_BitInt(5) a = 2, b = -2; +_BitInt(38) c = 12345, d = -12345; +_BitInt(129) e = 147090211948845388976606115811401318743wb, f = -147090211948845388976606115811401318743wb; +_BitInt(532) g = 34476769918317100226195145251004381172591594205376273814wb, h = -102116935649428556311918486808926113041433456371844211259677321wb; +unsigned _BitInt(1) i = 1; +unsigned _BitInt(17) j = 49127uwb; +unsigned _BitInt(60) k = 588141367522129848uwb; +unsigned _BitInt(205) l = 33991671979236490040668305838261113909013362173682935296620088uwb; +unsigned _BitInt(475) z = 14834685124553929878903720794923785539321715423294864257448721201977655202426343038777008759878862591302200019811097993772912691139803983786083uwb; +#endif + +#include "../bitintext.h" + +#if __BITINT_MAXWIDTH__ >= 532 +[[gnu::noipa]] _BitInt(217) +f1 (_BitInt(9) a, unsigned _BitInt(12) b, _BitInt(36) c, unsigned _BitInt(105) d, + _BitInt(135) e, unsigned _BitInt(168) f, _BitInt(207) g, _BitInt(207) h, + unsigned _BitInt(531) i, _BitInt(36) j) +{ + BEXTC (a); BEXTC (b); BEXTC (c); BEXTC (d); + BEXTC (e); BEXTC (f); BEXTC (g); BEXTC (h); + BEXTC (i); BEXTC (j); + _BitInt(9) k = a + 1; + unsigned _BitInt(12) l = b - a; + _BitInt(36) m = c * j; + unsigned _BitInt(105) n = d >> (-2 * j); + _BitInt(135) o = e | -j; + unsigned _BitInt(168) p = f & 101010101010101010101010uwb; + _BitInt(207) q = g * j; + _BitInt(207) r = g + h; + unsigned _BitInt(531) s = i / j; + BEXTC (k); BEXTC (l); BEXTC (m); BEXTC (n); + BEXTC (o); BEXTC (p); BEXTC (q); BEXTC (r); + BEXTC (s); + unsigned _BitInt(105) t = d << (38 - j); + BEXTC (t); + _Atomic _BitInt(5) u = 15; + u += 8U; + BEXTC (u); + _BitInt(135) v = e << 28; + BEXTC (v); + unsigned _BitInt(475) w = z << (29 + j); + BEXTC (w); + return a + 4; +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 532 + BEXTC (a); BEXTC (b); + BEXTC (c); BEXTC (d); + BEXTC (e); BEXTC (f); + BEXTC (g); BEXTC (h); + BEXTC (i); + BEXTC (j); + BEXTC (k); + BEXTC (l); + BEXTC (z); + { + _BitInt(5) a = 2, b = -2; + _BitInt(38) c = 12345, d = -12345; + _BitInt(129) e = 147090211948845388976606115811401318743wb, f = -147090211948845388976606115811401318743wb; + _BitInt(532) g = 34476769918317100226195145251004381172591594205376273814wb, h = -102116935649428556311918486808926113041433456371844211259677321wb; + unsigned _BitInt(1) i = 1; + unsigned _BitInt(17) j = 49127uwb; + unsigned _BitInt(60) k = 588141367522129848uwb; + unsigned _BitInt(205) l = 33991671979236490040668305838261113909013362173682935296620088uwb; + BEXTC (a); BEXTC (b); + BEXTC (c); BEXTC (d); + BEXTC (e); BEXTC (f); + BEXTC (g); BEXTC (h); + BEXTC (i); + BEXTC (j); + BEXTC (k); + BEXTC (l); + } + _BitInt(217) m = f1 (57wb, 3927uwb, 10625699364wb, 23030359755638571619326514462579uwb, + 20797625176303404170317957140841712396356wb, + 111831871006433449872067089878311637796827405335256uwb, + 64853652491049541618437564623858346454131583900201311683495230wb, + 25108562626494976011700565632680191924545340440636663075662700wb, + 6366583146545926097709747296452085257498446783797668089081516596003270602920229800152065594152964557479773813310423759077951305431130758723519892452009351743676uwb, + -1); + BEXTC (m); +#endif +} diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-9.c b/gcc/testsuite/gcc.dg/torture/builtin-math-9.c new file mode 100644 index 0000000..ff79ee5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/builtin-math-9.c @@ -0,0 +1,86 @@ +/* Copyright (C) 1988-2025 Free Software Foundation, Inc. + + Verify that built-in math function constant folding of constant + arguments is correctly performed by the compiler. */ + +/* { dg-do link } */ +/* { dg-require-effective-target foldable_pi_based_trigonometry } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ + +extern double acospi (double); +extern double asinpi (double); +extern double atanpi (double); +extern double atan2pi (double, double); +extern double cospi (double); +extern double sinpi (double); +extern double tanpi (double); + +/* All references to link_error should go away at compile-time. */ +extern void link_error (void); + +void +test_normal () +{ + if (acospi (0.5) < 0.3333 || acospi (0.5) > 0.3334 || acospi (-0.5) < 0.6666 + || acospi (-0.5) > 0.6667) + link_error (); + + if (asinpi (0.5) < 0.1666 || asinpi (0.5) > 0.1667 || asinpi (-0.5) < -0.1667 + || asinpi (-0.5) > -0.1666) + link_error (); + + if (atanpi (1.0) != 0.25 || atanpi (-1.0) > -0.25) + link_error (); + + if (atan2pi (1.0, 1.0) > 0.2501 || atan2pi (1.0, 1.0) < 0.2499 + || atan2pi (1.0, -1.0) < 0.7499 || atan2pi (1.0, -1.0) > 0.7501) + link_error (); + + if (cospi (1.0 / 3) > 0.5001 || cospi (-1.0 / 3) < 0.4999 + || cospi (4.0 / 3) > -0.4999 || cospi (4.0 / 3) < -0.5001) + link_error (); + + if (sinpi (1.0 / 6) > 0.5001 || sinpi (-1.0 / 6) > -0.4999 + || sinpi (5.0 / 6) < 0.4999 || sinpi (-7.0 / 6) > 0.5001) + link_error (); + + if (tanpi (0.25) != 1.0000 || tanpi (-0.25) != -1.0000 + || tanpi (1.25) != 1.0000 || tanpi (-1.25) != -1.0000) + link_error (); +} + +void +test_corner () +{ + if (__builtin_signbit (acospi (1.0))) + link_error (); + + if (__builtin_signbit (asinpi (0.0)) || !__builtin_signbit (asinpi (-0.0))) + link_error (); + + if (__builtin_signbit (atanpi (0.0)) || !__builtin_signbit (atanpi (-0.0))) + link_error (); + + if (__builtin_signbit (atan2pi (0.0, 0.0)) + || !__builtin_signbit (atan2pi (-0.0, 0.0)) || atan2pi (0.0, -0.0) != 1 + || atan2pi (-0.0, -0.0) != -1) + link_error (); + + if (__builtin_signbit (cospi (0.5)) || __builtin_signbit (cospi (-0.5))) + link_error (); + + if (__builtin_signbit (sinpi (1)) || !__builtin_signbit (sinpi (-1))) + link_error (); + + if (__builtin_signbit (tanpi (2)) || __builtin_signbit (tanpi (-3)) + || !__builtin_signbit (tanpi (5)) || !__builtin_signbit (tanpi (-6))) + link_error (); +} + +int +main () +{ + test_normal (); + test_corner (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr117811.c b/gcc/testsuite/gcc.dg/torture/pr117811.c index 13d7e13..05e8622 100644 --- a/gcc/testsuite/gcc.dg/torture/pr117811.c +++ b/gcc/testsuite/gcc.dg/torture/pr117811.c @@ -18,8 +18,13 @@ void __attribute__((noclone,noinline)) do_shift (v4 *vec, int shift) int main () { +#if __SIZEOF_INT__ >= 4 v4 vec = {0x1000000, 0x2000, 0x300, 0x40}; v4 vec2 = {0x100000, 0x200, 0x30, 0x4}; +#else + v4 vec = {0x4000, 0x2000, 0x300, 0x40}; + v4 vec2 = {0x400, 0x200, 0x30, 0x4}; +#endif do_shift (&vec, 4); if (memcmp (&vec, &vec2, sizeof (v4)) != 0) __builtin_abort (); diff --git a/gcc/testsuite/gcc.dg/torture/pr118476-1.c b/gcc/testsuite/gcc.dg/torture/pr118476-1.c new file mode 100644 index 0000000..33509403 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr118476-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +/* PR tree-optimization/118476 */ + +typedef unsigned long long poly64x1 __attribute__((__vector_size__(1*sizeof(long long)))); + +poly64x1 vext_p64(poly64x1 a, poly64x1 b, const int n) +{ + poly64x1 r = a; + unsigned src = (unsigned)n; + long long t = b[0]; + r[0] = (src < 1) ? a[src] : t; + return r; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr119131-1.c b/gcc/testsuite/gcc.dg/torture/pr119131-1.c index c62f702..1780035 100644 --- a/gcc/testsuite/gcc.dg/torture/pr119131-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr119131-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target dfp } */ +/* { dg-additional-options "-Wno-psabi" } */ /* PR target/119131 */ typedef __attribute__((__vector_size__ (64))) char C; diff --git a/gcc/testsuite/gcc.dg/torture/pr119973.c b/gcc/testsuite/gcc.dg/torture/pr119973.c new file mode 100644 index 0000000..a9661a3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr119973.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fipa-pta" } */ + +static int +is_valid_domain_name (const char *string) +{ + const char *s; + + for (s=string; *s; s++) + if (*s == '.') + { + if (string == s) + return 0; + } + + return !!*string; +} + +int +main (void) +{ + static struct + { + const char *name; + int valid; + } testtbl[] = + { + { ".", 0 }, + { nullptr, 0 } + }; + int idx; + + for (idx=0; testtbl[idx].name; idx++) + { + if (is_valid_domain_name (testtbl[idx].name) != testtbl[idx].valid) + __builtin_abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120006.c b/gcc/testsuite/gcc.dg/torture/pr120006.c new file mode 100644 index 0000000..c067f0e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120006.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fipa-pta" } */ + +char *b; +int f = 1; + +char *xstrdup(char *i) { + char *c = __builtin_strdup(i); + if (!c) + __builtin_exit(1); + return c; +} + +int main() { + char g; + char h[8]; + + for (int i = 0; i < 2; i++) { + char c = *__builtin_strdup(""); + b = &g; + + if (f) { + h[0] = '-'; + h[1] = 'a'; + h[2] = '\0'; + b = xstrdup(h); + } + } + if (__builtin_strcmp(b, "-a") != 0) + __builtin_abort(); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120043.c b/gcc/testsuite/gcc.dg/torture/pr120043.c new file mode 100644 index 0000000..ae27468 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120043.c @@ -0,0 +1,10 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fallow-store-data-races" } */ + +const int a; +int *b; +int main() +{ + &a != b || (*b = 1); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120059-1.c b/gcc/testsuite/gcc.dg/torture/pr120059-1.c new file mode 100644 index 0000000..36d0c5b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120059-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-g" } */ + +/* PR rtl-optimization/120059 */ + +int a[4]; +int c, d; +void f(void) { + for (int e = 0; e < 4; e++) + a[e] = e | c; + int b = 0; + if ((a[0] & 1) && (a[0] & 4)) + b = 2; + if (a[0] & 16) + b |= 1; + d = ~b; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120122-1.c b/gcc/testsuite/gcc.dg/torture/pr120122-1.c new file mode 100644 index 0000000..dde41d8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120122-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* PR tree-optimization/120122 */ + +#include <stdbool.h> + +struct Value { + int type; + union { + bool boolean; + long long t; + }; +}; + +static struct Value s_item_mem; + +/* truthy was being miscompiled for the value.type==2 case, + because we would have a VCE from unsigned char to bool + that went from being conditional in the value.type==1 case + to unconditional when `value.type!=0`. + The move of the VCE from conditional to unconditional, + needs to changed into a convert (NOP_EXPR). */ +static bool truthy(void) __attribute__((noipa)); +static bool +truthy(void) +{ + bool tt = false; + for(int i = 0; i < 10; i++) + { + struct Value value = s_item_mem; + if (value.type == 0) + tt = tt | 0; + else if (value.type == 1) + tt = tt | value.boolean; + else + tt = tt | 1; + } + return tt; +} + +int +main(void) +{ + s_item_mem.type = 2; + s_item_mem.t = -1; + bool b1 = !truthy(); + s_item_mem.type = 1; + s_item_mem.boolean = b1; + bool b = truthy(); + if (b1 != b) __builtin_abort(); + if (b) __builtin_abort(); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120182.c b/gcc/testsuite/gcc.dg/torture/pr120182.c new file mode 100644 index 0000000..5e2d171 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120182.c @@ -0,0 +1,42 @@ +/* { dg-do run { target { { *-*-linux* *-*-gnu* *-*-uclinux* } && mmap } } } */ + +#include <unistd.h> +#include <stdlib.h> +#include <sys/mman.h> + +struct S +{ + struct S *next; +}; + +static void __attribute__((noipa)) +allocate(void *addr, unsigned long long size) +{ + void *ptr = mmap((void *)addr, size, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE, + -1, 0); + if(ptr != addr) + exit(0); +} + +int main (void) +{ + int size = 0x8000; + char *ptr = (char *)0x288000ull; + allocate((void *)ptr, size); + + struct S *s1 = (struct S *)ptr; + struct S *s2 = (struct S *)256; + for (int i = 0; i < 3; i++) + { + for(char *addr = (char *)s1; addr < (char *)s1 + sizeof(*s1); ++addr) + *addr = 0; + + if(s1->next) + s1->next = s1->next->next = s2; + else + s1->next = s2; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120211-1.c b/gcc/testsuite/gcc.dg/torture/pr120211-1.c new file mode 100644 index 0000000..f9bc97c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120211-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +int a, b, d; +void e() { + do { + int f = 0; + while (1) { + int c = a; + for (; (c & 1) == 0; c = 1) + for (; c & 1;) + ; + if (a) + break; + f++; + } + b = f & 5; + if (b) + break; + } while (d++); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120242.c b/gcc/testsuite/gcc.dg/torture/pr120242.c new file mode 100644 index 0000000..2d0f7de --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120242.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */ + +char f1(char a, char b) { + return b == 0 ? a : b; +} +int f2(int a, int b) { + return b ? a : 0; +} +struct l { + unsigned m; + int n; +}; +struct l ae; +char af = -2; +unsigned ah = 4; +int aj = 8; +int *test = &aj; +int main() { +ao: + if (f2(f1(4, af++), *test) <= 0) { + for (; ae.n; ae.n++) + ; + if (ah) + goto ao; + } + if (af != 1) + __builtin_abort (); + __builtin_exit (0); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120276.c b/gcc/testsuite/gcc.dg/torture/pr120276.c new file mode 100644 index 0000000..9717a71 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120276.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.2-a+sve" { target aarch64*-*-* } } */ + +int a; +char b[1]; +int c[18]; +void d(char *); +void e() { + int f; + char *g; + a = 0; + for (; a < 18; a++) { + int h = f = 0; + for (; f < 4; f++) { + g[a * 4 + f] = c[a] >> h; + h += 8; + } + } + d(b); +}
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/torture/pr120341-1.c b/gcc/testsuite/gcc.dg/torture/pr120341-1.c new file mode 100644 index 0000000..e23185b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120341-1.c @@ -0,0 +1,11 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fallow-store-data-races" } */ + +char a, *b; +int main() +{ + b = "0"; + if (a) + b[0]++; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120341-2.c b/gcc/testsuite/gcc.dg/torture/pr120341-2.c new file mode 100644 index 0000000..7bcc96f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120341-2.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fallow-store-data-races" } */ + +char a, *b; +int main() +{ + while (a) + { + b = "0"; + b[0]++; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120347.c b/gcc/testsuite/gcc.dg/torture/pr120347.c new file mode 100644 index 0000000..a2d187b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120347.c @@ -0,0 +1,13 @@ +/* { dg-do assemble } */ +/* { dg-additional-options "-march=armv7-a -mthumb" { target { arm_arch_v7a_ok && arm_thumb2_ok } } } */ + +void *end; +void **start; +void main(void) +{ + for (; end; start++) { + if (*start) + return; + *start = start; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120369-1.c b/gcc/testsuite/gcc.dg/torture/pr120369-1.c new file mode 100644 index 0000000..4c20fb0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120369-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* PR middle-end/120369 */ + +/* Make sure cabs without a lhs does not cause an ICE. */ +void f() +{ + double _Complex z = 1.0; + __builtin_cabs(z); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120627.c b/gcc/testsuite/gcc.dg/torture/pr120627.c new file mode 100644 index 0000000..f83cd53 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120627.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */ + +unsigned char sub(unsigned char t, unsigned char u) { return t - u; } +unsigned char mul(unsigned char t, unsigned char u) { return t * u; } +int x(int aa, int ab) { + return ab >= 32 || aa > 18446744073709551615UL >> ab ? aa : aa << ab; +} +int ag; +int ah = 249; +char ap; +static short ar[5][9]; +int *as = &ag; +void bf(char cf) { + for (; ap <= 8; ap++) { + (ar[1][7] = mul(x(-1L, sub(cf, 247) / cf), ag <= 0)) || ar[1][4]++; + *as = ag; + } + return; +} +int main() { + bf(ah); + if (ar[1][7] != 255) + __builtin_abort (); + __builtin_exit (0); +} + diff --git a/gcc/testsuite/gcc.dg/torture/pr120654.c b/gcc/testsuite/gcc.dg/torture/pr120654.c new file mode 100644 index 0000000..aacfeea --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120654.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ + +int a, c, e, f, h, j; +long g, k; +int b(int m) { + if (m || a) + return 1; + return 0.0f; +} +int d(int m, int p2) { return b(m) + m + (1 + p2 + p2); } +int i() { + long l[] = {2, 9, 7, 8, g, g, 9, 0, 2, g}; + e = l[c] << 6; +} +void n() { + long o; + int *p = __builtin_malloc(sizeof(int)); + k = 1 % j; + for (; i() + f + h; o++) + if (p[d(j + 6, (int)k + 1992695866) + h + f + j + (int)k - 1 + o]) + __builtin_free(p); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120736.c b/gcc/testsuite/gcc.dg/torture/pr120736.c new file mode 100644 index 0000000..84f808a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120736.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */ + +unsigned char aa (unsigned char ab, int o) { return ab > o ? ab : 0; } +int p; +int s; +static unsigned char q = 255; +int r; +int *v = &s; +int main() { + p = v != 0; + for (; r < 8; ++r) { + if (s) + break; + s = aa(p * q++, 6) <= 0; + } + if (q != 1) + __builtin_abort (); + __builtin_exit (0); +} + diff --git a/gcc/testsuite/gcc.dg/torture/pr120813.c b/gcc/testsuite/gcc.dg/torture/pr120813.c new file mode 100644 index 0000000..16adbe5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120813.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */ + +short s (short t, short u) { return u == 0 ? 0 : t / u; } +int x[6]; +int y; +unsigned ak = 1; +unsigned short al = 65527; +unsigned *am = &ak; +int main() { + for (int i = 0; i < 6; i++) { + x[i] = i; + } + for (;;) { + unsigned long ar = 2080554998UL; + char as = 4; + if (s(34, al++) < ar) + if (*am) + break; + } + y = x[al & 5]; + if ((y ^ 5UL) != 4) + __builtin_abort (); + __builtin_exit (0); +} + + diff --git a/gcc/testsuite/gcc.dg/torture/pr120944.c b/gcc/testsuite/gcc.dg/torture/pr120944.c new file mode 100644 index 0000000..92f3c77 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120944.c @@ -0,0 +1,34 @@ +/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ +/* { dg-additional-options "-fdump-tree-optimized" } */ + +#include <stdlib.h> + +typedef union { + int u32; + struct + { + int A:1; + int B:2; + int C:3; + }; +} u_t; + +typedef union { + volatile int u[3]; + volatile struct { + u_t a; + int b; + int c; + }; +} DATA; + +void foo (volatile DATA *d) +{ + d->a.u32 = ~0; + u_t u = d->a; + int v = u.A; + if (v) + abort(); +} + +/* { dg-final { scan-tree-dump-times "if \\\(" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr120951-1.c b/gcc/testsuite/gcc.dg/torture/pr120951-1.c new file mode 100644 index 0000000..4e2b41d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120951-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-fnon-call-exceptions -fsignaling-nans" } */ + +/* PR tree-optimization/120951 */ + +/* cdce would create a trapping comparison inside a condition. + tests to make sure that does not happen. */ + +double f(double r, double i) { + return __builtin_fmod(r, i); +} + |