diff mbox

[8/10] aarch64: ccmp insn patterns

Message ID CACgzC7AvpDi3bKrHdgmzDRhp2AmU4iawymeJ7P2OVSxF9_PAOA@mail.gmail.com
State New
Headers show

Commit Message

Zhenqiang Chen June 23, 2014, 7 a.m. UTC
Hi,

The patch adds two insn patterns for ccmp instructions.

cbranchcc4 is introduced to generate optimized conditional branch
without an additional compare against the result of ccmp.

OK for trunk?

Thanks!
-Zhenqiang

ChangeLog:
2014-06-23  Zhenqiang Chen  <zhenqiang.chen@linaro.org>

        * config/aarch64/aarch64.md (cbranchcc4): New.
        (*ccmp_and, *ccmp_ior): New.
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index a4d8887..c25d940 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -230,6 +230,52 @@ 
   "
 )
+(define_expand "cbranchcc4"
+  [(set (pc) (if_then_else
+             (match_operator 0 "aarch64_comparison_operator"
+              [(match_operand 1 "cc_register" "")
+               (const_int 0)])
+             (label_ref (match_operand 3 "" ""))
+             (pc)))]
+  ""
+  " ")
+
+(define_insn "*ccmp_and"
+  [(set (match_operand 6 "ccmp_cc_register" "")
+       (compare
+        (and:SI
+         (match_operator 4 "aarch64_comparison_operator"
+          [(match_operand 0 "ccmp_cc_register" "")
+           (match_operand 1 "aarch64_plus_operand" "")])
+         (match_operator 5 "aarch64_comparison_operator"
+          [(match_operand:GPI 2 "register_operand" "r,r,r")
+           (match_operand:GPI 3 "aarch64_ccmp_operand" "r,Uss,Usn")]))
+        (const_int 0)))]
+  ""
+  {
+    return aarch64_output_ccmp (operands, true, which_alternative);
+  }
+  [(set_attr "type" "alus_reg,alus_imm,alus_imm")]
+)
+
+(define_insn "*ccmp_ior"
+  [(set (match_operand 6 "ccmp_cc_register" "")
+       (compare
+        (ior:SI
+         (match_operator 4 "aarch64_comparison_operator"
+          [(match_operand 0 "ccmp_cc_register" "")
+           (match_operand 1 "aarch64_plus_operand" "")])
+         (match_operator 5 "aarch64_comparison_operator"
+          [(match_operand:GPI 2 "register_operand" "r,r,r")
+           (match_operand:GPI 3 "aarch64_ccmp_operand" "r,Uss,Usn")]))
+        (const_int 0)))]
+  ""
+  {
+    return aarch64_output_ccmp (operands, false, which_alternative);
+  }
+  [(set_attr "type" "alus_reg,alus_imm,alus_imm")]
+)
+
 (define_insn "*condjump"
   [(set (pc) (if_then_else (match_operator 0 "aarch64_comparison_operator"
                            [(match_operand 1 "cc_register" "") (const_int 0)])
                                                                   57,1