simplify-rtx: Simplify rotates by zero
authorRoger Sayle <roger@nextmovesoftware.com>
Wed, 24 Jun 2020 19:18:03 +0000 (19:18 +0000)
committerSegher Boessenkool <segher@kernel.crashing.org>
Wed, 24 Jun 2020 19:27:57 +0000 (19:27 +0000)
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.

gcc/simplify-rtx.c

index 65008eaab45887d10d31ffd19d174f31a2ad7cf7..3e913b5dd4fc7ec619a8f8d1e6a71e432931b741 100644 (file)
@@ -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