This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/33404] Predictive commoning + ivopts possibly introducing extra sign extensions.
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jul 2008 01:55:25 -0000
- Subject: [Bug tree-optimization/33404] Predictive commoning + ivopts possibly introducing extra sign extensions.
- References: <bug-33404-14766@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-07-23 01:55 -------
Hmm, I think the sign/zero extension is needed.
Even doing:
void fred(unsigned short in, unsigned short *out1)
{
int i;
for (i=0;i<100;i++)
out1[i+1] = out1[i]*in;
}
--- CUT ---
We will get a zero extension in the assembly (on Powerpc-linux-gnu).
.L2:
add 9,4,11
addi 11,11,2
mullw 0,3,0
sth 0,2(9)
rldicl 0,0,0,48
bdnz .L2
--- CUT ---
But it is needed. If we look at -O2 case:
.L2:
lhz 0,0(4)
mullw 0,3,0
sthu 0,2(4)
bdnz .L2
You will see that we load the code as zero extended.
Also I get:
<bb 3>:
D.1263 = (short unsigned int) D__lsm0.41 * pretmp.27;
D__lsm0.41 = (short int) D.1263;
MEM[base: out1 + ivtmp.49, offset: 2] = D__lsm0.41;
ivtmp.49 = ivtmp.49 + 2;
if (ivtmp.49 != 200)
for the loop on the trunk.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33404