This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Omitted conversion float -> double in x86 back-end
Michael Matz writes:
> Hi,
>
> On Tue, 21 Nov 2006, Roberto COSTA wrote:
>
> > Hi Michael,
> > too late, I've filed the report a few minutes ago.
> > By the way, if I want to bypass the problem without paying any performance
> > penalty, it is sufficient that I introduce a temporary variable in the C
> > source.
> > As a matter of fact, this looks to work:
> >
> > double foo(signed long long l)
> > {
> > double d = (float)l;
> > return d;
> > }
>
> Pure luck. Try with -O2 or another compiler version and it will stop
> working again. IOW: it's no workaround for the x87 problem. The only one
> there is is -ffloat-store,
or volatile, in the one place where you really need to do the conversion.
double foo(signed long long l)
{
volatile float tmp = l;
return tmp;
}
foo:
subl $16, %esp
fildll 20(%esp)
fstps 12(%esp)
flds 12(%esp)
addl $16, %esp
ret
Andrew.