diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-12-03 11:16:37 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-12-03 11:16:37 +0100 |
commit | 0b89341f124eadc689682d01193309225adfec23 (patch) | |
tree | b0092d41bb651645edca37abe8ff54fefcbd8e5e /gcc/tree-ssanames.cc | |
parent | 3d72e50caebf232fdd7f70613616ca4fd4fb472b (diff) | |
download | gcc-0b89341f124eadc689682d01193309225adfec23.zip gcc-0b89341f124eadc689682d01193309225adfec23.tar.gz gcc-0b89341f124eadc689682d01193309225adfec23.tar.bz2 |
bitintlower: Fix up ?ROTATE_EXPR lowering [PR117847]
In the ?ROTATE_EXPR lowering I forgot to handle rotation by 0 correctly.
INTEGER_CST 0 is very unlikely, it would be probably folded away, but
a non-constant count can't use just p - n because then the shift count
is out of bounds for zero.
In the FE I use n == 0 ? x : (x << n) | (x >> (p - n)) but bitintlower
here isn't prepared at this point to have bb split and am not sure if
using COND_EXPR is a good idea either, so the patch uses (p - n) % p.
Perhaps I should just disable lowering the rotate in the FE for the
non-mode precision BITINT_TYPEs too.
2024-12-03 Jakub Jelinek <jakub@redhat.com>
PR middle-end/117847
* gimple-lower-bitint.cc (gimple_lower_bitint) <case LROTATE_EXPR>:
Use m = (p - n) % p instead of m = p - n for the other shift count.
* gcc.dg/torture/bitint-75.c: New test.
Diffstat (limited to 'gcc/tree-ssanames.cc')
0 files changed, 0 insertions, 0 deletions