aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-05-13 13:04:26 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2013-05-13 13:04:26 +0200
commitae6fa899e7000352aa8573a23b1e92c225337ea1 (patch)
tree6346bea605532f76d3b46ee9bfb0d6588ee811de /gcc/tree-ssa-forwprop.c
parent4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc (diff)
downloadgcc-ae6fa899e7000352aa8573a23b1e92c225337ea1.zip
gcc-ae6fa899e7000352aa8573a23b1e92c225337ea1.tar.gz
gcc-ae6fa899e7000352aa8573a23b1e92c225337ea1.tar.bz2
re PR tree-optimization/45216 (Rotate expressions not recognized at tree level)
PR tree-optimization/45216 PR tree-optimization/57157 * tree-ssa-forwprop.c (simplify_rotate): Only recognize the (-Y) & (B - 1) variant if OP is |. * expmed.c (expand_shift_1): For rotations by const0_rtx just return shifted. Use (-op1) & (prec - 1) as other_amount instead of prec - op1. * c-c++-common/rotate-1.c: Add 32 tests with +. * c-c++-common/rotate-1a.c: Adjust. * c-c++-common/rotate-2.c: Add 32 tests with +, expect only 48 rotates. * c-c++-common/rotate-2b.c: New test. * c-c++-common/rotate-3.c: Add 32 tests with +. * c-c++-common/rotate-4.c: Add 32 tests with +, expect only 48 rotates. * c-c++-common/rotate-4b.c: New test. * c-c++-common/rotate-5.c: New test. From-SVN: r198823
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index e714a5e..6043d31 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -2135,10 +2135,10 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
(X << (int) Y) OP (X >> (int) (B - Y))
((T) ((T2) X << Y)) OP ((T) ((T2) X >> (B - Y)))
((T) ((T2) X << (int) Y)) OP ((T) ((T2) X >> (int) (B - Y)))
- (X << Y) OP (X >> ((-Y) & (B - 1)))
- (X << (int) Y) OP (X >> (int) ((-Y) & (B - 1)))
- ((T) ((T2) X << Y)) OP ((T) ((T2) X >> ((-Y) & (B - 1))))
- ((T) ((T2) X << (int) Y)) OP ((T) ((T2) X >> (int) ((-Y) & (B - 1))))
+ (X << Y) | (X >> ((-Y) & (B - 1)))
+ (X << (int) Y) | (X >> (int) ((-Y) & (B - 1)))
+ ((T) ((T2) X << Y)) | ((T) ((T2) X >> ((-Y) & (B - 1))))
+ ((T) ((T2) X << (int) Y)) | ((T) ((T2) X >> (int) ((-Y) & (B - 1))))
and transform these into:
X r<< CNT1
@@ -2293,7 +2293,8 @@ simplify_rotate (gimple_stmt_iterator *gsi)
&& host_integerp (cdef_arg2[i], 0)
&& tree_low_cst (cdef_arg2[i], 0)
== TYPE_PRECISION (rtype) - 1
- && TREE_CODE (cdef_arg1[i]) == SSA_NAME)
+ && TREE_CODE (cdef_arg1[i]) == SSA_NAME
+ && gimple_assign_rhs_code (stmt) == BIT_IOR_EXPR)
{
tree tem;
enum tree_code code;