| 1 |
/* PR c/102989 */ |
| 2 |
/* { dg-require-effective-target bitint } */ |
| 3 |
/* { dg-require-effective-target fenv_exceptions } */ |
| 4 |
/* { dg-options "-std=c23" } */ |
| 5 |
|
| 6 |
#include <fenv.h> |
| 7 |
|
| 8 |
#if __BITINT_MAXWIDTH__ >= 192 |
| 9 |
__attribute__((noipa)) _BitInt(192) |
| 10 |
tests192_32 (_Decimal32 d) |
| 11 |
{ |
| 12 |
return d; |
| 13 |
} |
| 14 |
|
| 15 |
__attribute__((noipa)) unsigned _BitInt(192) |
| 16 |
testu192_32 (_Decimal32 d) |
| 17 |
{ |
| 18 |
return d; |
| 19 |
} |
| 20 |
|
| 21 |
__attribute__((noipa)) _BitInt(192) |
| 22 |
tests192_64 (_Decimal64 d) |
| 23 |
{ |
| 24 |
return d; |
| 25 |
} |
| 26 |
|
| 27 |
__attribute__((noipa)) unsigned _BitInt(192) |
| 28 |
testu192_64 (_Decimal64 d) |
| 29 |
{ |
| 30 |
return d; |
| 31 |
} |
| 32 |
|
| 33 |
__attribute__((noipa)) _BitInt(192) |
| 34 |
tests192_128 (_Decimal128 d) |
| 35 |
{ |
| 36 |
return d; |
| 37 |
} |
| 38 |
|
| 39 |
__attribute__((noipa)) unsigned _BitInt(192) |
| 40 |
testu192_128 (_Decimal128 d) |
| 41 |
{ |
| 42 |
return d; |
| 43 |
} |
| 44 |
#endif |
| 45 |
|
| 46 |
#if __BITINT_MAXWIDTH__ >= 575 |
| 47 |
__attribute__((noipa)) _BitInt(575) |
| 48 |
tests575_32 (_Decimal32 d) |
| 49 |
{ |
| 50 |
return d; |
| 51 |
} |
| 52 |
|
| 53 |
__attribute__((noipa)) unsigned _BitInt(575) |
| 54 |
testu575_32 (_Decimal32 d) |
| 55 |
{ |
| 56 |
return d; |
| 57 |
} |
| 58 |
|
| 59 |
__attribute__((noipa)) _BitInt(575) |
| 60 |
tests575_64 (_Decimal64 d) |
| 61 |
{ |
| 62 |
return d; |
| 63 |
} |
| 64 |
|
| 65 |
__attribute__((noipa)) unsigned _BitInt(575) |
| 66 |
testu575_64 (_Decimal64 d) |
| 67 |
{ |
| 68 |
return d; |
| 69 |
} |
| 70 |
|
| 71 |
__attribute__((noipa)) _BitInt(575) |
| 72 |
tests575_128 (_Decimal128 d) |
| 73 |
{ |
| 74 |
return d; |
| 75 |
} |
| 76 |
|
| 77 |
__attribute__((noipa)) unsigned _BitInt(575) |
| 78 |
testu575_128 (_Decimal128 d) |
| 79 |
{ |
| 80 |
return d; |
| 81 |
} |
| 82 |
#endif |
| 83 |
|
| 84 |
__attribute__((noipa)) void |
| 85 |
check_invalid (int test, int inv) |
| 86 |
{ |
| 87 |
if (!test) |
| 88 |
__builtin_abort (); |
| 89 |
if ((!fetestexcept (FE_INVALID)) != (!inv)) |
| 90 |
__builtin_abort (); |
| 91 |
feclearexcept (FE_INVALID); |
| 92 |
} |
| 93 |
|
| 94 |
int |
| 95 |
main () |
| 96 |
{ |
| 97 |
#if __BITINT_MAXWIDTH__ >= 192 |
| 98 |
check_invalid (tests192_32 (__builtin_infd32 ()) == 3138550867693340381917894711603833208051177722232017256447wb, 1); |
| 99 |
check_invalid (tests192_32 (-__builtin_infd32 ()) == -3138550867693340381917894711603833208051177722232017256447wb - 1wb, 1); |
| 100 |
check_invalid (tests192_32 (__builtin_nand32 ("")) == 3138550867693340381917894711603833208051177722232017256447wb, 1); |
| 101 |
check_invalid (tests192_32 (-313855.0e+52DF) == -3138550000000000000000000000000000000000000000000000000000wb, 0); |
| 102 |
check_invalid (tests192_32 (-313855.1e+52DF) == -3138550867693340381917894711603833208051177722232017256447wb - 1wb, 1); |
| 103 |
check_invalid (tests192_32 (313855.0e+52DF) == 3138550000000000000000000000000000000000000000000000000000wb, 0); |
| 104 |
check_invalid (tests192_32 (313855.1e+52DF) == 3138550867693340381917894711603833208051177722232017256447wb, 1); |
| 105 |
check_invalid (testu192_32 (__builtin_infd32 ()) == 6277101735386680763835789423207666416102355444464034512895uwb, 1); |
| 106 |
check_invalid (testu192_32 (-__builtin_infd32 ()) == 0uwb, 1); |
| 107 |
check_invalid (testu192_32 (__builtin_nand32 ("")) == 6277101735386680763835789423207666416102355444464034512895uwb, 1); |
| 108 |
check_invalid (testu192_32 (-0.9999999DF) == 0uwb, 0); |
| 109 |
check_invalid (testu192_32 (-1.0DF) == 0uwb, 1); |
| 110 |
check_invalid (testu192_32 (6277101.0e+51DF) == 6277101000000000000000000000000000000000000000000000000000uwb, 0); |
| 111 |
check_invalid (testu192_32 (6277102.0e+51DF) == 6277101735386680763835789423207666416102355444464034512895uwb, 1); |
| 112 |
check_invalid (tests192_64 (__builtin_infd64 ()) == 3138550867693340381917894711603833208051177722232017256447wb, 1); |
| 113 |
check_invalid (tests192_64 (-__builtin_infd64 ()) == -3138550867693340381917894711603833208051177722232017256447wb - 1wb, 1); |
| 114 |
check_invalid (tests192_64 (__builtin_nand64 ("")) == 3138550867693340381917894711603833208051177722232017256447wb, 1); |
| 115 |
check_invalid (tests192_64 (-313855086769334.0e+43DD) == -3138550867693340000000000000000000000000000000000000000000wb, 0); |
| 116 |
check_invalid (tests192_64 (-313855086769334.1e+43DD) == -3138550867693340381917894711603833208051177722232017256447wb - 1wb, 1); |
| 117 |
check_invalid (tests192_64 (313855086769334.0e+43DD) == 3138550867693340000000000000000000000000000000000000000000wb, 0); |
| 118 |
check_invalid (tests192_64 (313855086769334.1e+43DD) == 3138550867693340381917894711603833208051177722232017256447wb, 1); |
| 119 |
check_invalid (testu192_64 (__builtin_infd64 ()) == 6277101735386680763835789423207666416102355444464034512895uwb, 1); |
| 120 |
check_invalid (testu192_64 (-__builtin_infd64 ()) == 0wb, 1); |
| 121 |
check_invalid (testu192_64 (__builtin_nand64 ("")) == 6277101735386680763835789423207666416102355444464034512895uwb, 1); |
| 122 |
check_invalid (testu192_64 (-0.9999999999999999DD) == 0uwb, 0); |
| 123 |
check_invalid (testu192_64 (-1.0DD) == 0uwb, 1); |
| 124 |
check_invalid (testu192_64 (627710173538668.0e+43DD) == 6277101735386680000000000000000000000000000000000000000000uwb, 0); |
| 125 |
check_invalid (testu192_64 (627710173538668.1e+43DD) == 6277101735386680763835789423207666416102355444464034512895uwb, 1); |
| 126 |
check_invalid (tests192_128 (__builtin_infd128 ()) == 3138550867693340381917894711603833208051177722232017256447wb, 1); |
| 127 |
check_invalid (tests192_128 (-__builtin_infd128 ()) == -3138550867693340381917894711603833208051177722232017256447wb - 1wb, 1); |
| 128 |
check_invalid (tests192_128 (__builtin_nand128 ("")) == 3138550867693340381917894711603833208051177722232017256447wb, 1); |
| 129 |
check_invalid (tests192_128 (-3138550867693340381917894711603833.0e+24DL) == -3138550867693340381917894711603833000000000000000000000000wb, 0); |
| 130 |
check_invalid (tests192_128 (-3138550867693340381917894711603834.0e+24DL) == -3138550867693340381917894711603833208051177722232017256447wb - 1wb, 1); |
| 131 |
check_invalid (tests192_128 (3138550867693340381917894711603833.0e+24DL) == 3138550867693340381917894711603833000000000000000000000000wb, 0); |
| 132 |
check_invalid (tests192_128 (3138550867693340381917894711603834.0e+24DL) == 3138550867693340381917894711603833208051177722232017256447wb, 1); |
| 133 |
check_invalid (testu192_128 (__builtin_infd128 ()) == 6277101735386680763835789423207666416102355444464034512895uwb, 1); |
| 134 |
check_invalid (testu192_128 (-__builtin_infd128 ()) == 0wb, 1); |
| 135 |
check_invalid (testu192_128 (__builtin_nand128 ("")) == 6277101735386680763835789423207666416102355444464034512895uwb, 1); |
| 136 |
check_invalid (testu192_128 (-0.9999999999999999999999999999999999DL) == 0uwb, 0); |
| 137 |
check_invalid (testu192_128 (-1.0DL) == 0uwb, 1); |
| 138 |
check_invalid (testu192_128 (6277101735386680763835789423207666.0e+24DL) == 6277101735386680763835789423207666000000000000000000000000uwb, 0); |
| 139 |
check_invalid (testu192_128 (6277101735386680763835789423207667.0e+24DL) == 6277101735386680763835789423207666416102355444464034512895uwb, 1); |
| 140 |
#endif |
| 141 |
#if __BITINT_MAXWIDTH__ >= 575 |
| 142 |
check_invalid (tests575_32 (__builtin_infd32 ()) == 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb, 1); |
| 143 |
check_invalid (tests575_32 (-__builtin_infd32 ()) == -61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb - 1wb, 1); |
| 144 |
check_invalid (tests575_32 (__builtin_nand32 ("")) == 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb, 1); |
| 145 |
check_invalid (tests575_32 (-9999999e+90DF) == -9999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb, 0); |
| 146 |
check_invalid (tests575_32 (9999999e+90DF) == 9999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb, 0); |
| 147 |
check_invalid (testu575_32 (__builtin_infd32 ()) == 123665200736552267030251260509823595017565674550605919957031528046448612553265933585158200530621522494798835713008069669675682517153375604983773077550946583958303386074349567uwb, 1); |
| 148 |
check_invalid (testu575_32 (-__builtin_infd32 ()) == 0uwb, 1); |
| 149 |
check_invalid (testu575_32 (__builtin_nand32 ("")) == 123665200736552267030251260509823595017565674550605919957031528046448612553265933585158200530621522494798835713008069669675682517153375604983773077550946583958303386074349567uwb, 1); |
| 150 |
check_invalid (testu575_32 (-0.9999999DF) == 0uwb, 0); |
| 151 |
check_invalid (testu575_32 (-1.0DF) == 0uwb, 1); |
| 152 |
check_invalid (testu575_32 (9999999e+90DF) == 9999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000uwb, 0); |
| 153 |
check_invalid (tests575_64 (__builtin_infd64 ()) == 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb, 1); |
| 154 |
check_invalid (tests575_64 (-__builtin_infd64 ()) == -61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb - 1wb, 1); |
| 155 |
check_invalid (tests575_64 (__builtin_nand64 ("")) == 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb, 1); |
| 156 |
check_invalid (tests575_64 (-6183260036827613.0e+157DD) == -61832600368276130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb, 0); |
| 157 |
check_invalid (tests575_64 (-6183260036827614.0e+157DD) == -61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb - 1wb, 1); |
| 158 |
check_invalid (tests575_64 (6183260036827613.0e+157DD) == 61832600368276130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb, 0); |
| 159 |
check_invalid (tests575_64 (6183260036827614.0e+157DD) == 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb, 1); |
| 160 |
check_invalid (testu575_64 (__builtin_infd64 ()) == 123665200736552267030251260509823595017565674550605919957031528046448612553265933585158200530621522494798835713008069669675682517153375604983773077550946583958303386074349567uwb, 1); |
| 161 |
check_invalid (testu575_64 (-__builtin_infd64 ()) == 0wb, 1); |
| 162 |
check_invalid (testu575_64 (__builtin_nand64 ("")) == 123665200736552267030251260509823595017565674550605919957031528046448612553265933585158200530621522494798835713008069669675682517153375604983773077550946583958303386074349567uwb, 1); |
| 163 |
check_invalid (testu575_64 (-0.9999999999999999DD) == 0uwb, 0); |
| 164 |
check_invalid (testu575_64 (-1.0DD) == 0uwb, 1); |
| 165 |
check_invalid (testu575_64 (1236652007365522.0e+158DD) == 123665200736552200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000uwb, 0); |
| 166 |
check_invalid (testu575_64 (1236652007365523.0e+158DD) == 123665200736552267030251260509823595017565674550605919957031528046448612553265933585158200530621522494798835713008069669675682517153375604983773077550946583958303386074349567uwb, 1); |
| 167 |
check_invalid (tests575_128 (__builtin_infd128 ()) == 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb, 1); |
| 168 |
check_invalid (tests575_128 (-__builtin_infd128 ()) == -61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb - 1wb, 1); |
| 169 |
check_invalid (tests575_128 (__builtin_nand128 ("")) == 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb, 1); |
| 170 |
check_invalid (tests575_128 (-6183260036827613351512563025491179.0e+139DL) == -61832600368276133515125630254911790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb, 0); |
| 171 |
check_invalid (tests575_128 (-618326003682761335151256302549118.0e+140DL) == -61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb - 1wb, 1); |
| 172 |
check_invalid (tests575_128 (6183260036827613351512563025491179.0e+139DL) == 61832600368276133515125630254911790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000wb, 0); |
| 173 |
check_invalid (tests575_128 (618326003682761335151256302549118.0e+140DL) == 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb, 1); |
| 174 |
check_invalid (testu575_128 (__builtin_infd128 ()) == 123665200736552267030251260509823595017565674550605919957031528046448612553265933585158200530621522494798835713008069669675682517153375604983773077550946583958303386074349567uwb, 1); |
| 175 |
check_invalid (testu575_128 (-__builtin_infd128 ()) == 0wb, 1); |
| 176 |
check_invalid (testu575_128 (__builtin_nand128 ("")) == 123665200736552267030251260509823595017565674550605919957031528046448612553265933585158200530621522494798835713008069669675682517153375604983773077550946583958303386074349567uwb, 1); |
| 177 |
check_invalid (testu575_128 (-0.9999999999999999999999999999999999DL) == 0uwb, 0); |
| 178 |
check_invalid (testu575_128 (-1.0DL) == 0uwb, 1); |
| 179 |
check_invalid (testu575_128 (1236652007365522670302512605098235.0e+140DL) == 123665200736552267030251260509823500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000uwb, 0); |
| 180 |
check_invalid (testu575_128 (1236652007365522670302512605098236.0e+140DL) == 123665200736552267030251260509823595017565674550605919957031528046448612553265933585158200530621522494798835713008069669675682517153375604983773077550946583958303386074349567uwb, 1); |
| 181 |
#endif |
| 182 |
} |