| 1 |
/* PR libgcc/65833 */ |
| 2 |
/* { dg-require-effective-target int128 } */ |
| 3 |
/* { dg-require-effective-target bitint } */ |
| 4 |
/* { dg-options "-O2 -std=gnu2x" } */ |
| 5 |
|
| 6 |
#define INT128_MAX ((__int128) ((((unsigned __int128) 1) << 127) - 1)) |
| 7 |
#define UINT128_MAX (~(unsigned __int128) 0) |
| 8 |
#define C(x, y) ((((__int128) (x##ULL)) << 64) | (y##ULL)) |
| 9 |
#define UC(x, y) ((((unsigned __int128) (x##ULL)) << 64) | (y##ULL)) |
| 10 |
|
| 11 |
__attribute__((noipa)) __int128 |
| 12 |
tests64 (_Decimal64 d) |
| 13 |
{ |
| 14 |
return d; |
| 15 |
} |
| 16 |
|
| 17 |
__attribute__((noipa)) unsigned __int128 |
| 18 |
testu64 (_Decimal64 d) |
| 19 |
{ |
| 20 |
return d; |
| 21 |
} |
| 22 |
|
| 23 |
__attribute__((noipa)) __int128 |
| 24 |
tests32 (_Decimal32 d) |
| 25 |
{ |
| 26 |
return d; |
| 27 |
} |
| 28 |
|
| 29 |
__attribute__((noipa)) unsigned __int128 |
| 30 |
testu32 (_Decimal32 d) |
| 31 |
{ |
| 32 |
return d; |
| 33 |
} |
| 34 |
|
| 35 |
__attribute__((noipa)) __int128 |
| 36 |
tests128 (_Decimal128 d) |
| 37 |
{ |
| 38 |
return d; |
| 39 |
} |
| 40 |
|
| 41 |
__attribute__((noipa)) unsigned __int128 |
| 42 |
testu128 (_Decimal128 d) |
| 43 |
{ |
| 44 |
return d; |
| 45 |
} |
| 46 |
|
| 47 |
int |
| 48 |
main () |
| 49 |
{ |
| 50 |
if (tests64 (0.DD) != 0 |
| 51 |
|| tests64 (0.9999999999999999DD) != 0 |
| 52 |
|| tests64 (7.999999999999999DD) != 7 |
| 53 |
|| tests64 (-0.DD) != 0 |
| 54 |
|| tests64 (-0.9999999999999999DD) != 0 |
| 55 |
|| tests64 (-42.5DD) != -42 |
| 56 |
|| tests64 (-34242319854.45429e+27DD) != -C (0x19c2d4b6fefc3378, 0xa349b93967400000) |
| 57 |
|| tests64 (-213855087769445.9e+23DD) != -C (0x1016b2fcff8f2cf6, 0xd16cf61904c00000) |
| 58 |
|| tests64 (1701411834604692.0e+23DD) != C (0x7ffffffffffff947, 0xd26076f482000000) |
| 59 |
|| tests64 (-1701411834604692.0e+23DD) != -C (0x7ffffffffffff947, 0xd26076f482000000)) |
| 60 |
__builtin_abort (); |
| 61 |
if (tests64 (1701411834604693.0e+23DD) != INT128_MAX |
| 62 |
|| tests64 (9999999999999999e+369DD) != INT128_MAX |
| 63 |
|| tests64 (-1701411834604693.0e+23DD) != -INT128_MAX - 1 |
| 64 |
|| tests64 (-9999999999999999e+369DD) != -INT128_MAX - 1) |
| 65 |
__builtin_abort (); |
| 66 |
if (testu64 (0.DD) != 0 |
| 67 |
|| testu64 (0.9999999999999999DD) != 0 |
| 68 |
|| testu64 (-0.9999999999999999DD) != 0 |
| 69 |
|| testu64 (-0.0DD) != 0 |
| 70 |
|| testu64 (-0.5DD) != 0 |
| 71 |
|| testu64 (42.99999999999999DD) != 42 |
| 72 |
|| testu64 (42.e+21DD) != UC (0x8e4, 0xd316827686400000) |
| 73 |
|| testu64 (34272319854.45429e+27DD) != C (0x19c89bd43b04cab9, 0x49f2646567400000) |
| 74 |
|| testu64 (3402823669209384.0e+23DD) != C (0xfffffffffffff28f, 0xa4c0ede904000000)) |
| 75 |
__builtin_abort (); |
| 76 |
if (testu64 (-1.DD) != 0 |
| 77 |
|| testu64 (-42.5e+15DD) != 0 |
| 78 |
|| testu64 (-9999999999999999e+369DD) != 0 |
| 79 |
|| testu64 (3402823669209385.0e+23DD) != UINT128_MAX |
| 80 |
|| testu64 (9999999999999999e+369DD) != UINT128_MAX) |
| 81 |
__builtin_abort (); |
| 82 |
|
| 83 |
if (tests32 (0.DF) != 0 |
| 84 |
|| tests32 (0.9999999DF) != 0 |
| 85 |
|| tests32 (7.999999DF) != 7 |
| 86 |
|| tests32 (-0.000DF) != 0 |
| 87 |
|| tests32 (-0.9999999DF) != 0 |
| 88 |
|| tests32 (-1.DF) != -1 |
| 89 |
|| tests32 (-42.5DF) != -42 |
| 90 |
|| tests32 (-3424.231e+27DF) != -C (0x2b38497f00, 0x9c4e190b47000000) |
| 91 |
|| tests32 (-213855.9e+32DF) != -C (0x1016b6fe2d67e732, 0x717a483980000000) |
| 92 |
|| tests32 (1701411.0e+32DF) != C (0x7ffffbe294adefda, 0xd863b4a300000000) |
| 93 |
|| tests32 (-1701411.0e+32DF) != -C (0x7ffffbe294adefda, 0xd863b4a300000000)) |
| 94 |
__builtin_abort (); |
| 95 |
if (tests32 (1701412.0e+32DF) != INT128_MAX |
| 96 |
|| tests32 (9999999e+90DF) != INT128_MAX |
| 97 |
|| tests32 (-1701412.0e+32DF) != -INT128_MAX - 1 |
| 98 |
|| tests32 (-9999999e+90DF) != -INT128_MAX - 1) |
| 99 |
__builtin_abort (); |
| 100 |
if (testu32 (0.DF) != 0 |
| 101 |
|| testu32 (0.9999999DF) != 0 |
| 102 |
|| testu32 (-0.9999999DF) != 0 |
| 103 |
|| testu32 (-0.5DF) != 0 |
| 104 |
|| testu32 (-0.0000DF) != 0 |
| 105 |
|| testu32 (-0.99999DF) != 0 |
| 106 |
|| testu32 (42.99999DF) != 42 |
| 107 |
|| testu32 (42.e+21DF) != UC (0x8e4, 0xd316827686400000) |
| 108 |
|| testu32 (3402.823e+35DF) != UC (0xfffffcb356c92111, 0x367458c700000000)) |
| 109 |
__builtin_abort (); |
| 110 |
if (testu32 (-1.DF) != 0 |
| 111 |
|| testu32 (-42.5e+15DF) != 0 |
| 112 |
|| testu32 (-9999999e+90DF) != 0 |
| 113 |
|| testu32 (3402.824e+35DF) != UINT128_MAX |
| 114 |
|| testu32 (9999999e+90DF) != UINT128_MAX) |
| 115 |
__builtin_abort (); |
| 116 |
|
| 117 |
if (tests128 (0.DL) != 0 |
| 118 |
|| tests128 (0.9999999999999999999999999999999999DL) != 0 |
| 119 |
|| tests128 (7.999999999999999999999999999999999DL) != 7 |
| 120 |
|| tests128 (-0.DL) != 0 |
| 121 |
|| tests128 (-0.9999999999999999999999999999999999DL) != 0 |
| 122 |
|| tests128 (-1.DL) != -1 |
| 123 |
|| tests128 (-42.5DL) != -42 |
| 124 |
|| tests128 (-34242319854.45429439857871298745432e+27DL) != -C (0x19c2d4b6fefc3467, 0x15d47c047b56ad80) |
| 125 |
|| tests128 (-213855087769445.9e+23DL) != -C (0x1016b2fcff8f2cf6, 0xd16cf61904c00000) |
| 126 |
|| tests128 (1701411834604692317316873037158841.0e+5DL) != C (0x7fffffffffffffff, 0xffffffffffffe9a0) |
| 127 |
|| tests128 (-1701411834604692317316873037158841.0e+5DL) != -C (0x7fffffffffffffff, 0xffffffffffffe9a0)) |
| 128 |
__builtin_abort (); |
| 129 |
if (tests128 (1701411834604692317316873037158842.0e+5DL) != INT128_MAX |
| 130 |
|| tests128 (9999999999999999999999999999999999e+6111DL) != INT128_MAX |
| 131 |
|| tests128 (-1701411834604692317316873037158842.0e+5DL) != -INT128_MAX - 1 |
| 132 |
|| tests128 (-9999999999999999999999999999999999e+6111DL) != -INT128_MAX - 1) |
| 133 |
__builtin_abort (); |
| 134 |
if (testu128 (0.DL) != 0 |
| 135 |
|| testu128 (0.9999999999999999999999999999999999DL) != 0 |
| 136 |
|| testu128 (-0.9999999999999999999999999999999999DL) != 0 |
| 137 |
|| testu128 (-0.DL) != 0 |
| 138 |
|| testu128 (-0.9999999999999999999999DL) != 0 |
| 139 |
|| testu128 (-0.5DL) != 0 |
| 140 |
|| testu128 (42.99999999999999999999999999999999DL) != 42 |
| 141 |
|| testu128 (42.e+21DL) != UC (0x8e4, 0xd316827686400000) |
| 142 |
|| testu128 (34242319854.45429439857871298745432e+21DL) != UC (0x1b032e71cc9, 0x24b5cd6d86a9473e) |
| 143 |
|| testu128 (3402823669209384634633746074317.682e+8DL) != UC (0xffffffffffffffff, 0xffffffffffffd340)) |
| 144 |
__builtin_abort (); |
| 145 |
if (testu128 (-1.DL) != 0 |
| 146 |
|| testu128 (-42.5e+15DL) != 0 |
| 147 |
|| testu128 (-9999999999999999999999999999999999e+6111DL) != 0 |
| 148 |
|| testu128 (3402823669209384634633746074317.683e+8DL) != UINT128_MAX |
| 149 |
|| testu128 (9999999999999999999999999999999999e+6111DL) != UINT128_MAX) |
| 150 |
__builtin_abort (); |
| 151 |
} |