From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3348C3858D37; Fri, 28 Apr 2023 05:07:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3348C3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682658458; bh=uxEV8U7f11sf1GoiGgAZUtqEZlQJmxNPn47ggk28ghw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ksCDcoNOdi2vH4SYM9N0/qDE5WSvCHL3YiQVZPGOJYhhBkX5PVNyl3O0o356WFSeA J1Zn254taKUG8VWiC7DBiwF4HDS41fZBn/+LSktD+7o4inWXKlfugKHXuXdxw90fO6 /iHM3khteHJEa59YzUf2vcXJc27Pt5MkIW94msEU= From: "pinskia at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status everconfirmed cf_reconfirmed_on Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109657 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Last reconfirmed| |2023-04-28 --- Comment #1 from Andrew Pinski --- 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_insn_m1" + [(set (match_operand:GPI 0 "register_operand" "=3Dr") + (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" "=3Dr") (if_then_else:DI Will clean up the comment and add a testcase tomorrow.=