]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use H8 nop moves as tst insns
authorJeff Law <jeffreyalaw@gmail.com>
Tue, 6 Jul 2021 14:55:53 +0000 (10:55 -0400)
committerJeff Law <jeffreyalaw@gmail.com>
Tue, 6 Jul 2021 14:55:53 +0000 (10:55 -0400)
gcc
* config/h8300/jumpcall.md (*branch): When possible, generate
the comparison in CCZN mode.
* config/h8300/predicates.md (simple_memory_operand): Reject all
auto-increment addressing modes.

gcc/config/h8300/jumpcall.md
gcc/config/h8300/predicates.md

index 7b6a66a96efb3a6e2fdbfe4b2ffd9aaa55c978b0..e1f04183564b74d3e0b664882c12b255bbabb4e1 100644 (file)
   ""
   "#"
   "&& reload_completed"
-  [(set (reg:H8cc CC_REG)
-       (compare:H8cc (match_dup 1) (match_dup 2)))
+  [(set (match_dup 4)
+       (match_dup 5))
    (set (pc)
        (if_then_else (match_op_dup 0
-                      [(reg:H8cc CC_REG) (const_int 0)])
+                      [(match_dup 4) (const_int 0)])
                      (label_ref (match_dup 3)) (pc)))]
-  "")
+  "
+{
+  machine_mode mode;
+
+  if (REG_P (operands[1])
+      && operands[2] == const0_rtx
+      && (GET_CODE (operands[0]) == EQ
+         || GET_CODE (operands[0]) == NE
+         || GET_CODE (operands[0]) == LT
+         || GET_CODE (operands[0]) == GE
+         /* Our tstxx insns will set ZN and clear V, so we can handle
+            a couple additional cases.  */
+         || GET_CODE (operands[0]) == LE
+         || GET_CODE (operands[0]) == GT))
+    mode = E_CCZNmode;
+  else
+    mode = E_CCmode;
+  operands[4] = gen_rtx_REG (mode, CC_REG);
+  operands[5] = gen_rtx_COMPARE (mode, operands[1], operands[2]);
+}")
 
 (define_insn "*branch_1"
   [(set (pc)
index f4e3ed4f562b904c6ee351aa56d8396bda940877..bed23e9a3e0f8d9789293d00c4db3f0a2884cd47 100644 (file)
 {
   if (GET_MODE (op) == mode
       && (GET_CODE (XEXP (op, 0)) != PRE_DEC
+         && GET_CODE (XEXP (op, 0)) != PRE_INC
+         && GET_CODE (XEXP (op, 0)) != POST_DEC
          && GET_CODE (XEXP (op, 0)) != POST_INC))
     return 1;
   return 0;