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]

[Ada] Generate Machine, Model and Rounding FP attributes in line


This change makes it so that the Machine, Model and Rounding FP attributes
are generated in line by the compiler (in conjunction with a conversion to
an integer type for the third) and optimized on architectures that do not
make use of internal extended precision in the FPU.

The following function must be optimized into a return on PowerPC and SPARC:

function Machine (F: Float) return Float is
begin
  return Float'Machine (F);
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-08-01  Eric Botcazou  <ebotcazou@adacore.com>

	* exp_attr.adb (Expand_N_Attribute_Reference): Check whether
	expansion can be avoid for Machine, Model and Rounding.
	(Is_Inline_Floating_Point_Attribute): Return true for Machine
	& Model, as well as Rounding if wrapped in a conversion to an
	integer type.
	* sem_res.adb (Simplify_Type_Conversion): Deal with Rounding as well.
	* gcc-interface/gigi.h (fp_arith_may_widen): Declare.
	* gcc-interface/utils.c (fp_arith_may_widen): New global variable.
	* gcc-interface/misc.c (enumerate_modes): Compute it.
	* gcc-interface/trans.c (FP_ARITH_MAY_WIDEN): Delete.
	(lvalue_required_for_attribute_p): Deal with Descriptor_Size,
	Machine and Model.
	(Attribute_to_gnu) <Attr_Model>: New case.
	<Attr_Machine>): Likewise.
	(convert_with_check): Test
	fp_arith_may_widen variable.

Attachment: difs
Description: Text document


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