diff options
-rw-r--r-- | gcc/gimple-lower-bitint.cc | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/bitint-71.c | 28 |
2 files changed, 29 insertions, 5 deletions
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc index 7e8b6e3..56e5f82 100644 --- a/gcc/gimple-lower-bitint.cc +++ b/gcc/gimple-lower-bitint.cc @@ -4286,11 +4286,7 @@ bitint_large_huge::lower_addsub_overflow (tree obj, gimple *stmt) bool single_comparison = (startlimb + 2 >= fin || (startlimb & 1) != (i & 1)); if (!single_comparison) - { - cmp_code = GE_EXPR; - if (!check_zero && (start % limb_prec) == 0) - single_comparison = true; - } + cmp_code = GE_EXPR; else if ((startlimb & 1) == (i & 1)) cmp_code = EQ_EXPR; else diff --git a/gcc/testsuite/gcc.dg/torture/bitint-71.c b/gcc/testsuite/gcc.dg/torture/bitint-71.c new file mode 100644 index 0000000..8ebd42b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-71.c @@ -0,0 +1,28 @@ +/* PR middle-end/115352 */ +/* { dg-do run { target bitint } } */ +/* { dg-options "-std=c23" } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ + +#if __BITINT_MAXWIDTH__ >= 385 +int +foo (_BitInt (385) b) +{ + return __builtin_sub_overflow_p (0, b, (_BitInt (65)) 0); +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 385 + if (!foo (-(_BitInt (385)) 0x00000000000000000c377e8a3fd1881fff035bb487a51c9ed1f7350befa7ec4450000000000000000a3cf8d1ebb723981wb)) + __builtin_abort (); + if (!foo (-0x1ffffffffffffffffc377e8a3fd1881fff035bb487a51c9ed1f7350befa7ec445ffffffffffffffffa3cf8d1ebb723981uwb)) + __builtin_abort (); + if (!foo (-(_BitInt (385)) 0x00000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000000000000a3cf8d1ebb723981wb)) + __builtin_abort (); + if (!foo (-0x1ffffffffffffffff00000000000000000000000000000000ffffffffffffffffffffffffffffffffa3cf8d1ebb723981uwb)) + __builtin_abort (); +#endif +} |