public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/110227] New: gcc generates invalid AVX-512 code
@ 2023-06-12 14:47 joseph.weening at gmail dot com
2023-06-12 14:51 ` [Bug target/110227] " joseph.weening at gmail dot com
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: joseph.weening at gmail dot com @ 2023-06-12 14:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
Bug ID: 110227
Summary: gcc generates invalid AVX-512 code
Product: gcc
Version: 13.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: joseph.weening at gmail dot com
Target Milestone: ---
gcc version 13.1.0 (GCC)
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-13.1.0/configure --prefix=/usr/local/gcc/13.1.0
--disable-multilib --enable-languages=c,c++,fortran
--with-gmp=/usr/local/gmp/6.2.1 --with-mpc=/usr/local/mpc/1.3.1
--with-mpfr=/usr/local/mpfr/4.2.0 --with-isl=/usr/local/isl/0.24
The following program generates an error:
/tmp/ccAuHFqz.s: Assembler messages:
/tmp/ccAuHFqz.s:28: Error: unsupported instruction `vpcmpeqd'
The assembly code contains
vpcmpeqd %xmm16, %xmm16, %xmm16
which perhaps is invalid for xmm registers above 15.
#include <immintrin.h>
__attribute__((noinline))
static void vswap(int32_t *x) {
__m256i x0 = _mm256_loadu_si256((__m256i *) (&x[0]));
__m256i x1 = _mm256_loadu_si256((__m256i *) (&x[1]));
_mm256_storeu_si256((__m256i *) (&x[0]),(x1));
_mm256_storeu_si256((__m256i *) (&x[1]),(x0));
}
void vproc(int32_t *x) {
for (int32_t p=4; p>=1; p>>=1) {
if (p == 4) {
__m256i mask = _mm256_set_epi32(0, 0, 0, 0, -1, -1, -1, -1);
__m256i x0 = _mm256_loadu_si256((__m256i *) (&x[0]));
x0 = _mm256_xor_si256(x0, mask);
_mm256_storeu_si256((__m256i *) (&x[0]),(x0));
}
vswap(x);
}
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
@ 2023-06-12 14:51 ` joseph.weening at gmail dot com
2023-06-12 15:43 ` [Bug target/110227] [13/14 Regression] " pinskia at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: joseph.weening at gmail dot com @ 2023-06-12 14:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
--- Comment #1 from Joe Weening <joseph.weening at gmail dot com> ---
Sorry, forgot to include the command line:
$ gcc -march=cooperlake -O3 -c bug.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] [13/14 Regression] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
2023-06-12 14:51 ` [Bug target/110227] " joseph.weening at gmail dot com
@ 2023-06-12 15:43 ` pinskia at gcc dot gnu.org
2023-06-13 3:06 ` crazylht at gmail dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-12 15:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.2
Last reconfirmed| |2023-06-12
Ever confirmed|0 |1
Summary|gcc generates invalid |[13/14 Regression] gcc
|AVX-512 code |generates invalid AVX-512
| |code
Status|UNCONFIRMED |NEW
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Semi-Reduced testcase:
```
#include <immintrin.h>
void f()
{
__m256i mask = _mm256_set_epi32(0, 0, 0, 0, -1, -1, -1, -1);
register __m256i reg asm("xmm16") = mask;
asm(""::"v"(reg));
}
```
Most likely introduced by r13-2804-ga282f086ef26d9 .
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] [13/14 Regression] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
2023-06-12 14:51 ` [Bug target/110227] " joseph.weening at gmail dot com
2023-06-12 15:43 ` [Bug target/110227] [13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-06-13 3:06 ` crazylht at gmail dot com
2023-06-13 11:41 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-06-13 3:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> Semi-Reduced testcase:
> ```
> #include <immintrin.h>
>
> void f()
> {
> __m256i mask = _mm256_set_epi32(0, 0, 0, 0, -1, -1, -1, -1);
> register __m256i reg asm("xmm16") = mask;
> asm(""::"v"(reg));
> }
> ```
>
> Most likely introduced by r13-2804-ga282f086ef26d9 .
(define_insn "mov<mode>_internal"
[(set (match_operand:VMOVE 0 "nonimmediate_operand"
- "=v,v ,v ,m")
+ "=v,v ,v,v ,m")
(match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand"
- " C,<sseconstm1>,vm,v"))]
+ " C,<sseconstm1>,BH,vm,v"))]
We need to use "x" instead of "v".
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] [13/14 Regression] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
` (2 preceding siblings ...)
2023-06-13 3:06 ` crazylht at gmail dot com
@ 2023-06-13 11:41 ` jakub at gcc dot gnu.org
2023-06-13 13:55 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-06-13 11:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Looking at that commit, it also introduced weird formatting:
return "vpcmpeqd \t %t0, %t0, %t0";
and
return "vpcmpeqd \t %x0, %x0, %x0";
and
return "vpcmpeqd \t %x0, %x0, %x0";
definitely shouldn't have the spaces around \t on either side.
But sure, agree the alternative with BH constraint on source should use x
rather than
v constraint on destination.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] [13/14 Regression] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
` (3 preceding siblings ...)
2023-06-13 11:41 ` jakub at gcc dot gnu.org
@ 2023-06-13 13:55 ` rguenth at gcc dot gnu.org
2023-06-14 8:19 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-13 13:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] [13/14 Regression] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
` (4 preceding siblings ...)
2023-06-13 13:55 ` rguenth at gcc dot gnu.org
@ 2023-06-14 8:19 ` cvs-commit at gcc dot gnu.org
2023-06-14 8:20 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-14 8:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:
https://gcc.gnu.org/g:b7e42b85212e03eb59193a712eb523f26911a581
commit r14-1802-gb7e42b85212e03eb59193a712eb523f26911a581
Author: liuhongt <hongtao.liu@intel.com>
Date: Tue Jun 13 14:20:59 2023 +0800
Use x instead of v for alternative 2 (v, BH) in mov<mode>_internal.
Since there's no evex version for vpcmpeq ymm, ymm, ymm.
gcc/ChangeLog:
PR target/110227
* config/i386/sse.md (mov<mode>_internal>): Use x instead of v
for alternative 2 since there's no evex version for vpcmpeqd
ymm, ymm, ymm.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr110227.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] [13/14 Regression] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
` (5 preceding siblings ...)
2023-06-14 8:19 ` cvs-commit at gcc dot gnu.org
@ 2023-06-14 8:20 ` cvs-commit at gcc dot gnu.org
2023-06-14 8:21 ` crazylht at gmail dot com
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-14 8:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by hongtao Liu
<liuhongt@gcc.gnu.org>:
https://gcc.gnu.org/g:66f8f9b35f0499cf54b8a432fbe5f645ad1c523a
commit r13-7445-g66f8f9b35f0499cf54b8a432fbe5f645ad1c523a
Author: liuhongt <hongtao.liu@intel.com>
Date: Tue Jun 13 14:20:59 2023 +0800
Use x instead of v for alternative 2 (v, BH) in mov<mode>_internal.
Since there's no evex version for vpcmpeq ymm, ymm, ymm.
gcc/ChangeLog:
PR target/110227
* config/i386/sse.md (mov<mode>_internal>): Use x instead of v
for alternative 2 since there's no evex version for vpcmpeqd
ymm, ymm, ymm.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr110227.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] [13/14 Regression] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
` (6 preceding siblings ...)
2023-06-14 8:20 ` cvs-commit at gcc dot gnu.org
@ 2023-06-14 8:21 ` crazylht at gmail dot com
2023-07-27 9:26 ` rguenth at gcc dot gnu.org
2023-11-30 10:54 ` liuhongt at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-06-14 8:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
--- Comment #7 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed for GCC14 and GCC13.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] [13/14 Regression] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
` (7 preceding siblings ...)
2023-06-14 8:21 ` crazylht at gmail dot com
@ 2023-07-27 9:26 ` rguenth at gcc dot gnu.org
2023-11-30 10:54 ` liuhongt at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27 9:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|13.2 |13.3
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/110227] [13/14 Regression] gcc generates invalid AVX-512 code
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
` (8 preceding siblings ...)
2023-07-27 9:26 ` rguenth at gcc dot gnu.org
@ 2023-11-30 10:54 ` liuhongt at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2023-11-30 10:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110227
liuhongt at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |liuhongt at gcc dot gnu.org
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #9 from liuhongt at gcc dot gnu.org ---
.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-11-30 10:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 14:47 [Bug target/110227] New: gcc generates invalid AVX-512 code joseph.weening at gmail dot com
2023-06-12 14:51 ` [Bug target/110227] " joseph.weening at gmail dot com
2023-06-12 15:43 ` [Bug target/110227] [13/14 Regression] " pinskia at gcc dot gnu.org
2023-06-13 3:06 ` crazylht at gmail dot com
2023-06-13 11:41 ` jakub at gcc dot gnu.org
2023-06-13 13:55 ` rguenth at gcc dot gnu.org
2023-06-14 8:19 ` cvs-commit at gcc dot gnu.org
2023-06-14 8:20 ` cvs-commit at gcc dot gnu.org
2023-06-14 8:21 ` crazylht at gmail dot com
2023-07-27 9:26 ` rguenth at gcc dot gnu.org
2023-11-30 10:54 ` liuhongt 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).