public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114783] New: [14 Regression] Equality compares of vector builtins spill one operand to the stack
@ 2024-04-19 16:47 mkretz at gcc dot gnu.org
  2024-04-19 17:02 ` [Bug target/114783] " jakub at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-04-19 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114783
           Summary: [14 Regression] Equality compares of vector builtins
                    spill one operand to the stack
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mkretz at gcc dot gnu.org
  Target Milestone: ---
            Target: x86_64-*-*, i?86-*-*

Testcase:

https://compiler-explorer.com/z/Y1aTj7Mv9

using V [[gnu::vector_size(32)]] = int;

auto f(V x, V y)
{
  return x == y;
}

auto h(V x, V y)
{
  return x <= y;
}

Compile with -O2 -march=skylake.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/114783] [14 Regression] Equality compares of vector builtins spill one operand to the stack
  2024-04-19 16:47 [Bug target/114783] New: [14 Regression] Equality compares of vector builtins spill one operand to the stack mkretz at gcc dot gnu.org
@ 2024-04-19 17:02 ` jakub at gcc dot gnu.org
  2024-04-19 17:14 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-19 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-04-19
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |14.0
     Ever confirmed|0                           |1
           Priority|P3                          |P1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r14-4459-gd77ee4a7f7a80596d91b53c06946ac215614e6c4 or so
( r14-4453-gccdc0f0fcf6f240d5c4f059e6f38547a0cca9723 still emitted the 13 code,
and
I don't have the revisions in between in the seed, maybe they failed to
build?).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/114783] [14 Regression] Equality compares of vector builtins spill one operand to the stack
  2024-04-19 16:47 [Bug target/114783] New: [14 Regression] Equality compares of vector builtins spill one operand to the stack mkretz at gcc dot gnu.org
  2024-04-19 17:02 ` [Bug target/114783] " jakub at gcc dot gnu.org
@ 2024-04-19 17:14 ` jakub at gcc dot gnu.org
  2024-04-19 17:18 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-19 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
@@ -16831,7 +16882,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")

That looks like it was supposed to be xjm.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/114783] [14 Regression] Equality compares of vector builtins spill one operand to the stack
  2024-04-19 16:47 [Bug target/114783] New: [14 Regression] Equality compares of vector builtins spill one operand to the stack mkretz at gcc dot gnu.org
  2024-04-19 17:02 ` [Bug target/114783] " jakub at gcc dot gnu.org
  2024-04-19 17:14 ` jakub at gcc dot gnu.org
@ 2024-04-19 17:18 ` jakub at gcc dot gnu.org
  2024-04-19 17:48 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-19 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/114783] [14 Regression] Equality compares of vector builtins spill one operand to the stack
  2024-04-19 16:47 [Bug target/114783] New: [14 Regression] Equality compares of vector builtins spill one operand to the stack mkretz at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-04-19 17:18 ` jakub at gcc dot gnu.org
@ 2024-04-19 17:48 ` jakub at gcc dot gnu.org
  2024-04-19 22:19 ` cvs-commit at gcc dot gnu.org
  2024-04-19 22:25 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-19 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57991
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57991&action=edit
gcc14-pr114783.patch

Full untested patch.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/114783] [14 Regression] Equality compares of vector builtins spill one operand to the stack
  2024-04-19 16:47 [Bug target/114783] New: [14 Regression] Equality compares of vector builtins spill one operand to the stack mkretz at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-04-19 17:48 ` jakub at gcc dot gnu.org
@ 2024-04-19 22:19 ` cvs-commit at gcc dot gnu.org
  2024-04-19 22:25 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-19 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:c23db3ebb65ba357155be85ef56d037403eaee36

commit r14-10047-gc23db3ebb65ba357155be85ef56d037403eaee36
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Apr 20 00:13:49 2024 +0200

    i386: Fix up *avx2_eq<mode>3 constraints [PR114783]

    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.

    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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/114783] [14 Regression] Equality compares of vector builtins spill one operand to the stack
  2024-04-19 16:47 [Bug target/114783] New: [14 Regression] Equality compares of vector builtins spill one operand to the stack mkretz at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-04-19 22:19 ` cvs-commit at gcc dot gnu.org
@ 2024-04-19 22:25 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-19 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-19 22:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19 16:47 [Bug target/114783] New: [14 Regression] Equality compares of vector builtins spill one operand to the stack mkretz at gcc dot gnu.org
2024-04-19 17:02 ` [Bug target/114783] " jakub at gcc dot gnu.org
2024-04-19 17:14 ` jakub at gcc dot gnu.org
2024-04-19 17:18 ` jakub at gcc dot gnu.org
2024-04-19 17:48 ` jakub at gcc dot gnu.org
2024-04-19 22:19 ` cvs-commit at gcc dot gnu.org
2024-04-19 22:25 ` jakub at gcc dot gnu.org

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).