This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/32401] New: [PPC/Altivec] Non optimal code structure with -mabi=altivec
- From: "sparky at pld-linux dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jun 2007 13:06:31 -0000
- Subject: [Bug middle-end/32401] New: [PPC/Altivec] Non optimal code structure with -mabi=altivec
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
With altivec enabled gcc prepares additional space on the stack. Unlike earlier
versions gcc 4.3 removes stack modification instructions if it isn't used. With
just -maltivec or with -mabi=altivec when altivec isn't used it works very
well. But with -mabi=altivec and altivec used gcc produces code with stucture
similar to one produced by eariler gcc versions with just stack modification
instructions removed. Seems like stack isn't optimized early enough.
This simple code:
void
test ( int len )
{
if (len) {
vector unsigned char vSetTo = {};
asm volatile ("" : : "v" (vSetTo) ); /* do something */
}
}
"gcc-4.3 -O2 -maltivec -mregnames test.c -S" produces:
test:
cmpwi %cr7,%r3,0
beqlr- %cr7
vxor %v0,%v0,%v0
blr
while "gcc-4.3 -O2 -maltivec -mabi=altivec -mregnames test.c -S" produces:
test:
cmpwi %cr7,%r3,0
beq- %cr7,.L3 # <-- should be beqlr
vxor %v0,%v0,%v0
.L3:
blr
The letter one has same structure as produced by earlier gcc versions, but
without stack modification instructions:
gcc 4.1.3 produces:
test:
cmpwi %cr7,%r3,0
stwu %r1,-16(%r1)
vxor %v0,%v0,%v0
beq- %cr7,.L4
.L4:
addi %r1,%r1,16
blr
--
Summary: [PPC/Altivec] Non optimal code structure with -
mabi=altivec
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sparky at pld-linux dot org
GCC build triplet: powerpc*-linux
GCC host triplet: powerpc*-linux
GCC target triplet: powerpc*-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32401