public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/35866] New: Vector load/store from a packed struct does not work (without -mstrict-align)
@ 2008-04-08 2:00 pinskia at gcc dot gnu dot org
2008-04-08 2:01 ` [Bug target/35866] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-08 2:00 UTC (permalink / raw)
To: gcc-bugs
Testcase:
#define vector __attribute__((vector_size(16) ))
#pragma pack(push, r1, 1)
struct a
{
char t;
vector float f;
};
#pragma pack(push, r1, 1)
vector float f(struct a * b, vector float a)
{
return b->f = a;
}
---- CUT ---
We use directly a stvx instruction here and this will store in the incorrect
position.
--
Summary: Vector load/store from a packed struct does not work
(without -mstrict-align)
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc*-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35866
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/35866] Vector load/store from a packed struct does not work (without -mstrict-align)
2008-04-08 2:00 [Bug target/35866] New: Vector load/store from a packed struct does not work (without -mstrict-align) pinskia at gcc dot gnu dot org
@ 2008-04-08 2:01 ` pinskia at gcc dot gnu dot org
2008-04-08 2:05 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-08 2:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-04-08 02:00 -------
(In reply to comment #0)
> We use directly a stvx instruction here and this will store in the incorrect
> position.
as stvx masks out the lower bits for a 16byte aligned address.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|4.3.0 |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35866
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/35866] Vector load/store from a packed struct does not work (without -mstrict-align)
2008-04-08 2:00 [Bug target/35866] New: Vector load/store from a packed struct does not work (without -mstrict-align) pinskia at gcc dot gnu dot org
2008-04-08 2:01 ` [Bug target/35866] " pinskia at gcc dot gnu dot org
@ 2008-04-08 2:05 ` pinskia at gcc dot gnu dot org
2008-04-10 0:16 ` joseph at codesourcery dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-08 2:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-04-08 02:04 -------
With -mstrict-align, we get the correct (but suboptimal) answer as the
middle-end knows that load and stores cannot handled unaligned addresses.
I think we need more flexible TARGET_STRICT_ALIGN which is based on a mode
rather than just true or false.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35866
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/35866] Vector load/store from a packed struct does not work (without -mstrict-align)
2008-04-08 2:00 [Bug target/35866] New: Vector load/store from a packed struct does not work (without -mstrict-align) pinskia at gcc dot gnu dot org
2008-04-08 2:01 ` [Bug target/35866] " pinskia at gcc dot gnu dot org
2008-04-08 2:05 ` pinskia at gcc dot gnu dot org
@ 2008-04-10 0:16 ` joseph at codesourcery dot com
2008-05-09 3:15 ` froydnj at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: joseph at codesourcery dot com @ 2008-04-10 0:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from joseph at codesourcery dot com 2008-04-10 00:15 -------
Subject: Re: Vector load/store from a packed struct does
not work (without -mstrict-align)
On Tue, 8 Apr 2008, pinskia at gcc dot gnu dot org wrote:
> With -mstrict-align, we get the correct (but suboptimal) answer as the
> middle-end knows that load and stores cannot handled unaligned addresses.
>
> I think we need more flexible TARGET_STRICT_ALIGN which is based on a mode
> rather than just true or false.
E500 has much the same problem and so is treated as a -mstrict-align CPU,
with all the associated suboptimal code generation (strict alignment only
being required for E500 instructions, not for most core instructions).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35866
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/35866] Vector load/store from a packed struct does not work (without -mstrict-align)
2008-04-08 2:00 [Bug target/35866] New: Vector load/store from a packed struct does not work (without -mstrict-align) pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-04-10 0:16 ` joseph at codesourcery dot com
@ 2008-05-09 3:15 ` froydnj at gcc dot gnu dot org
2008-07-30 15:34 ` froydnj at gcc dot gnu dot org
2010-02-09 17:51 ` froydnj at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: froydnj at gcc dot gnu dot org @ 2008-05-09 3:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from froydnj at gcc dot gnu dot org 2008-05-09 03:14 -------
If I understand correctly, one would just need to add vector modes with
appropriate alignment restrictions to SLOW_UNALIGNED_ACCESS. If I add an extra
|| (((MODE) == V4SFmode || (MODE) == V2DFmode) && (ALIGN) < 128)
to SLOW_UNALIGNED_ACCESS, and compile without -mstrict-align, I get
semi-reasonable looking code at -O2:
f:
stwu 1,-48(1)
addi 9,1,16
stw 28,32(1)
stw 29,36(1)
stvx 2,0,9
lwz 8,12(9)
lwz 5,0(9)
lwz 6,4(9)
mr 0,8
lwz 7,8(9)
stw 8,13(3)
addi 8,1,16
stw 5,1(3)
stw 7,9(3)
stw 6,5(3)
stw 5,0(8)
stw 6,4(8)
stw 7,8(8)
stw 0,12(8)
lvx 2,0,8
lwz 28,32(1)
lwz 29,36(1)
addi 1,1,48
blr
It could be improved, but it's a lot better than -mstrict-align code.
--
froydnj at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |froydnj at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35866
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/35866] Vector load/store from a packed struct does not work (without -mstrict-align)
2008-04-08 2:00 [Bug target/35866] New: Vector load/store from a packed struct does not work (without -mstrict-align) pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-05-09 3:15 ` froydnj at gcc dot gnu dot org
@ 2008-07-30 15:34 ` froydnj at gcc dot gnu dot org
2010-02-09 17:51 ` froydnj at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: froydnj at gcc dot gnu dot org @ 2008-07-30 15:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from froydnj at gcc dot gnu dot org 2008-07-30 15:32 -------
Subject: Bug 35866
Author: froydnj
Date: Wed Jul 30 15:30:59 2008
New Revision: 138316
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138316
Log:
PR target/35866
* config/rs6000/rs6000.h (SLOW_UNALIGNED_ACCESS): Add clause for
vector modes.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.h
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35866
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/35866] Vector load/store from a packed struct does not work (without -mstrict-align)
2008-04-08 2:00 [Bug target/35866] New: Vector load/store from a packed struct does not work (without -mstrict-align) pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-07-30 15:34 ` froydnj at gcc dot gnu dot org
@ 2010-02-09 17:51 ` froydnj at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: froydnj at gcc dot gnu dot org @ 2010-02-09 17:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from froydnj at gcc dot gnu dot org 2010-02-09 17:51 -------
Declaring this one fixed, somewhat late.
--
froydnj at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35866
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-02-09 17:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-08 2:00 [Bug target/35866] New: Vector load/store from a packed struct does not work (without -mstrict-align) pinskia at gcc dot gnu dot org
2008-04-08 2:01 ` [Bug target/35866] " pinskia at gcc dot gnu dot org
2008-04-08 2:05 ` pinskia at gcc dot gnu dot org
2008-04-10 0:16 ` joseph at codesourcery dot com
2008-05-09 3:15 ` froydnj at gcc dot gnu dot org
2008-07-30 15:34 ` froydnj at gcc dot gnu dot org
2010-02-09 17:51 ` froydnj at gcc dot gnu 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).