public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/109657] (a ? -1 : 0) | b could be optimized better for aarch64
Date: Fri, 28 Apr 2023 05:07:38 +0000	[thread overview]
Message-ID: <bug-109657-4-GCE6vEpj3m@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109657-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2023-04-28  5:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27 22:47 [Bug target/109657] New: " pinskia at gcc dot gnu.org
2023-04-28  5:07 ` pinskia at gcc dot gnu.org [this message]
2023-04-28 23:35 ` [Bug target/109657] " pinskia at gcc dot gnu.org
2023-05-02 21:10 ` cvs-commit at gcc dot gnu.org
2023-05-02 21:11 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109657-4-GCE6vEpj3m@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).