https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109657

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-04-28

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 022eef80bc1..5109e8abdbe 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -4203,6 +4203,30 @@ (define_insn "*cmovsi_insn_uxtw"
   [(set_attr "type" "csel, csel, csel, csel, csel, mov_imm, mov_imm")]
 )

+;; Convert -(cmp) | a into cmp ? -1 : a to be canonical in the backend.
+;;(set (reg/i:SI 0 x0)
+;;    (ior:SI (neg:SI (ne:SI (reg:CC 66 cc)
+;;                (const_int 0 [0])))
+;;        (reg:SI 102)))
+
+
+(define_insn_and_split "*cmov<mode>_insn_m1"
+  [(set (match_operand:GPI 0 "register_operand" "=r")
+        (ior:GPI
+        (neg:GPI
+         (match_operator:GPI 1 "aarch64_comparison_operator"
+          [(match_operand 2 "cc_register" "") (const_int 0)]))
+        (match_operand 3 "register_operand" "r")))]
+  ""
+  "#"
+  "&& true"
+  [(set (match_dup 0)
+       (if_then_else:GPI (match_dup 1)
+        (const_int -1) (match_dup 3)))]
+  {}
+  [(set_attr "type" "csel")]
+)
+
 (define_insn "*cmovdi_insn_uxtw"
   [(set (match_operand:DI 0 "register_operand" "=r")
        (if_then_else:DI


Will clean up the comment and add a testcase tomorrow.

Reply via email to