Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: i386 floating point expertise needed




On 11/30/2017 05:41 PM, Terry Moore wrote:
Does the i386 function return for floats (doubles) also return more bits
than are expected by the data type?

Yes. Returns are on the stack as 80-bit values.

Better be more precise: The return value in on the _FP_ register stack.
While these registers hold 80-bit values, at least in a simple test
case the called function makes sure that no excess precision is
returned to the caller.
The test case is: compile the attached file with "cc -S -m32 ftest.c".
In my case (gcc 5.4 on Linux/amd64) the compiler issues a series
of fld/fst. With -O6, only an "fldl" of the 64-bit constant is left.

best regards
Matthias



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

double
xxx()
{
	long double a = (long double)1.0/5;
	return a;
}


Home | Main Index | Thread Index | Old Index