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] | |
In working on the IEEE 128-bit floating point support, I've run into situations
where it would be to have the basic KFmode type available under Linux, but not
allow the __float128 and _Float128 keywords to be used until the library work
is done. But the library functions might want to use some IEEE 128-bit support
in order to implement the support, but you might need to add -mfloat128 to the
builds.
Originally, I thought no problem, just use a target attribute to enable the
IEEE 128-bit floating point support, but it turns out if the -mfloat128 option
is not set at compilation type, the appropriate types are not created and the
target support won't work to set it later (PR 70589).
Another thing that I've seen occasionally is whether internally __ibm128 is the
same as long double or a sepate type. Right now, __ibm128 is a separate type.
When we eventually switch to long double being IEEE 128, we might have the same
logical problem with __float128.
This patch attempts to fix both of these problems. It splits -mfloat128 into
two switches, -mfloat128-type that does all of the underylying type stuff, and
the current -mfloat128 which enables the keywords. On 64-bit powerpc Linux
systems, the compiler will enable -mfloat128-type by default for VSX targets
(both 32/64-bit on big endian, and 64-bit on little endian). On other systems
like AIX, it will not enable -mfloat128-type by default.
It also changes __ibm128/__float128, and only registers the keywords if the
long double type is not IBM extended double or IEEE 128-bit floating point
respectively. If the long double type matches one of those types, instead it
will issue a #define {__ibm128,__float128} long double, and the user will
always pick up the long double type.
I have built these patches on a little endian 64-bit power8 system and a big
endian power7 system that supports both 32-bit/64-bit targets. Note, due to
bug 77847, I had to build the big endian compiler so that the default code
generation was power5 instead of power7. There were no regressions, is it ok
to install this pach in the trunk?
[gcc]
2016-10-03 Michael Meissner <meissner@linux.vnet.ibm.com>
* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Split
-mfloat128 into -mfloat128-type that enables the IEEE 128-bit
floating point type infrastructre, and -mfloat128 that enables the
keyword. Define __FLOAT128__ if -mfloat128, and __FLOAT128_TYPE__
if -mfloat128-type. Define __ibm128 or __float128 if that type is
available, and it matches the long double type.
* config/rs6000/rs6000.c (rs6000_debug_reg_global): Print whether
the IEEE 128-bit floating point type infrastructure should
automatically be enabled.
(rs6000_init_hard_regno_mode_ok): Switch to use -mfloat128-type
instead of -mfloat128 to enable KFmode.
(rs6000_option_override_internal): Split the option -mfloat128
into -mfloat128-type and -mfloat128. On Linux PowerPC 64-bit
systems, automatically set -mfloat128-type, but don't enable it on
other operating systems. Move setting the long double size and
IEEE quad support before the IEEE 128-bit floating point changes.
(rs6000_init_builtins): Do not create a unique type for __ibm128
if long double is IBM extended double, instead rely on __ibm128
being defined as 'long double'. For IEEE 128-bit floating point,
if __float128/_Float128 are not enabled, create a unique type for
IEEE 128-bit floating point.
(rs6000_init_libfuncs): Use -mfloat128-type instead of
-mfloat128 for tests about the types, but keep tests for
-mfloat128 to enable the keyword support.
(rs6000_complex_function_value): Likewise.
(rs6000_scalar_mode_supported_p): Likewise.
(rs6000_floatn_mode): Likewise.
(rs6000_c_mode_for_suffix): Likewise.
(rs6000_opt_masks): Add -mfloat128-type.
* config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Add support for
-mfloat128-type being split from -mfloat128. Add
-mfloat128-hardware, which was missing.
* config/rs6000/rs6000.opt (-mfloat128): Split -mfloat128 into
-mfloat128 and -mfloat128-type:
(-mfloat128-type): Likewise.
* config/rs6000/linux64.h (TARGET_FLOAT128_ENABLE_TYPE): Define so
that 64-bit Linux systems with enable -mfloat128-type by default
on VSX systems.
* config/rs6000/rs6000.h (TARGET_FLOAT128_ENABLE_TYPE): Likewise.
(FLOAT128_VECTOR_P): Switch IEEE 128-bit floating points to use
-mfloat128-type instead of -mfloat128.
(FLOAT128_2REG_P): Likewise.
(MASK_FLOAT128_TYPE): Likewise.
(ALTIVEC_ARG_MAX_RETURN): Likewise.
(RS6000_BTM_FLOAT128): Likewise.
(TARGET_FLOAT128): Poison old identifiers.
(OPTION_MASK_FLOAT128): Likewise.
(MASK_FLOAT128): Likewise.
* config/rs6000/rs6000.md (FP): Likewise.
(FLOAT128): Likewise.
(fix_trunc<mode>di2): Likewise.
(fixuns_trunc<IEEE128:mode><SDI:mode>2): Likewise.
(floatdi<mode>2): Likewise.
(floatuns<SDI:mode><IEEE128:mode>2): Likewise.
(neg<mode>2, FLOAT128 iterator): Likewise.
(abs<mode>2, FLOAT128 iterator): Likewise.
(ieee_128bit_negative_zero): Likewise.
(ieee_128bit_vsx_neg<mode>2): Likewise.
(ieee_128bit_vsx_neg<mode>2_internal): Likewise.
(ieee_128bit_vsx_abs<mode>2): Likewise.
(ieee_128bit_vsx_abs<mode>2_internal): Likewise.
(ieee_128bit_vsx_nabs<mode>2): Likewise.
(ieee_128bit_vsx_nabs<mode>2_internal): Likewise.
(extendiftf2): Likewise.
(extendifkf2): Likewise.
(extendtfkf2): Likewise.
(trunciftf2): Likewise.
(truncifkf2): Likewise.
(trunckftf2): Likewise.
(trunctfif2): Likewise.
(extendkftf2): Likewise.
(trunctfkf2): Likewise.
[gcc/testsuite]
2016-10-03 Michael Meissner <meissner@linux.vnet.ibm.com>
* gcc.target/powerpc/float128-mix.c: Change error message to
reflect that __ibm128 is now #define'ed to be long double.
* gcc.target/powerpc/float128-type-1.c: New test to check that
PowerPC 64-bit Linux enables -mfloat128-type by default.
* gcc.target/powerpc/float128-type-2.c: Likewise.
--
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-stage7.ieee001b
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |