]> git.ipfire.org Git - thirdparty/gcc.git/commit
lower-bitint: Fix .{ADD,SUB,MUL}_OVERFLOW with _BitInt large/huge INTEGER_CST argumen...
authorJakub Jelinek <jakub@redhat.com>
Fri, 15 Dec 2023 09:10:58 +0000 (10:10 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 15 Dec 2023 09:10:58 +0000 (10:10 +0100)
commitd50d3d0a688e8dac31b307b3aad3fbc99283ebc4
tree2b5ff2df709fa35fc72b24d7fb1de370701a1489
parent5641787abeea0fdc8fc43733e01768caad25b761
lower-bitint: Fix .{ADD,SUB,MUL}_OVERFLOW with _BitInt large/huge INTEGER_CST arguments [PR113003]

As shown in the testcase, .{ADD,SUB,MUL}_OVERFLOW calls are another
exception to the middle/large/huge _BitInt discovery through SSA_NAMEs
next to stores of INTEGER_CSTs to memory and their conversions to
floating point.
The calls can have normal COMPLEX_TYPE with INTEGER_TYPE elts return type
(or BITINT_TYPE with small precision) and one of the arguments can be
SSA_NAME with an INTEGER_TYPE or small BITINT_TYPE as well; still, when
there is an INTEGER_CST argument with large/huge BITINT_TYPE, we need to
lower it that way.

2023-12-15  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/113003
* gimple-lower-bitint.cc (arith_overflow_arg_kind): New function.
(gimple_lower_bitint): Use it to catch .{ADD,SUB,MUL}_OVERFLOW
calls with large/huge INTEGER_CST arguments.

* gcc.dg/bitint-54.c: New test.
gcc/gimple-lower-bitint.cc
gcc/testsuite/gcc.dg/bitint-54.c [new file with mode: 0644]