Hi! torture/bitint-37.c test FAILed on i686-linux e.g. on signed _BitInt(575) + unsigned _BitInt(575) -> signed _BitInt(575) __builtin_add_overflow. With 64-bit limbs, we use 4 .UADDC calls in the IL, 2 in a loop (which handles the first 8 limbs), then one partial limb (we use 63 bits from that) and finally last_ovf case due to the mixing of signed vs. unsigned. But with 32-bit limbs, we use 5 .UADDC calls in the IL, 2 in a loop (which handles the first 16 limbs), then one full limb above that, one partial (31 bits) and finally last_ovf case, and for the last_ovf case the code computed incorrect idx and so partly did the wrong thing, e.g. overwrote the result from the previous .UADDC.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-02-10 Jakub Jelinek <ja...@redhat.com> * gimple-lower-bitint.cc (itint_large_huge::lower_addsub_overflow): Fix computation of idx for i == 4 of bitint_prec_huge. --- gcc/gimple-lower-bitint.cc.jj 2024-02-09 16:16:55.335552760 +0100 +++ gcc/gimple-lower-bitint.cc 2024-02-09 20:41:50.397455671 +0100 @@ -4031,7 +4031,7 @@ bitint_large_huge::lower_addsub_overflow if (kind != bitint_prec_huge) idx = size_int (i); else if (i >= 2) - idx = size_int (fin + (i > 2)); + idx = size_int (fin + i - 2); if (!last_ovf || i < cnt - 1) { if (type0 != TREE_TYPE (arg0)) Jakub