[Bug target/24007] New: very weird register allocation, putting a fp in the ctr register
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Sep 21 23:35:00 GMT 2005
Take the following example:
extern float a, b;
float BG_SplineLength ()
{
float result27;
float result;
float lastPoint;
float vec1;
float vec0;
float dist;
float i;
vec0 = a;
vec1 = b;
result = vec1 - vec0;
i = 9.99999977648258209228515625e-3f;
dist = 0.0;
do {
result27 = vec1 - vec0;
lastPoint = result;
while (!(i != 0.0))
{
i = i + 9.99999977648258209228515625e-3f;
lastPoint = result27;
}
vec0 = result27 - lastPoint;
dist = dist + vec0;
i = i + 9.99999977648258209228515625e-3f;
if (! (i <= 1.0e+0))
return dist;
result = result27;
} while (1);
}
---
On the mainline, we get:
L3:
lis r11,ha16(LC4)
fsubs f11,f9,f12
la r11,lo16(LC4)(r11)
lfs f0,0(r11)
fcmpu cr7,f13,f0
bne- cr7,L4
fmr f12,f10
L5:
fadds f13,f13,f12
fcmpu cr7,f13,f0
beq+ cr7,L5
lfs f10,lo16(LC0)(r9)
fmr f12,f11
lfs f0,lo16(LC1)(r2)
fadds f13,f13,f10
stfs f11,-16(r1)
fsubs f12,f11,f12
lwz r0,-16(r1)
fcmpu cr7,f13,f0
mtctr r0
fadds f1,f1,f12
cror 30,28,30
beq+ cr7,L3
Notice how we move through memory and use the ctr register. That is just wrong.
If I change the type from float to double, it works correctly but only if I don't also use -m64.
--
Summary: very weird register allocation, putting a fp in the ctr
register
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization, ra
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-darwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24007
More information about the Gcc-bugs
mailing list