public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/32107] New: bad codegen for vector initialization in Altivec
@ 2007-05-27 21:14 dorit at il dot ibm dot com
2007-05-27 21:31 ` [Bug target/32107] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: dorit at il dot ibm dot com @ 2007-05-27 21:14 UTC (permalink / raw)
To: gcc-bugs
Compiling the folloxing testcase:
#define vector __attribute__((__vector_size__(16) ))
float fa[100] __attribute__ ((__aligned__(16)));
vector float foo ()
{
float f = fa[0];
vector float vf = {f, f, f, f};
return vf;
}
...with gcc -O2 -maltivec, we get:
ld r9,0(r2)
lfs f0,0(r9)
addi r9,r1,-16
stfs f0,-16(r1)
lvewx v2,r0,r9
vspltw v2,v2,0
blr
My problem is with the {lfs,stfs,lvewx} sequence: we load a value into f0, and
then store it (with stfs) into an aligned memory location, so that it could be
loaded from there into a vector (with lvewx). However, since the address from
which f0 was loaded is known to be aligned, we could directly do an lvewx from
there, and avoid the extra {lfs,stfs}, so the following should be enough:
ld r9,0(r2)
lvewx v2,r0,r9
vspltw v2,v2,0
blr
The problem is that rs6000_expand_vector_init doesn't know that f0 is
originated from an aligned address. It gets the following as vals:
(parallel:V4SF [
(reg/v:SF 119 [ f ])
(reg/v:SF 119 [ f ])
(reg/v:SF 119 [ f ])
(reg/v:SF 119 [ f ])
])
We somehow want to expand 'f = fa[0]' and '{f,f,f,f}' together... if
expand_vector_init could get this as vals: '{fa[0],fa[0],fa[0],fa[0]}', it
could see that the original address is aligned.
Alternatively, the prospects of getting rid of the redundant load and store
later on during some kind of a peephole optimization don't seem so high to
me... Thoughts?
This may be related to PR31334 (though there the issue is about initialization
with constants, so I'm not sure if the idea for a solution proposed there would
help us here).
--
Summary: bad codegen for vector initialization in Altivec
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dorit at il dot ibm dot com
GCC build triplet: powerpc-linux
GCC host triplet: powerpc-linux
GCC target triplet: powerpc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32107
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/32107] bad codegen for vector initialization in Altivec
2007-05-27 21:14 [Bug target/32107] New: bad codegen for vector initialization in Altivec dorit at il dot ibm dot com
@ 2007-05-27 21:31 ` pinskia at gcc dot gnu dot org
2008-03-11 21:35 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-27 21:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-05-27 21:31 -------
This is unrelated to that one. Even if we did not have an aligned address, we
can do better than the extra load/store (but I forget how to do this and I did
not write anything on this for vec_splats in the C/C++ language extension for
the Cell).
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-05-27 21:31:45
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32107
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/32107] bad codegen for vector initialization in Altivec
2007-05-27 21:14 [Bug target/32107] New: bad codegen for vector initialization in Altivec dorit at il dot ibm dot com
2007-05-27 21:31 ` [Bug target/32107] " pinskia at gcc dot gnu dot org
@ 2008-03-11 21:35 ` pinskia at gcc dot gnu dot org
2008-03-11 21:36 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-11 21:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-03-11 21:34 -------
Mine. The patches which I have from the PS3 toolchain fixes this one, it is
related to PR 32110 also.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32107
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/32107] bad codegen for vector initialization in Altivec
2007-05-27 21:14 [Bug target/32107] New: bad codegen for vector initialization in Altivec dorit at il dot ibm dot com
2007-05-27 21:31 ` [Bug target/32107] " pinskia at gcc dot gnu dot org
2008-03-11 21:35 ` pinskia at gcc dot gnu dot org
@ 2008-03-11 21:36 ` pinskia at gcc dot gnu dot org
2008-07-14 12:48 ` pinskia at gcc dot gnu dot org
2009-04-26 7:30 ` eres at il dot ibm dot com
4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-11 21:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-03-11 21:35 -------
Mine, I said.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32107
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/32107] bad codegen for vector initialization in Altivec
2007-05-27 21:14 [Bug target/32107] New: bad codegen for vector initialization in Altivec dorit at il dot ibm dot com
` (2 preceding siblings ...)
2008-03-11 21:36 ` pinskia at gcc dot gnu dot org
@ 2008-07-14 12:48 ` pinskia at gcc dot gnu dot org
2009-04-26 7:30 ` eres at il dot ibm dot com
4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-07-14 12:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2008-07-14 12:47 -------
Note with the Cell, we can just use lvlx with a splat and that works without an
alignment attribute on fa :).
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|powerpc-linux |
GCC host triplet|powerpc-linux |
GCC target triplet|powerpc-linux |powerpc*-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32107
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/32107] bad codegen for vector initialization in Altivec
2007-05-27 21:14 [Bug target/32107] New: bad codegen for vector initialization in Altivec dorit at il dot ibm dot com
` (3 preceding siblings ...)
2008-07-14 12:48 ` pinskia at gcc dot gnu dot org
@ 2009-04-26 7:30 ` eres at il dot ibm dot com
4 siblings, 0 replies; 7+ messages in thread
From: eres at il dot ibm dot com @ 2009-04-26 7:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from eres at il dot ibm dot com 2009-04-26 07:29 -------
(In reply to comment #2)
> Mine. The patches which I have from the PS3 toolchain fixes this one, it is
> related to PR 32110 also.
I see this problem still exits on trunk -r146794.
If you still have the patch I will be happy to test it.
--
eres at il dot ibm dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |eres at il dot ibm dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32107
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/32107] bad codegen for vector initialization in Altivec
[not found] <bug-32107-4@http.gcc.gnu.org/bugzilla/>
@ 2011-11-17 22:04 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-11-17 22:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32107
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
AssignedTo|pinskia at gcc dot gnu.org |unassigned at gcc dot
| |gnu.org
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-11-17 21:59:57 UTC ---
No longer working on this.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-11-17 22:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-27 21:14 [Bug target/32107] New: bad codegen for vector initialization in Altivec dorit at il dot ibm dot com
2007-05-27 21:31 ` [Bug target/32107] " pinskia at gcc dot gnu dot org
2008-03-11 21:35 ` pinskia at gcc dot gnu dot org
2008-03-11 21:36 ` pinskia at gcc dot gnu dot org
2008-07-14 12:48 ` pinskia at gcc dot gnu dot org
2009-04-26 7:30 ` eres at il dot ibm dot com
[not found] <bug-32107-4@http.gcc.gnu.org/bugzilla/>
2011-11-17 22:04 ` pinskia 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).