8sa1-gcc/gcc/testsuite/gcc.c-torture/execute/floatunsisf-1.c
Joseph Myers d773588022 fp-bit.c (clzusi): New function.
* config/fp-bit.c (clzusi): New function.
	(si_to_float, usi_to_float): Use it to compute proper shift.
	(usi_to_float): Preserve guard bits when shifting right.
	* libgcc-std.ver (GCC_4.2.0): New version.
	* libgcc2.c (__floatundixf, __floatunditf, __floatundidf,
	__floatundisf): New functions.
	* libgcc2.h (__floatundixf, __floatunditf, __floatundidf,
	__floatundisf): Declare.
	* mklibgcc.in (lib2funcs): Add _floatundidf, _floatundisf,
	_floatundixf, and _floatunditf.
	* optabs.c (expand_float): If target does not define a pattern for
	signed or unsigned conversion, use an unsigned libcall instead of
	a signed one.
	(init_optabs): Initialize ufloat_optab.

testsuite:
	* gcc.c-torture/execute/floatunsisf-1.c: New test.

From-SVN: r107345
2005-11-22 00:38:30 +00:00

22 lines
475 B
C

/* The fp-bit.c function __floatunsisf had a latent bug where guard bits
could be lost leading to incorrect rounding. */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
extern void abort (void);
extern void exit (int);
#if __INT_MAX__ >= 0x7fffffff
volatile unsigned u = 0x80000081;
#else
volatile unsigned long u = 0x80000081;
#endif
volatile float f1, f2;
int
main (void)
{
f1 = (float) u;
f2 = (float) 0x80000081;
if (f1 != f2)
abort ();
exit (0);
}