This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Fwd: Re: Optimization problem on PPC when casting integers to floats




Steven G. Johnson (stevenj@gil-galad.mit.edu) was kind enough to test this on Linux PPC with 2.95.2 and a recent CVS snapshot. It looks like the Linux PPC 2.95.2 is better than the MacOS X DP4 version in the unsigned short -> double case, but still bad in that it does an extra needless write inside the loop. The recent CVS snapshot schedules a bit different, but still has the extra write.

-tim


Begin forwarded message:

From: "Steven G. Johnson" <stevenj@gil-galad.mit.edu>
Date: Sun, 21 May 2000 15:01:24 -0400 (EDT)
To: bungi@omnigroup.com
Subject: Re: Optimization problem on PPC when casting integers to floats

Timothy,

I have a PowerBook G3 running LinuxPPC, and upon seeing your post I
thought I'd respond. I have both gcc-2.95.2 and also a relatively recent
CVS version (as of a couple of weeks ago). Using these, I've compiled
your cast.c function, and below I've included a snipped of the code
produced for test1:

gcc-2.95.2 produces the following:

test1:
stwu 1,-16(1)
lis 9,.LC0@ha
la 9,.LC0@l(9)
lfd 1,0(9)
lis 9,.LC1@ha
li 0,1000
la 9,.LC1@l(9)
mtctr 0
lfd 13,0(9)
lis 11,0x4330
..L8:
lhz 0,0(3)
xoris 0,0,0x8000
stw 0,12(1)
stw 11,8(1)
lfd 0,8(1)
addi 3,3,2
fsub 0,0,13
fadd 1,1,0
bdnz .L8
la 1,16(1)
blr

The CVS gcc produces this:

test1:
li 0,1000
lis 11,.LC1@ha
mtctr 0
lis 9,.LC0@ha
la 11,.LC1@l(11)
la 9,.LC0@l(9)
lfd 13,0(11)
lfd 1,0(9)
lis 9,0x4330
stwu 1,-16(1)
..L9:
lhz 0,0(3)
addi 3,3,2
stw 9,8(1)
xoris 0,0,0x8000
stw 0,12(1)
lfd 0,8(1)
fsub 0,0,13
fadd 1,1,0
bdnz .L9
addi 1,1,16
blr

I hope this is helpful. Feel free to post this if you think it is useful.

Cordially,
Steven G. Johnson


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]