From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9B9E63858D38; Fri, 12 Jan 2024 15:50:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B9E63858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705074601; bh=0TQpF4Oof8U/lRpnhya8CB29IcNymALBJfIP3iMJxys=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pB76KM/jPoHck/oHysRcSA3k1kulv3emtpTM+x3zvKMpF3ziJSICY495kgtyMXipx kJAkHGYenl6EqjAHI4oFlVMU2xU6nRTtSOL/QUTOZ+Xe2xnwpneX2w4kjSO6eWqmJd wl//CiHPZXz8oE+ArVXAVus31m8j8usrnM5MGcPE= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/111267] [14 Regression] Codegen regression from i386 argument passing changes Date: Fri, 12 Jan 2024 15:49:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D111267 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |segher at gcc dot gnu.org --- Comment #5 from Jakub Jelinek --- Slightly cleaned up testcase: struct S { float a, b, c, d; }; int foo (struct S x, struct S y) { return x.a <=3D y.c && x.b <=3D y.d && x.c >=3D y.a && x.c >=3D y.a; } int bar (struct S x, struct S y) { return x.b <=3D y.d && x.c >=3D y.a; } I think the pattern be using reg_overlap_mentioned_p, register_operand does= n't really guarantee the operand is REG_P on which REGNO can be used. So something like: --- gcc/config/i386/i386.md.jj 2024-01-03 12:01:11.649644854 +0100 +++ gcc/config/i386/i386.md 2024-01-12 16:24:10.806783889 +0100 @@ -13347,6 +13347,27 @@ DONE; } [(set_attr "isa" "*,nox64,x64,*")]) + +;; Extract from concat + +(define_insn_and_split "*extv2_concat" + [(set (match_operand:DWIH 0 "register_operand") + (match_operand:DWIH 1 "register_operand")) + (set (match_operand: 2 "register_operand") + (any_or_plus: + (ashift: + (zero_extend: (match_operand:DWIH 3 "register_operand")) + (match_operand:QI 4 "const_scalar_int_operand")) + (zero_extend: (match_operand:DWIH 5 "register_operand"))))] + "INTVAL (operands[4]) =3D=3D * BITS_PER_UNIT + && !reg_overlap_mentioned_p (operands[0], operands[3]) + && !reg_overlap_mentioned_p (operands[0], operands[5])" + "#" + "&& 1" + [(set (match_dup 0) (match_dup 1)) + (set (match_dup 2) (ior: (ashift: (zero_extend: (match_d= up 3)) + (match_dup 4)) + (zero_extend: (match_dup 5))))]) ;; Negation instructions Note, while that improves the generated code for the first function (almost= but not 100% to what GCC 13 emitted), the second function still results in much larger code than before. Bet it would be even better if we could just define_split the pattern inste= ad of define_insn_and_split, but unfortunately this is a 2 insn combination and that doesn't allow to be split into 2 new instructions.=