Use xzr for the output when we only require the flags output.
This will be used shortly for TImode comparisons.

        * config/aarch64/aarch64.md (ucmp<GPI>3_carryinC): New.
        (*ucmp<GPI>3_carryinC_z1): New.
        (*ucmp<GPI>3_carryinC_z2): New.
        (*ucmp<GPI>3_carryinC): New.
---
 gcc/config/aarch64/aarch64.md | 50 +++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index c7c4d1dd519..fcc1ddafaec 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -3439,6 +3439,18 @@
    ""
 )
 
+(define_expand "ucmp<GPI:mode>3_carryinC"
+   [(set (reg:CC CC_REGNUM)
+        (compare:CC
+          (zero_extend:<DWI>
+            (match_operand:GPI 0 "register_operand"))
+          (plus:<DWI>
+            (zero_extend:<DWI>
+              (match_operand:GPI 1 "register_operand"))
+            (ltu:<DWI> (reg:CC CC_REGNUM) (const_int 0)))))]
+   ""
+)
+
 (define_insn "*usub<GPI:mode>3_carryinC_z1"
   [(set (reg:CC CC_REGNUM)
        (compare:CC
@@ -3456,6 +3468,19 @@
   [(set_attr "type" "adc_reg")]
 )
 
+(define_insn "*ucmp<GPI:mode>3_carryinC_z1"
+  [(set (reg:CC CC_REGNUM)
+       (compare:CC
+         (const_int 0)
+         (plus:<DWI>
+           (zero_extend:<DWI>
+             (match_operand:GPI 0 "register_operand" "r"))
+           (match_operand:<DWI> 1 "aarch64_borrow_operation" ""))))]
+   ""
+   "sbcs\\t<w>zr, <w>zr, %<w>0"
+  [(set_attr "type" "adc_reg")]
+)
+
 (define_insn "*usub<GPI:mode>3_carryinC_z2"
   [(set (reg:CC CC_REGNUM)
        (compare:CC
@@ -3471,6 +3496,17 @@
   [(set_attr "type" "adc_reg")]
 )
 
+(define_insn "*ucmp<GPI:mode>3_carryinC_z2"
+  [(set (reg:CC CC_REGNUM)
+       (compare:CC
+         (zero_extend:<DWI>
+           (match_operand:GPI 0 "register_operand" "r"))
+         (match_operand:<DWI> 1 "aarch64_borrow_operation" "")))]
+   ""
+   "sbcs\\t<w>zr, %<w>0, <w>zr"
+  [(set_attr "type" "adc_reg")]
+)
+
 (define_insn "*usub<GPI:mode>3_carryinC"
   [(set (reg:CC CC_REGNUM)
        (compare:CC
@@ -3489,6 +3525,20 @@
   [(set_attr "type" "adc_reg")]
 )
 
+(define_insn "*ucmp<GPI:mode>3_carryinC"
+  [(set (reg:CC CC_REGNUM)
+       (compare:CC
+         (zero_extend:<DWI>
+           (match_operand:GPI 0 "register_operand" "r"))
+         (plus:<DWI>
+           (zero_extend:<DWI>
+             (match_operand:GPI 1 "register_operand" "r"))
+           (match_operand:<DWI> 2 "aarch64_borrow_operation" ""))))]
+   ""
+   "sbcs\\t<w>zr, %<w>0, %<w>1"
+  [(set_attr "type" "adc_reg")]
+)
+
 (define_expand "sub<GPI:mode>3_carryinV"
   [(parallel
      [(set (reg:CC_V CC_REGNUM)
-- 
2.20.1

Reply via email to