public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109519] New: aarch64: wrong code with NEON intrinsics on gcc-10 and later
@ 2023-04-15 4:58 spop at gcc dot gnu.org
2023-04-15 5:06 ` [Bug target/109519] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: spop at gcc dot gnu.org @ 2023-04-15 4:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109519
Bug ID: 109519
Summary: aarch64: wrong code with NEON intrinsics on gcc-10 and
later
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: spop at gcc dot gnu.org
Target Milestone: ---
Steps to reproduce:
$ git clone https://github.com/sebpop/bitshuffle.git -b gcc-10-bug
$ cd bitshuffle/reproduce
$ make
$ ./a.out
The expected output is produced by gcc-7, gcc-9, and clang-15.
16384
4
14
16
33
39
45
51
57
67
102
108
120
126
128
134
138
140
[...]
gcc-9 is the last version of gcc I tested that works.
gcc-10 produces the following output:
./a.out
16384
0
0
0
0
39
45
51
57
gcc-11 and gcc-trunk produce the following output:
./a.out
16384
0
0
0
0
0
0
0
The output is also correct when removing the before-last patch from the git
repo https://github.com/kiyo-masui/bitshuffle/pull/140
This patch exposes the bug in gcc by using NEON intrinsics instead of scalar
computations to translate move_mask instructions from SSE2 to NEON.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/109519] aarch64: wrong code with NEON intrinsics on gcc-10 and later
2023-04-15 4:58 [Bug target/109519] New: aarch64: wrong code with NEON intrinsics on gcc-10 and later spop at gcc dot gnu.org
@ 2023-04-15 5:06 ` pinskia at gcc dot gnu.org
2023-04-15 5:11 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 5:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109519
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Are you 100% sure there is no aliasing issues here?
Especially with code like:
uint16_t *out_ui16 = (uint16_t*) &out_b[((7 - kk) * nbyte + ii) / 8];
*out_ui16 = ((uint16_t*)out)[kk];
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/109519] aarch64: wrong code with NEON intrinsics on gcc-10 and later
2023-04-15 4:58 [Bug target/109519] New: aarch64: wrong code with NEON intrinsics on gcc-10 and later spop at gcc dot gnu.org
2023-04-15 5:06 ` [Bug target/109519] " pinskia at gcc dot gnu.org
@ 2023-04-15 5:11 ` pinskia at gcc dot gnu.org
2023-04-15 5:17 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 5:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109519
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
And adding -fno-strict-aliasing fixes the issue too.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/109519] aarch64: wrong code with NEON intrinsics on gcc-10 and later
2023-04-15 4:58 [Bug target/109519] New: aarch64: wrong code with NEON intrinsics on gcc-10 and later spop at gcc dot gnu.org
2023-04-15 5:06 ` [Bug target/109519] " pinskia at gcc dot gnu.org
2023-04-15 5:11 ` pinskia at gcc dot gnu.org
@ 2023-04-15 5:17 ` pinskia at gcc dot gnu.org
2023-04-15 5:18 ` pinskia at gcc dot gnu.org
2023-04-15 13:41 ` spop at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 5:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109519
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes it is an aliasing issue with uint16_t there. Will attach a patch which
fixes that code in a second.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/109519] aarch64: wrong code with NEON intrinsics on gcc-10 and later
2023-04-15 4:58 [Bug target/109519] New: aarch64: wrong code with NEON intrinsics on gcc-10 and later spop at gcc dot gnu.org
` (2 preceding siblings ...)
2023-04-15 5:17 ` pinskia at gcc dot gnu.org
@ 2023-04-15 5:18 ` pinskia at gcc dot gnu.org
2023-04-15 13:41 ` spop at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 5:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109519
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 54863
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54863&action=edit
Patch to bitshuffle which fixes aliasing issues
Attached is the patch which forces to use a may_alias typedef for some uint16_t
to fix aliasing issues.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/109519] aarch64: wrong code with NEON intrinsics on gcc-10 and later
2023-04-15 4:58 [Bug target/109519] New: aarch64: wrong code with NEON intrinsics on gcc-10 and later spop at gcc dot gnu.org
` (3 preceding siblings ...)
2023-04-15 5:18 ` pinskia at gcc dot gnu.org
@ 2023-04-15 13:41 ` spop at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: spop at gcc dot gnu.org @ 2023-04-15 13:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109519
--- Comment #5 from Sebastian Pop <spop at gcc dot gnu.org> ---
Thanks Andrew for the patch, it fixes the issue.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-04-15 13:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-15 4:58 [Bug target/109519] New: aarch64: wrong code with NEON intrinsics on gcc-10 and later spop at gcc dot gnu.org
2023-04-15 5:06 ` [Bug target/109519] " pinskia at gcc dot gnu.org
2023-04-15 5:11 ` pinskia at gcc dot gnu.org
2023-04-15 5:17 ` pinskia at gcc dot gnu.org
2023-04-15 5:18 ` pinskia at gcc dot gnu.org
2023-04-15 13:41 ` spop 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).