------- 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