aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1999-10-14 08:54:16 +0000
committerJeff Law <law@gcc.gnu.org>1999-10-14 02:54:16 -0600
commit03e0a65f6e0a4bd3e292e1e6a8328a591ec86f58 (patch)
tree9dd5fa34a653eaeb4a14a807b4d0914591d2c07b /gcc
parent0918eca0642ecac8d0617d4db57ec90d79eeda42 (diff)
downloadgcc-03e0a65f6e0a4bd3e292e1e6a8328a591ec86f58.zip
gcc-03e0a65f6e0a4bd3e292e1e6a8328a591ec86f58.tar.gz
gcc-03e0a65f6e0a4bd3e292e1e6a8328a591ec86f58.tar.bz2
* fold-const.c (fold): Detect rotates built from BIT_XOR_EXPRs.
From-SVN: r29966
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/fold-const.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 14cae90..04652a7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+Thu Oct 14 02:54:13 1999 Jeffrey A Law (law@cygnus.com)
+
+ * fold-const.c (fold): Detect rotates built from BIT_XOR_EXPRs.
+
Thu Oct 14 02:18:19 1999 Marc Espie <espie@cvs.openbsd.org>
* combine.c (simplify_logical): Recognize xor pattern that encodes
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 54eeb45..8327419 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5097,11 +5097,15 @@ fold (expr)
if (t1 != NULL_TREE)
return t1;
+ bit_rotate:
/* (A << C1) | (A >> C2) if A is unsigned and C1+C2 is the size of A
is a rotate of A by C1 bits. */
/* (A << B) | (A >> (Z - B)) if A is unsigned and Z is the size of A
is a rotate of A by B bits. */
+ /* Both transformations noted above also apply to when the inner
+ operation is an XOR. */
+
code0 = TREE_CODE (arg0);
code1 = TREE_CODE (arg1);
if (((code0 == RSHIFT_EXPR && code1 == LSHIFT_EXPR)
@@ -5170,7 +5174,9 @@ fold (expr)
return non_lvalue (convert (type, arg0));
if (integer_all_onesp (arg1))
return fold (build1 (BIT_NOT_EXPR, type, arg0));
- goto associate;
+ /* See if this can be simplified into a rotate first. If that
+ is unsuccessful we will jump to the association code. */
+ goto bit_rotate;
case BIT_AND_EXPR:
bit_and: