[gcc/devel/gccgo] simplify-rtx: Simplify rotates by zero

Ian Lance Taylor ian@gcc.gnu.org
Sun Jul 12 20:02:00 GMT 2020


https://gcc.gnu.org/g:0c586913e61021681e3221e8760cd87b24142aea

commit 0c586913e61021681e3221e8760cd87b24142aea
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Wed Jun 24 19:18:03 2020 +0000

    simplify-rtx: Simplify rotates by zero
    
    2020-06-24  Roger Sayle  <roger@nextmovesoftware.com>
                Segher Boessenkool  <segher@kernel.crashing.org>
    
            * simplify-rtx.c (simplify_unary_operation_1): Simplify rotates by 0.

Diff:
---
 gcc/simplify-rtx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 65008eaab45..3e913b5dd4f 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3645,6 +3645,8 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
 
     case ROTATERT:
     case ROTATE:
+      if (trueop1 == CONST0_RTX (mode))
+	return op0;
       /* Canonicalize rotates by constant amount.  If op1 is bitsize / 2,
 	 prefer left rotation, if op1 is from bitsize / 2 + 1 to
 	 bitsize - 1, use other direction of rotate with 1 .. bitsize / 2 - 1


More information about the Gcc-cvs mailing list