aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.cc
diff options
context:
space:
mode:
authorAndrew Pinski <quic_apinski@quicinc.com>2024-11-08 14:46:18 -0800
committerAndrew Pinski <quic_apinski@quicinc.com>2024-11-09 08:21:25 -0800
commited88bc2344321ee21e92afdd83b50699c4e4df79 (patch)
tree0f3c0384cd46ba682a1c1d027d3ae57138ef5df6 /gcc/fold-const.cc
parent6e84a41622f56ca360d995e6092ded3b5a02ba40 (diff)
downloadgcc-ed88bc2344321ee21e92afdd83b50699c4e4df79.zip
gcc-ed88bc2344321ee21e92afdd83b50699c4e4df79.tar.gz
gcc-ed88bc2344321ee21e92afdd83b50699c4e4df79.tar.bz2
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>
Diffstat (limited to 'gcc/fold-const.cc')
-rw-r--r--gcc/fold-const.cc10
1 files changed, 0 insertions, 10 deletions
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 0e37429..1e8ae1a 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -12530,16 +12530,6 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type,
arg01, arg1));
}
- /* Two consecutive rotates adding up to the some integer
- multiple of the precision of the type can be ignored. */
- if (code == RROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST
- && TREE_CODE (arg0) == RROTATE_EXPR
- && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
- && wi::umod_trunc (wi::to_wide (arg1)
- + wi::to_wide (TREE_OPERAND (arg0, 1)),
- prec) == 0)
- return fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0));
-
return NULL_TREE;
case MIN_EXPR: