public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Hongtao Liu <crazylht@gmail.com>,
	Kong Lingling <lingling.kong@intel.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [committed] i386: Fix up *avx2_eq<mode>3 constraints [PR114783]
Date: Sat, 20 Apr 2024 00:22:15 +0200	[thread overview]
Message-ID: <ZiLul8ZwrxpxGY45@tucnak> (raw)

Hi!

The r14-4456 change (part of APX EGPR support) seems to have mistakenly
changed in the
@@ -16831,7 +16831,7 @@ (define_insn "*avx2_eq<mode>3"
   [(set (match_operand:VI_256 0 "register_operand" "=x")
        (eq:VI_256
          (match_operand:VI_256 1 "nonimmediate_operand" "%x")
-         (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
+         (match_operand:VI_256 2 "nonimmediate_operand" "jm")))]
   "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
   "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "ssecmp")
hunk the xm constraint to jm, while in many other spots it changed correctly
xm to xjm.  The instruction doesn't require the last operand to be in
memory, it can handle 3 256-bit registers just fine, just it is a VEX only
encoded instruction and so can't allow APX EGPR regs in the memory operand.

The following patch fixes it, so that we don't force one of the == operands
into memory all the time.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk as
obvious.

2024-04-20  Jakub Jelinek  <jakub@redhat.com>

	PR target/114783
	* config/i386/sse.md (*avx2_eq<mode>3): Change last operand's
	constraint from "jm" to "xjm".

	* gcc.target/i386/avx2-pr114783.c: New test.

--- gcc/config/i386/sse.md.jj	2024-04-10 09:55:05.849877708 +0200
+++ gcc/config/i386/sse.md	2024-04-19 19:37:34.110320387 +0200
@@ -17029,7 +17029,7 @@ (define_insn "*avx2_eq<mode>3"
   [(set (match_operand:VI_256 0 "register_operand" "=x")
 	(eq:VI_256
 	  (match_operand:VI_256 1 "nonimmediate_operand" "%x")
-	  (match_operand:VI_256 2 "nonimmediate_operand" "jm")))]
+	  (match_operand:VI_256 2 "nonimmediate_operand" "xjm")))]
   "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
   "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "ssecmp")
--- gcc/testsuite/gcc.target/i386/avx2-pr114783.c.jj	2024-04-19 19:28:50.216644029 +0200
+++ gcc/testsuite/gcc.target/i386/avx2-pr114783.c	2024-04-19 19:45:02.943054262 +0200
@@ -0,0 +1,12 @@
+/* PR target/114783 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2 -mno-avx512f -masm=att" } */
+/* { dg-final { scan-assembler "vpcmpeqd\[ \\t\]+%ymm\[01\], %ymm\[01\], %ymm0" } } */
+
+typedef int V __attribute__((vector_size (32)));
+
+V
+foo (V x, V y)
+{
+  return x == y;
+}

	Jakub


                 reply	other threads:[~2024-04-19 22:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=ZiLul8ZwrxpxGY45@tucnak \
    --to=jakub@redhat.com \
    --cc=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=lingling.kong@intel.com \
    /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).