]> gcc.gnu.org Git - gcc.git/commitdiff
[committed] Fix minor SH scan-asm failure after recent IOR->ADD changes
authorJeff Law <jlaw@ventanamicro.com>
Sun, 16 Jun 2024 03:17:10 +0000 (21:17 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Sun, 16 Jun 2024 03:18:43 +0000 (21:18 -0600)
This fixes minor fallout from the IOR->ADD change for rotates that I installed
a little while ago.

Basically the SH backend has a special pattern for setting the T register that
has elements similar to a rotate.  With the IOR->ADD change that pattern no
longer matches and we get scan-asm failures.

Fixing isn't a trivial case of just replacing IOR with ADD as the IOR->ADD
change changes some of the simplifications/canonicalizations along the way.

The net is we need a pattern with a slightly different structure.   I've
regression tested this on sh3[eb]-linux-gnu and bootstrapped sh4-linux-gnu
(without a regression test).

gcc/
* config/sh/sh.md (neg_zero_extract_4b): New pattern.

gcc/config/sh/sh.md

index 19481c07db6a4985ed26fc237727fe2358a2cbbb..92a1efeb811f8f1d87b91ff7c22a1e6fb01a2d53 100644 (file)
   [(set (reg:SI T_REG) (zero_extract:SI (xor:SI (match_dup 0) (match_dup 1))
                                        (const_int 1) (match_dup 2)))])
 
+;; Same thing, but when we use a PLUS rather than IOR/XOR for the rotation
+;; which causes things to simplify somewhat differently.
+(define_insn_and_split "*neg_zero_extract_4b"
+  [(set (reg:SI T_REG)
+       (and:SI (not:SI (plus:SI
+                 (lshiftrt:SI (match_operand:SI 0 "arith_reg_operand")
+                              (match_operand 1 "const_int_operand"))
+                 (ashift:SI (match_operand:SI 2 "arith_reg_operand")
+                            (match_operand 3 "const_int_operand"))))
+               (const_int 1)))]
+  "TARGET_SH1 && can_create_pseudo_p ()
+   && INTVAL (operands[3]) > 0
+   && INTVAL (operands[1]) + INTVAL (operands[3]) == 32"
+  "#"
+  "&& 1"
+  [(set (reg:SI T_REG) (zero_extract:SI (xor:SI (match_dup 0) (match_dup 4))
+                                       (const_int 1) (match_dup 1)))]
+  { operands[4] = GEN_INT (1 << INTVAL (operands[1])); })
+
 (define_insn_and_split "*neg_zero_extract_5"
   [(set (reg:SI T_REG)
        (and:SI (not:SI (subreg:SI
This page took 0.069614 seconds and 5 git commands to generate.