This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
PowerPC `rlwinm' codegen bug
- To: egcs-bugs at cygnus dot com
- Subject: PowerPC `rlwinm' codegen bug
- From: Todd Vierling <tv at pobox dot com>
- Date: Tue, 5 Jan 1999 12:00:06 -0500 (EST)
Before I state this bug report, I'd like to ask if there is a set of the
egcs 1.1.1 codegen bug patches out there in a nice li'l repository. I have
seen codegen bug reports and patches go by, but until now, I didn't have a
reason to mind powerpc.
The following code snippet appears to generate bad code at the -O1
optimization level. At -O0 the code seems fine. I'm not a PowerPC expert,
but I can see from the data books that the generated assembly is bad (not to
mention thas gas bombs on the operand of `32').
Target configuration here is `powerpc-eabi'. This happens with or without
haifa.
If the snippet looks familiar, it should be: it's a simplified bit of stuff
from gcc/objc/sarray.h. :)
=====
unsigned int
soffset_decode(unsigned int index)
{
union {
struct {
unsigned int boffset : 16;
unsigned int eoffset : 16;
} off;
unsigned int idx;
} x;
x.idx = index;
return x.off.eoffset + (x.off.boffset * 32);
}
=====
The generated code with -O1:
=====
.file "sarray.i"
gcc2_compiled.:
.section ".text"
.align 2
.globl soffset_decode
.type soffset_decode,@function
soffset_decode:
rlwinm 0,3,0,0xffff
rlwinm 3,3,21,32,26 | this is the bad line (32)
add 3,0,3
blr
.Lfe1:
.size soffset_decode,.Lfe1-soffset_decode
.ident "GCC: (GNU) egcs-2.91.60 19981201 (egcs-1.1.1 release)"
=====
The generated code with -O0:
=====
.file "sarray.i"
gcc2_compiled.:
.section ".text"
.align 2
.globl soffset_decode
.type soffset_decode,@function
soffset_decode:
stwu 1,-32(1)
stw 31,28(1)
mr 31,1
stw 3,8(31)
lwz 0,8(31)
stw 0,12(31)
lhz 9,14(31)
rlwinm 0,9,0,0xffff
lhz 11,12(31)
rlwinm 9,11,0,0xffff
mr 11,9
slwi 9,11,5
add 0,0,9
mr 3,0
b .L1
.L1:
lwz 11,0(1)
lwz 31,-4(11)
mr 1,11
blr
.Lfe1:
.size soffset_decode,.Lfe1-soffset_decode
.ident "GCC: (GNU) egcs-2.91.60 19981201 (egcs-1.1.1 release)"
=====
--
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)