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]

[PATCH] Add SPECIAL_FLOAT_MODE to enable adding IEEE 128-bit floating point to PowerPC


This patch contains the machine independent changes that I will need to add
IEEE 128-bit floating point to the GCC compiler for PowerPC.

It adds a new mode defintion macro: SPECIAL_FLOAT_MODE that is similar to
FLOAT_MODE.  The difference is the conversion system will skip
SPECIAL_FLOAT_MODE types when it is looking for a larger type.

The problem is the PowerPC will have 2 128-bit floating point types, one using
the IBM double-double format (a pair of doubles to give the user more mantissa
bits, but no greater exponent range), and IEEE 128-bit floating point.  I don't
want DFmode to automatically convert to KFmode (IEEE 128-bit floating point),
but to TFmode (IBM double-double).

With these patches applied, in the places where we are setting up types, we
include the special floating point types, but for the normal
GET_MODE_WIDER_MODE usage we do not want to use the special floating point
mode.

I found some of the GET_MODE_WIDER_MODE loops needed to add a check for running
out of modes if the mode type was special.  For those loops, I added a test for
mode not being VOIDmode.


2015-05-05  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* machmode.h (GET_MODE_WIDER_MODE_SPECIAL): New macro to get the
	wider modes that are normally skipped by default.

	* rtlanal.c (init_num_sign_bit_copies_in_rep): In going from
	narrow to wider modes, check whether we receive VOIDmode, since
	special floating point types are not listed in the normal widening
	tables.  When doing initializations, go through all modes in a
	class, even special modes, that are normally skipped by default
	widening.
	* cse.c (cse_insn): Likewise.
	* expr.c (init_expr_target): Likewise.
	(compress_float_constant): Likewise.
	* dse.c (find_shift_sequence): Likewise.
	* emit-rtl.c (init_derived_machine_modes): Likewise.
	(init_emit_once): Likewise.
	* combine.c (simplify_comparison): Likewise.

	* machmode.def (SPECIAL_FLOAT_MODE): New type of floating point
	that is special, and is not automatically part of the normal
	widening rules.

	* genmodes.c (struct mode_data): Add special field.
	(blank_mode): Initialize special.
	(complete_mode): Complex and vector types inherit the special mode
	class.
	(FLOAT_MODE): Add special field for floating point to sort special
	nodes higher than normal nodes for the same size.  The intention
	is to allow __float128 on PowerPC (KFmode) to be higher than long
	double (TFmode), so that automatic widening uses the long double
	type.
	(FRACTIONAL_FLOAT_MODE): Likewise.
	(SPECIAL_FLOAT_MODE): Likewise.
	(FLOAT_MODE_INTERNAL): Likewise.
	(make_float_mode): Likewise.
	(emit_mode_wider): Likewise.

These patches have been part of my IEEE 128-bit floating point branch for some
time, and I have bootstrapped that branch many times.  At present, I am just
submitting these patches to add the necessary infrastructure for the patches I
will be contributing later.  I have done an x86 bootstrap on the IEEE 128-bit
floating point branch to make sure it does not cause problems for ports that do
not define SPECIAL_FLOAT_MODE types.

Are these patches ok to commit to the trunk?

I would also be open to alternative ways of creating a mode that is not part of
the normal wider conversion methods or in adding options to control the order
the widening types are searched.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

Attachment: gcc-power9.patch019e
Description: Text document


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