[Bug middle-end/33989] Extra load/store for float with union
phiren at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Nov 12 04:04:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33989
--- Comment #15 from Scott Mansell <phiren at gmail dot com> 2010-11-12 04:04:25 UTC ---
Weirdly, it works fine with doubles.
Testcase:
union a
{
long int i;
double f;
};
void d(double *a, long int *b, double e)
{
union a c;
c.f = *a + e;
*b = c.i;
}
Results in:
.L.d:
lfd 0,0(3)
fadd 0,1,0
stfd 0,0(4)
blr
One thing that I noticed while looking at the assembly of my program, it that
is was allocated 8 bytes on the stack for each stfs instruction. Does gcc think
that stfs writes a 64 bit value which is preventing it writing directly into
the space of an int?
I've checked the IBM docs, stfs does write a 32 bit value.
More information about the Gcc-bugs
mailing list