This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

float to int conversions


This is an update of http://gcc.gnu.org/ml/gcc-patches/2002-11/msg00195.html
for gcc-3.3 and mainline.  It makes powerpc gcc follow the Java
conventions for floating point to integer conversions of NANs and
values that overflow.  I've fixed the output_toc ICE that the
following exposes, and sent that fix separately.

Works with or without rth's latest change to real.c as we check for
overflow before real_to_integer2 gets a look-in.  Bootstrapped and
regression tested on 3.3 branch, powerpc-linux.  Currently
bootstrapping the mainline version of this patch (slightly different
due to libgcc2.c:__fixunsdfDI and __fixunssfDI changes).

	* defaults.h (FLOAT_FIX_BOUND_OVERFLOW): Define
	(FLOAT_FIX_NANS_TO_ZERO): Define.
	* fold-const.c (fold_convert): Handle FLOAT_FIX_BOUND_OVERFLOW.
	* simplify-rtx.c (simplify_unary_operation): Likewise.
	* optabs.c (expand_fix): Likewise, also FLOAT_FIX_NANS_TO_ZERO.
	* config/rs6000/rs6000.h (FLOAT_FIX_BOUND_OVERFLOW): Define
	(FLOAT_FIX_NANS_TO_ZERO): Define.
	* libgcc2.c (__fixunstfDI): Reorganize so that NaNs convert to zero.
	(__fixunsxfDI, __fixunsdfDI, __fixunssfDI): Likewise.
	(__fixunsxfSI, __fixunsdfSI, __fixunssfSI): Likewise.
	(__fixtfdi): Handle FLOAT_FIX_BOUND_OVERFLOW.
	(__fixxfdi, __fixdfdi, __fixsfdi): Likewise.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Attachment: gcc33.diff
Description: Text document

Attachment: gcc34.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]