]> git.ipfire.org Git - thirdparty/gcc.git/commit
fold: Remove (rrotate (rrotate A CST) CST) folding [PR117492]
authorAndrew Pinski <quic_apinski@quicinc.com>
Fri, 8 Nov 2024 22:46:18 +0000 (14:46 -0800)
committerAndrew Pinski <quic_apinski@quicinc.com>
Sat, 9 Nov 2024 16:21:25 +0000 (08:21 -0800)
commited88bc2344321ee21e92afdd83b50699c4e4df79
tree0f3c0384cd46ba682a1c1d027d3ae57138ef5df6
parent6e84a41622f56ca360d995e6092ded3b5a02ba40
fold: Remove (rrotate (rrotate A CST) CST) folding [PR117492]

This removes an (broken) simplification from fold which is already handled in match.
The reason why it was broken is because of the use of wi::to_wide on the RHS of the
rotate which could be 2 different types even though the LHS was the same type.
Since it is already handled in match (by the patterns for
`Turn (a OP c1) OP c2 into a OP (c1+c2).`). It can be removed without losing any optimizations.

Bootstrapped and tested on x86_64-linux-gnu.

PR middle-end/117492

gcc/ChangeLog:

* fold-const.cc (fold_binary_loc): Remove `Two consecutive rotates adding up
to the some integer` simplifcation.

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr117492-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/fold-const.cc
gcc/testsuite/gcc.dg/torture/pr117492-1.c [new file with mode: 0644]