]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix invalid right shift count with recent ifcvt changes
authorJeff Law <jlaw@ventanamicro.com>
Mon, 25 Aug 2025 01:55:44 +0000 (19:55 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Mon, 25 Aug 2025 01:56:59 +0000 (19:56 -0600)
commit56ca14c4c4fa2279ff80b44b495d375c42795598
tree91b80ef2c064ec9c7bc19966edd2946d5de38813
parente855cd3b44d9ac75f0a3f2db2ed7818abcac3b8c
Fix invalid right shift count with recent ifcvt changes

I got too clever trying to simplify the right shift computation in my recent
ifcvt patch.  Interestingly enough, I haven't seen anything but the Linaro CI
configuration actually trip the problem, though the code is clearly wrong.

The problem I was trying to avoid were the leading zeros when calling clz on a
HWI when the real object is just say 32 bits.

The net is we get a right shift count of "2" when we really wanted a right
shift count of 30.  That causes the execution aspect of bics_3 to fail.

The scan failures are due to creating slightly more efficient code. THe new
code sequences don't need to use conditional execution for selection and thus
we can use bic rather bics which requires a twiddle in the scan.

I reviewed recent bug reports and haven't seen one for this issue.  So no new
testcase as this is covered by the armv7 testsuite in the right configuration.

Bootstrapped and regression tested on x86_64, also verified it fixes the Linaro
reported CI failure and verified the crosses are still happy.  Pushing to the
trunk.

gcc/
* ifcvt.cc (noce_try_sign_bit_splat): Fix right shift computation.

gcc/testsuite/
* gcc.target/arm/bics_3.c: Adjust expected output
gcc/ifcvt.cc
gcc/testsuite/gcc.target/arm/bics_3.c