public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
@ 2010-09-08 16:08 ` greened at obbligato dot org
2010-09-08 16:09 ` greened at obbligato dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: greened at obbligato dot org @ 2010-09-08 16:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from greened at obbligato dot org 2010-09-08 16:08 -------
Compile with -c -mavx reduced.c.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/45600] New: gcc generates illegal AVX aligned moves
@ 2010-09-08 16:08 greened at obbligato dot org
2010-09-08 16:08 ` [Bug c/45600] " greened at obbligato dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: greened at obbligato dot org @ 2010-09-08 16:08 UTC (permalink / raw)
To: gcc-bugs
For the attached testcase, gcc generates a vmovapd for the store to
llvm_cbe__24__StackDv_P53. The latest Intel sde generates an alignment error:
SDE ERROR: ALIGN32 FAILED PC=40048b MEMEA=7ffffff057d0 vmovapd ymmword ptr
[rax], ymm0
It looks like gcc is considering 16-byte aligned data to be suitable for a
256-bit vmovapd, which it isn't.
--
Summary: gcc generates illegal AVX aligned moves
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: greened at obbligato dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
2010-09-08 16:08 ` [Bug c/45600] " greened at obbligato dot org
@ 2010-09-08 16:09 ` greened at obbligato dot org
2010-09-08 17:40 ` [Bug target/45600] " pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: greened at obbligato dot org @ 2010-09-08 16:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from greened at obbligato dot org 2010-09-08 16:09 -------
Created an attachment (id=21740)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21740&action=view)
Reduced testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
2010-09-08 16:08 ` [Bug c/45600] " greened at obbligato dot org
2010-09-08 16:09 ` greened at obbligato dot org
@ 2010-09-08 17:40 ` pinskia at gcc dot gnu dot org
2010-09-08 17:43 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-08 17:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2010-09-08 17:39 -------
I think this code is undefined with respect of alignment requirements.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
` (2 preceding siblings ...)
2010-09-08 17:40 ` [Bug target/45600] " pinskia at gcc dot gnu dot org
@ 2010-09-08 17:43 ` pinskia at gcc dot gnu dot org
2010-09-08 18:52 ` greened at obbligato dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-08 17:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2010-09-08 17:43 -------
Yes this is invalid with respect of alignment requirements.
It becomes obvious from the optimized at -O0 on the trunk.
v4df llvm_cbe_r5585;
v4df llvm_cbe_r5584;
struct l_DV1 llvm_cbe__24__StackDv_P53;
unsigned int * D.3215;
struct l_DV1 * llvm_cbe__24__StackDv_P53.0;
<bb 2>:
llvm_cbe__24__StackDv_P53.0_1 = &llvm_cbe__24__StackDv_P53;
MEM[(v4df *)llvm_cbe__24__StackDv_P53.0_1] = llvm_cbe_r5584_2(D); // requires
v4df alignment
D.3215_3 = &llvm_cbe__24__StackDv_P53.field1.field5;
MEM[(struct *)D.3215_3].data = llvm_cbe_r5585_4(D); // requires v4df
alignment
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
` (3 preceding siblings ...)
2010-09-08 17:43 ` pinskia at gcc dot gnu dot org
@ 2010-09-08 18:52 ` greened at obbligato dot org
2010-09-08 18:55 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: greened at obbligato dot org @ 2010-09-08 18:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from greened at obbligato dot org 2010-09-08 18:52 -------
Why is the code undefined? Can you explain in terms of the original test
source? I don't immediately see anything undefined there.
--
greened at obbligato dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |greened at obbligato dot org
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
` (4 preceding siblings ...)
2010-09-08 18:52 ` greened at obbligato dot org
@ 2010-09-08 18:55 ` pinskia at gcc dot gnu dot org
2010-09-08 18:58 ` greened at obbligato dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-08 18:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2010-09-08 18:55 -------
The alignment of llvm_cbe__24__StackDv_P53 is only 64bits so you are casting to
a greater aligned type and then dereferencing it.
That being said, the LLVM C back-end produces crazy c code that is also
undefined because of aliasing.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
` (5 preceding siblings ...)
2010-09-08 18:55 ` pinskia at gcc dot gnu dot org
@ 2010-09-08 18:58 ` greened at obbligato dot org
2010-09-08 19:00 ` greened at obbligato dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: greened at obbligato dot org @ 2010-09-08 18:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from greened at obbligato dot org 2010-09-08 18:58 -------
(In reply to comment #5)
> Why is the code undefined? Can you explain in terms of the original test
> source? I don't immediately see anything undefined there.
Ah, the cast from int field5 to v4df? Yes, that doesn't look right to me. Is
this what you're talking about?
It seems to me that gcc should emit a warning about this and/or not assume that
&field5 is aligned to 32 bytes, as there is nothing in the source specifying
such alignment.
If it's an illegal program, gcc should at least emit a warning, if not an
error.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
` (6 preceding siblings ...)
2010-09-08 18:58 ` greened at obbligato dot org
@ 2010-09-08 19:00 ` greened at obbligato dot org
2010-09-08 19:01 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: greened at obbligato dot org @ 2010-09-08 19:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from greened at obbligato dot org 2010-09-08 18:59 -------
(In reply to comment #6)
> The alignment of llvm_cbe__24__StackDv_P53 is only 64bits so you are casting to
> a greater aligned type and then dereferencing it.
I didn't know that typing something as a vector guaranteed alignment. I don't
see anything in the gcc manual about that. Isn't that why we have
__attribute(aligned())__?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
` (8 preceding siblings ...)
2010-09-08 19:01 ` pinskia at gcc dot gnu dot org
@ 2010-09-08 19:01 ` pinskia at gcc dot gnu dot org
2010-09-08 19:16 ` greened at obbligato dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-08 19:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from pinskia at gcc dot gnu dot org 2010-09-08 19:01 -------
>If it's an illegal program, gcc should at least emit a warning, if not an
error.
It is not an invalid program, it is just undefined at runtime. There was a
defect report against the C standard asking if a diagnostic can be required for
undefined behavior and it was rejected. Oh there is a patch to enable warnings
for this case already.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
` (7 preceding siblings ...)
2010-09-08 19:00 ` greened at obbligato dot org
@ 2010-09-08 19:01 ` pinskia at gcc dot gnu dot org
2010-09-08 19:01 ` pinskia at gcc dot gnu dot org
2010-09-08 19:16 ` greened at obbligato dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-08 19:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pinskia at gcc dot gnu dot org 2010-09-08 19:01 -------
vector types are naturally aligned just like integer types. That is they are
aligned on their size.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/45600] gcc generates illegal AVX aligned moves
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
` (9 preceding siblings ...)
2010-09-08 19:01 ` pinskia at gcc dot gnu dot org
@ 2010-09-08 19:16 ` greened at obbligato dot org
10 siblings, 0 replies; 12+ messages in thread
From: greened at obbligato dot org @ 2010-09-08 19:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from greened at obbligato dot org 2010-09-08 19:16 -------
(In reply to comment #9)
> >If it's an illegal program, gcc should at least emit a warning, if not an
> error.
>
>
> It is not an invalid program,
Yes, you are quite right. I will take this up with the LLVM folks. :)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45600
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-09-08 19:16 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-08 16:08 [Bug c/45600] New: gcc generates illegal AVX aligned moves greened at obbligato dot org
2010-09-08 16:08 ` [Bug c/45600] " greened at obbligato dot org
2010-09-08 16:09 ` greened at obbligato dot org
2010-09-08 17:40 ` [Bug target/45600] " pinskia at gcc dot gnu dot org
2010-09-08 17:43 ` pinskia at gcc dot gnu dot org
2010-09-08 18:52 ` greened at obbligato dot org
2010-09-08 18:55 ` pinskia at gcc dot gnu dot org
2010-09-08 18:58 ` greened at obbligato dot org
2010-09-08 19:00 ` greened at obbligato dot org
2010-09-08 19:01 ` pinskia at gcc dot gnu dot org
2010-09-08 19:01 ` pinskia at gcc dot gnu dot org
2010-09-08 19:16 ` greened at obbligato dot 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).