public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-111267-4-b7houc9bKw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111267-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |segher at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly cleaned up testcase:
struct S { float a, b, c, d; };

int
foo (struct S x, struct S y)
{
  return x.a <= y.c && x.b <= y.d && x.c >= y.a && x.c >= y.a;
}

int
bar (struct S x, struct S y)
{
  return x.b <= y.d && x.c >= y.a;
}

I think the pattern be using reg_overlap_mentioned_p, register_operand doesn'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 "*extv<dwi><mode>2_concat"
+  [(set (match_operand:DWIH 0 "register_operand")
+       (match_operand:DWIH 1 "register_operand"))
+   (set (match_operand:<DWI> 2 "register_operand")
+       (any_or_plus:<DWI>
+         (ashift:<DWI>
+           (zero_extend:<DWI> (match_operand:DWIH 3 "register_operand"))
+           (match_operand:QI 4 "const_scalar_int_operand"))
+         (zero_extend:<DWI> (match_operand:DWIH 5 "register_operand"))))]
+  "INTVAL (operands[4]) == <MODE_SIZE> * 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:<DWI> (ashift:<DWI> (zero_extend:<DWI> (match_dup
3))
+                                              (match_dup 4))
+                                (zero_extend:<DWI> (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 instead
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.

  parent reply	other threads:[~2024-01-12 15:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 12:55 [Bug rtl-optimization/111267] New: " manolis.tsamis at vrull dot eu
2023-09-12 10:43 ` [Bug rtl-optimization/111267] [14 Regression] " rguenth at gcc dot gnu.org
2023-10-17 12:34 ` rguenth at gcc dot gnu.org
2023-10-20 22:42 ` roger at nextmovesoftware dot com
2023-10-20 22:49 ` roger at nextmovesoftware dot com
2024-01-05 10:43 ` jakub at gcc dot gnu.org
2024-01-12 15:49 ` jakub at gcc dot gnu.org [this message]
2024-01-12 19:06 ` roger at nextmovesoftware dot com
2024-01-14  0:09 ` roger at nextmovesoftware dot com
2024-01-14 12:10 ` roger at nextmovesoftware dot com
2024-01-15  7:32 ` rguenth at gcc dot gnu.org
2024-01-16  1:15 ` roger at nextmovesoftware dot com
2024-01-21 21:25 ` cvs-commit at gcc dot gnu.org
2024-01-22  9:11 ` rsandifo at gcc dot gnu.org
2024-01-25  7:51 ` mkuvyrkov at gcc dot gnu.org
2024-01-25  7:55 ` clyon at gcc dot gnu.org
2024-01-25  9:48 ` mkuvyrkov at gcc dot gnu.org
2024-02-16  9:12 ` roger at nextmovesoftware dot com

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-111267-4-b7houc9bKw@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).