From 9959b72991b44431bea5a82abd85a92fce0fe8be Mon Sep 17 00:00:00 2001 From: meissner Date: Wed, 6 Sep 2017 17:41:08 +0000 Subject: [PATCH] [gcc] 2017-09-07 Michael Meissner * config/rs6000/rs6000-cpus.def (OTHER_VSX_VECTOR_MASKS): Delete OPTION_MASK_FLOAT128_KEYWORD. (POWERPC_MASKS): Likewise. * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Delete support for the -mfloat128-type option, and make -mfloat128 default on PowerPC Linux systems. Define or undefine __FLOAT128__ and __FLOAT128_HARDWARE__ for the current options. Define __float128 to be __ieee128 if IEEE 128-bit support is enabled, or undefine it. (rs6000_cpu_cpp_builtins): Delete defining __FLOAT128__ here. Delete defining __FLOAT128_TYPE__. * config/rs6000/rs6000.opt (x_TARGET_FLOAT128_TYPE): Delete the -mfloat128-type option and make -mfloat128 default on PowerPC Linux systems. (TARGET_FLOAT128_TYPE): Likewise. (-mfloat128-type): Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Delete the -mfloat128-type option and make -mfloat128 default on PowerPC Linux systems. Always use __ieee128 to be the keyword for the IEEE 128-bit type, and map __float128 to __ieee128 if IEEE 128-bit floating point is enabled. Change tests from using -mfloat128-type to -mfloat128. (rs6000_mangle_type): Use the correct mangling for the __float128 type even if normal long double is restricted to 64-bits. (floatn_mode): Enable the _Float128 type by default on VSX Linux systems. * config/rs6000/rs6000.h (MASK_FLOAT128_TYPE): Delete. (MASK_FLOAT128_KEYWORD): Define new shortcut macro. (RS6000BTM_FLOAT128): Define in terms of -mfloat128, not -mfloat128-type. * doc/invoke.texi (RS/6000 and PowerPC Options): Update documentation for -mfloat128. [gcc/testsuite] 2017-09-07 Michael Meissner * gcc.target/powerpc/float128-1.c: Update options to know that -mfloat128 is now on by default on PowerPC VSX systems. Remove -static-libgcc option which is no longer needed. Use -mvsx or -mpower9-vector to enable VSX or hardware IEEE support, rather than specifying a particular CPU. * gcc.target/powerpc/float128-2.c: Likewise. * gcc.target/powerpc/float128-cmp.c: Likewise. * gcc.target/powerpc/float128-complex-1.c: Likewise. * gcc.target/powerpc/float128-complex-2.c: Likewise. * gcc.target/powerpc/float128-hw.c: Likewise. * gcc.target/powerpc/float128-mix.c: Likewise. * gcc.target/powerpc/float128-type-1.c: Likewise. * gcc.target/powerpc/float128-type-2.c: Likewise. * gcc.target/powerpc/float128-3.c: New test. * gcc.target/powerpc/float128-4.c: Likewise. * gcc.target/powerpc/float128-5.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251814 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 35 ++++++ gcc/config/rs6000/rs6000-c.c | 22 ++-- gcc/config/rs6000/rs6000-cpus.def | 2 - gcc/config/rs6000/rs6000.c | 135 +++++++-------------- gcc/config/rs6000/rs6000.h | 4 +- gcc/config/rs6000/rs6000.opt | 16 +-- gcc/doc/invoke.texi | 33 ++--- gcc/testsuite/ChangeLog | 19 +++ gcc/testsuite/gcc.target/powerpc/float128-1.c | 3 +- gcc/testsuite/gcc.target/powerpc/float128-2.c | 3 +- gcc/testsuite/gcc.target/powerpc/float128-3.c | 21 ++++ .../powerpc/{float128-1.c => float128-4.c} | 49 ++++---- gcc/testsuite/gcc.target/powerpc/float128-5.c | 24 ++++ gcc/testsuite/gcc.target/powerpc/float128-cmp.c | 2 +- .../gcc.target/powerpc/float128-complex-1.c | 3 +- .../gcc.target/powerpc/float128-complex-2.c | 2 +- gcc/testsuite/gcc.target/powerpc/float128-hw.c | 3 +- gcc/testsuite/gcc.target/powerpc/float128-mix.c | 5 +- gcc/testsuite/gcc.target/powerpc/float128-type-1.c | 17 ++- gcc/testsuite/gcc.target/powerpc/float128-type-2.c | 16 +-- 20 files changed, 241 insertions(+), 173 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-3.c copy gcc/testsuite/gcc.target/powerpc/{float128-1.c => float128-4.c} (72%) create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-5.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 504fe5a914c..6213a2aad57 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,38 @@ +2017-09-07 Michael Meissner + + * config/rs6000/rs6000-cpus.def (OTHER_VSX_VECTOR_MASKS): Delete + OPTION_MASK_FLOAT128_KEYWORD. + (POWERPC_MASKS): Likewise. + * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Delete + support for the -mfloat128-type option, and make -mfloat128 + default on PowerPC Linux systems. Define or undefine + __FLOAT128__ and __FLOAT128_HARDWARE__ for the current options. + Define __float128 to be __ieee128 if IEEE 128-bit support is + enabled, or undefine it. + (rs6000_cpu_cpp_builtins): Delete defining __FLOAT128__ here. + Delete defining __FLOAT128_TYPE__. + * config/rs6000/rs6000.opt (x_TARGET_FLOAT128_TYPE): Delete the + -mfloat128-type option and make -mfloat128 default on PowerPC + Linux systems. + (TARGET_FLOAT128_TYPE): Likewise. + (-mfloat128-type): Likewise. + * config/rs6000/rs6000.c (rs6000_option_override_internal): + Delete the -mfloat128-type option and make -mfloat128 default on + PowerPC Linux systems. Always use __ieee128 to be the keyword for + the IEEE 128-bit type, and map __float128 to __ieee128 if IEEE + 128-bit floating point is enabled. Change tests from using + -mfloat128-type to -mfloat128. + (rs6000_mangle_type): Use the correct mangling for the __float128 + type even if normal long double is restricted to 64-bits. + (floatn_mode): Enable the _Float128 type by default on VSX Linux + systems. + * config/rs6000/rs6000.h (MASK_FLOAT128_TYPE): Delete. + (MASK_FLOAT128_KEYWORD): Define new shortcut macro. + (RS6000BTM_FLOAT128): Define in terms of -mfloat128, not + -mfloat128-type. + * doc/invoke.texi (RS/6000 and PowerPC Options): Update + documentation for -mfloat128. + 2017-09-06 Olivier Hainque * config.gcc (powerpc-wrs-vxworksspe): Now match as vxworks*spe. diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 897306cc488..b2df850e81b 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -574,6 +574,18 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags, 2. If TARGET_ALTIVEC is turned off. */ if ((flags & OPTION_MASK_CRYPTO) != 0) rs6000_define_or_undefine_macro (define_p, "__CRYPTO__"); + if ((flags & OPTION_MASK_FLOAT128_KEYWORD) != 0) + { + rs6000_define_or_undefine_macro (define_p, "__FLOAT128__"); + if (define_p) + rs6000_define_or_undefine_macro (true, "__float128=__ieee128"); + else + rs6000_define_or_undefine_macro (false, "__float128"); + } + /* OPTION_MASK_FLOAT128_HARDWARE can be turned on if -mcpu=power9 is used or + via the target attribute/pragma. */ + if ((flags & OPTION_MASK_FLOAT128_HW) != 0) + rs6000_define_or_undefine_macro (define_p, "__FLOAT128_HARDWARE__"); /* options from the builtin masks. */ /* Note that RS6000_BTM_PAIRED is enabled only if @@ -601,24 +613,14 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile) builtin_define ("__RSQRTE__"); if (TARGET_FRSQRTES) builtin_define ("__RSQRTEF__"); - if (TARGET_FLOAT128_KEYWORD) - builtin_define ("__FLOAT128__"); if (TARGET_FLOAT128_TYPE) builtin_define ("__FLOAT128_TYPE__"); - if (TARGET_FLOAT128_HW) - builtin_define ("__FLOAT128_HARDWARE__"); if (TARGET_LONG_DOUBLE_128 && FLOAT128_IBM_P (TFmode)) builtin_define ("__ibm128=long double"); #ifdef TARGET_LIBC_PROVIDES_HWCAP_IN_TCB builtin_define ("__BUILTIN_CPU_SUPPORTS__"); #endif - /* We needed to create a keyword if -mfloat128-type was used but not -mfloat, - so we used __ieee128. If -mfloat128 was used, create a #define back to - the real keyword in case somebody used it. */ - if (TARGET_FLOAT128_KEYWORD) - builtin_define ("__ieee128=__float128"); - if (TARGET_EXTRA_BUILTINS && cpp_get_options (pfile)->lang != CLK_ASM) { /* Define the AltiVec syntactic elements. */ diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index d4a8b94326a..f9822e1ce7c 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -86,7 +86,6 @@ #define OTHER_VSX_VECTOR_MASKS (OTHER_P8_VECTOR_MASKS \ | OPTION_MASK_EFFICIENT_UNALIGNED_VSX \ | OPTION_MASK_FLOAT128_KEYWORD \ - | OPTION_MASK_FLOAT128_TYPE \ | OPTION_MASK_P8_VECTOR) #define POWERPC_7400_MASK (OPTION_MASK_PPC_GFXOPT | OPTION_MASK_ALTIVEC) @@ -112,7 +111,6 @@ | OPTION_MASK_EFFICIENT_UNALIGNED_VSX \ | OPTION_MASK_FLOAT128_HW \ | OPTION_MASK_FLOAT128_KEYWORD \ - | OPTION_MASK_FLOAT128_TYPE \ | OPTION_MASK_FPRND \ | OPTION_MASK_HTM \ | OPTION_MASK_ISEL \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 6d613c38b75..fdc39d9a64d 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4608,73 +4608,42 @@ rs6000_option_override_internal (bool global_init_p) #endif /* Enable the default support for IEEE 128-bit floating point on Linux VSX - sytems, but don't enable the __float128 keyword. */ - if (TARGET_VSX && TARGET_LONG_DOUBLE_128 - && (TARGET_FLOAT128_ENABLE_TYPE || TARGET_IEEEQUAD) - && ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_TYPE) == 0)) - rs6000_isa_flags |= OPTION_MASK_FLOAT128_TYPE; + sytems. In GCC 7, we would enable the the IEEE 128-bit floating point + infrastructure (-mfloat128-type) but not enable the actual __float128 type + unless the user used the explicit -mfloat128. In GCC 8, we enable both + the keyword as well as the type. */ + TARGET_FLOAT128_TYPE = TARGET_FLOAT128_ENABLE_TYPE && TARGET_VSX; /* IEEE 128-bit floating point requires VSX support. */ - if (!TARGET_VSX) + if (TARGET_FLOAT128_KEYWORD) { - if (TARGET_FLOAT128_KEYWORD) + if (!TARGET_VSX) { if ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_KEYWORD) != 0) error ("%qs requires VSX support", "-mfloat128"); - rs6000_isa_flags &= ~(OPTION_MASK_FLOAT128_TYPE - | OPTION_MASK_FLOAT128_KEYWORD + TARGET_FLOAT128_TYPE = 0; + rs6000_isa_flags &= ~(OPTION_MASK_FLOAT128_KEYWORD | OPTION_MASK_FLOAT128_HW); } - - else if (TARGET_FLOAT128_TYPE) + else if (!TARGET_FLOAT128_TYPE) { - if ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_TYPE) != 0) - error ("%qs requires VSX support", "-mfloat128-type"); - - rs6000_isa_flags &= ~(OPTION_MASK_FLOAT128_TYPE - | OPTION_MASK_FLOAT128_KEYWORD - | OPTION_MASK_FLOAT128_HW); + TARGET_FLOAT128_TYPE = 1; + warning (0, "The -mfloat128 option may not be fully supported"); } } - /* -mfloat128 and -mfloat128-hardware internally require the underlying IEEE - 128-bit floating point support to be enabled. */ - if (!TARGET_FLOAT128_TYPE) - { - if (TARGET_FLOAT128_KEYWORD) - { - if ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_KEYWORD) != 0) - { - error ("%qs requires %qs", "-mfloat128", "-mfloat128-type"); - rs6000_isa_flags &= ~(OPTION_MASK_FLOAT128_TYPE - | OPTION_MASK_FLOAT128_KEYWORD - | OPTION_MASK_FLOAT128_HW); - } - else - rs6000_isa_flags |= OPTION_MASK_FLOAT128_TYPE; - } - - if (TARGET_FLOAT128_HW) - { - if ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_HW) != 0) - { - error ("%qs requires %qs", "-mfloat128-hardware", - "-mfloat128-type"); - rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW; - } - else - rs6000_isa_flags &= ~(OPTION_MASK_FLOAT128_TYPE - | OPTION_MASK_FLOAT128_KEYWORD - | OPTION_MASK_FLOAT128_HW); - } - } + /* Enable the __float128 keyword under Linux by default. */ + if (TARGET_FLOAT128_TYPE && !TARGET_FLOAT128_KEYWORD + && (rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_KEYWORD) == 0) + rs6000_isa_flags |= OPTION_MASK_FLOAT128_KEYWORD; - /* If we have -mfloat128-type and full ISA 3.0 support, enable - -mfloat128-hardware by default. However, don't enable the __float128 - keyword. If the user explicitly turned on -mfloat128-hardware, enable the - -mfloat128 option as well if it was not already set. */ - if (TARGET_FLOAT128_TYPE && !TARGET_FLOAT128_HW + /* If we have are supporting the float128 type and full ISA 3.0 support, + enable -mfloat128-hardware by default. However, don't enable the + __float128 keyword if it was explicitly turned off. 64-bit mode is needed + because sometimes the compiler wants to put things in an integer + container, and if we don't have __int128 support, it is impossible. */ + if (TARGET_FLOAT128_TYPE && !TARGET_FLOAT128_HW && TARGET_64BIT && (rs6000_isa_flags & ISA_3_0_MASKS_IEEE) == ISA_3_0_MASKS_IEEE && !(rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_HW)) rs6000_isa_flags |= OPTION_MASK_FLOAT128_HW; @@ -4696,11 +4665,6 @@ rs6000_option_override_internal (bool global_init_p) rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW; } - if (TARGET_FLOAT128_HW && !TARGET_FLOAT128_KEYWORD - && (rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_HW) != 0 - && (rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_KEYWORD) == 0) - rs6000_isa_flags |= OPTION_MASK_FLOAT128_KEYWORD; - /* Print the options after updating the defaults. */ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) rs6000_print_isa_options (stderr, 0, "after defaults", rs6000_isa_flags); @@ -4767,10 +4731,12 @@ rs6000_option_override_internal (bool global_init_p) unless the altivec ABI was set. This is set by default for 64-bit, but not for 32-bit. */ if (main_target_opt != NULL && !main_target_opt->x_rs6000_altivec_abi) - rs6000_isa_flags &= ~((OPTION_MASK_VSX | OPTION_MASK_ALTIVEC - | OPTION_MASK_FLOAT128_TYPE - | OPTION_MASK_FLOAT128_KEYWORD) - & ~rs6000_isa_flags_explicit); + { + TARGET_FLOAT128_TYPE = 0; + rs6000_isa_flags &= ~((OPTION_MASK_VSX | OPTION_MASK_ALTIVEC + | OPTION_MASK_FLOAT128_KEYWORD) + & ~rs6000_isa_flags_explicit); + } /* Enable Altivec ABI for AIX -maltivec. */ if (TARGET_XCOFF && (TARGET_ALTIVEC || TARGET_VSX)) @@ -16884,16 +16850,17 @@ rs6000_init_builtins (void) format that uses a pair of doubles, depending on the switches and defaults. - We do not enable the actual __float128 keyword unless the user explicitly - asks for it, because the library support is not yet complete. - If we don't support for either 128-bit IBM double double or IEEE 128-bit floating point, we need make sure the type is non-zero or else self-test fails during bootstrap. We don't register a built-in type for __ibm128 if the type is the same as long double. Instead we add a #define for __ibm128 in - rs6000_cpu_cpp_builtins to long double. */ + rs6000_cpu_cpp_builtins to long double. + + For IEEE 128-bit floating point, always create the type __ieee128. If the + user used -mfloat128, rs6000-c.c will create a define from __float128 to + __ieee128. */ if (TARGET_LONG_DOUBLE_128 && FLOAT128_IEEE_P (TFmode)) { ibm128_float_type_node = make_node (REAL_TYPE); @@ -16907,24 +16874,10 @@ rs6000_init_builtins (void) else ibm128_float_type_node = long_double_type_node; - if (TARGET_FLOAT128_KEYWORD) + if (TARGET_FLOAT128_TYPE) { ieee128_float_type_node = float128_type_node; lang_hooks.types.register_builtin_type (ieee128_float_type_node, - "__float128"); - } - - else if (TARGET_FLOAT128_TYPE) - { - ieee128_float_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (ibm128_float_type_node) = 128; - SET_TYPE_MODE (ieee128_float_type_node, KFmode); - layout_type (ieee128_float_type_node); - - /* If we are not exporting the __float128/_Float128 keywords, we need a - keyword to get the types created. Use __ieee128 as the dummy - keyword. */ - lang_hooks.types.register_builtin_type (ieee128_float_type_node, "__ieee128"); } @@ -32555,11 +32508,14 @@ rs6000_mangle_type (const_tree type) if (type == ieee128_float_type_node) return "U10__float128"; - if (type == ibm128_float_type_node) - return "g"; + if (TARGET_LONG_DOUBLE_128) + { + if (type == long_double_type_node) + return (TARGET_IEEEQUAD) ? "U10__float128" : "g"; - if (type == long_double_type_node && TARGET_LONG_DOUBLE_128) - return (TARGET_IEEEQUAD) ? "U10__float128" : "g"; + if (type == ibm128_float_type_node) + return "g"; + } } /* Mangle IBM extended float long double as `g' (__float128) on @@ -36037,7 +35993,7 @@ rs6000_floatn_mode (int n, bool extended) return DFmode; case 64: - if (TARGET_FLOAT128_KEYWORD) + if (TARGET_FLOAT128_TYPE) return (FLOAT128_IEEE_P (TFmode)) ? TFmode : KFmode; else return opt_scalar_float_mode (); @@ -36061,7 +36017,7 @@ rs6000_floatn_mode (int n, bool extended) return DFmode; case 128: - if (TARGET_FLOAT128_KEYWORD) + if (TARGET_FLOAT128_TYPE) return (FLOAT128_IEEE_P (TFmode)) ? TFmode : KFmode; else return opt_scalar_float_mode (); @@ -36151,9 +36107,8 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] = { "dlmzb", OPTION_MASK_DLMZB, false, true }, { "efficient-unaligned-vsx", OPTION_MASK_EFFICIENT_UNALIGNED_VSX, false, true }, - { "float128", OPTION_MASK_FLOAT128_KEYWORD, false, false }, - { "float128-type", OPTION_MASK_FLOAT128_TYPE, false, false }, - { "float128-hardware", OPTION_MASK_FLOAT128_HW, false, false }, + { "float128", OPTION_MASK_FLOAT128_KEYWORD, false, true }, + { "float128-hardware", OPTION_MASK_FLOAT128_HW, false, true }, { "fprnd", OPTION_MASK_FPRND, false, true }, { "hard-dfp", OPTION_MASK_DFP, false, true }, { "htm", OPTION_MASK_HTM, false, true }, diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 9bf32dbe9b9..20f5b6acffa 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -639,7 +639,7 @@ extern int rs6000_vector_align[]; #define MASK_DIRECT_MOVE OPTION_MASK_DIRECT_MOVE #define MASK_DLMZB OPTION_MASK_DLMZB #define MASK_EABI OPTION_MASK_EABI -#define MASK_FLOAT128_TYPE OPTION_MASK_FLOAT128_TYPE +#define MASK_FLOAT128_KEYWORD OPTION_MASK_FLOAT128_KEYWORD #define MASK_FPRND OPTION_MASK_FPRND #define MASK_P8_FUSION OPTION_MASK_P8_FUSION #define MASK_HARD_FLOAT OPTION_MASK_HARD_FLOAT @@ -2531,7 +2531,7 @@ extern int frame_pointer_needed; #define RS6000_BTM_HARD_FLOAT MASK_SOFT_FLOAT /* Hardware floating point. */ #define RS6000_BTM_LDBL128 MASK_MULTIPLE /* 128-bit long double. */ #define RS6000_BTM_64BIT MASK_64BIT /* 64-bit addressing. */ -#define RS6000_BTM_FLOAT128 MASK_FLOAT128_TYPE /* IEEE 128-bit float. */ +#define RS6000_BTM_FLOAT128 MASK_FLOAT128_KEYWORD /* IEEE 128-bit float. */ #define RS6000_BTM_COMMON (RS6000_BTM_ALTIVEC \ | RS6000_BTM_VSX \ diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 280ce49d6b1..c42818fbc04 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -100,6 +100,14 @@ HOST_WIDE_INT rs6000_builtin_mask TargetVariable unsigned int rs6000_debug +;; Whether to enable the -mfloat128 stuff without necessarily enabling the +;; __float128 keyword. +TargetSave +unsigned char x_TARGET_FLOAT128_TYPE + +Variable +unsigned char TARGET_FLOAT128_TYPE + ;; This option existed in the past, but now is always on. mpowerpc Target RejectNegative Undocumented Ignore @@ -562,14 +570,6 @@ mmodulo Target Undocumented Report Mask(MODULO) Var(rs6000_isa_flags) Generate the integer modulo instructions. -; We want to enable the internal support for the IEEE 128-bit floating point -; type without necessarily enabling the __float128 keyword. This is to allow -; Boost and other libraries that know about __float128 to work until the -; official library support is finished. -mfloat128-type -Target Undocumented Mask(FLOAT128_TYPE) Var(rs6000_isa_flags) -Allow the IEEE 128-bit types without requiring the __float128 keyword. - mfloat128 Target Report Mask(FLOAT128_KEYWORD) Var(rs6000_isa_flags) Enable IEEE 128-bit floating point via the __float128 keyword. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 88edc937d86..6c844c6ab76 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -22014,15 +22014,21 @@ Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point and use either software emulation for IEEE 128-bit floating point or hardware instructions. -The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or -@option{-mcpu=power8}) must be enabled to use the @option{-mfloat128} -option. The @option{-mfloat128} option only works on PowerPC 64-bit -Linux systems. - -If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the -@option{-mfloat128} option will also enable the generation of ISA 3.0 -IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit -floating point will be done with software emulation. +The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, +@option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to +use the IEEE 128-bit floating point support. The IEEE 128-bit +floating point support only works on PowerPC Linux systems. + +The default for @option{-mfloat128} is enabled on PowerPC Linux +systems using the VSX instruction set, and disabled on other systems. + +If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or +@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating +point support will also enable the generation of ISA 3.0 IEEE 128-bit +floating point instructions. Otherwise, if you do not specify to +generate ISA 3.0 instructions or you are targeting a 32-bit big endian +system, IEEE 128-bit floating point will be done with software +emulation. @item -mfloat128-hardware @itemx -mno-float128-hardware @@ -22031,12 +22037,9 @@ floating point will be done with software emulation. Enable/disable using ISA 3.0 hardware instructions to support the @var{__float128} data type. -If you use @option{-mfloat128-hardware}, it will enable the option -@option{-mfloat128} as well. - -If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do -not use either @option{-mfloat128} or @option{-mfloat128-hardware}, -the IEEE 128-bit floating point support will not be enabled. +The default for @option{-mfloat128-hardware} is enabled on PowerPC +Linux systems using the ISA 3.0 instruction set, and disabled on other +systems. @item -mfloat-gprs=@var{yes/single/double/no} @itemx -mfloat-gprs diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b850fb5b10..7edf509b554 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,22 @@ +2017-09-07 Michael Meissner + + * gcc.target/powerpc/float128-1.c: Update options to know that + -mfloat128 is now on by default on PowerPC VSX systems. Remove + -static-libgcc option which is no longer needed. Use -mvsx or + -mpower9-vector to enable VSX or hardware IEEE support, rather + than specifying a particular CPU. + * gcc.target/powerpc/float128-2.c: Likewise. + * gcc.target/powerpc/float128-cmp.c: Likewise. + * gcc.target/powerpc/float128-complex-1.c: Likewise. + * gcc.target/powerpc/float128-complex-2.c: Likewise. + * gcc.target/powerpc/float128-hw.c: Likewise. + * gcc.target/powerpc/float128-mix.c: Likewise. + * gcc.target/powerpc/float128-type-1.c: Likewise. + * gcc.target/powerpc/float128-type-2.c: Likewise. + * gcc.target/powerpc/float128-3.c: New test. + * gcc.target/powerpc/float128-4.c: Likewise. + * gcc.target/powerpc/float128-5.c: Likewise. + 2017-09-06 Wilco Dijkstra PR middle-end/78468 diff --git a/gcc/testsuite/gcc.target/powerpc/float128-1.c b/gcc/testsuite/gcc.target/powerpc/float128-1.c index b8e71ceaaae..8a4565341b6 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-1.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-1.c @@ -1,6 +1,7 @@ /* { dg-do run { target { powerpc*-*-linux* } } } */ /* { dg-require-effective-target ppc_float128_sw } */ -/* { dg-options "-mcpu=power7 -O2 -mfloat128 -static-libgcc" } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O2" } */ #ifdef DEBUG #include diff --git a/gcc/testsuite/gcc.target/powerpc/float128-2.c b/gcc/testsuite/gcc.target/powerpc/float128-2.c index f517686bd25..63b0f8d35bd 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-2.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-2.c @@ -1,6 +1,7 @@ /* { dg-do run { target { powerpc*-*-linux* } } } */ /* { dg-require-effective-target ppc_float128_sw } */ -/* { dg-options "-mcpu=power7 -O2 -mfloat128 -static-libgcc" } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O2" } */ /* * Test program to make sure we are getting more precision than the 53 bits we diff --git a/gcc/testsuite/gcc.target/powerpc/float128-3.c b/gcc/testsuite/gcc.target/powerpc/float128-3.c new file mode 100644 index 00000000000..6daf290d12b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/float128-3.c @@ -0,0 +1,21 @@ +/* { dg-do compile { target { powerpc*-*-linux* } } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O2 -mvsx -mno-float128" } */ + +/* Test that we can use #pragma GCC target to enable -mfloat128. */ + +#ifdef __FLOAT128__ +#error "-mno-float128 should disable initially defining __FLOAT128__" +#endif + +#pragma GCC target("float128") + +#ifndef __FLOAT128__ +#error "#pragma GCC target(\"float128\") should enable -mfloat128" +#endif + +__float128 +qadd (__float128 a, __float128 b) +{ + return a+b; +} diff --git a/gcc/testsuite/gcc.target/powerpc/float128-1.c b/gcc/testsuite/gcc.target/powerpc/float128-4.c similarity index 72% copy from gcc/testsuite/gcc.target/powerpc/float128-1.c copy to gcc/testsuite/gcc.target/powerpc/float128-4.c index b8e71ceaaae..00b18881a0b 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-1.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-4.c @@ -1,6 +1,10 @@ /* { dg-do run { target { powerpc*-*-linux* } } } */ /* { dg-require-effective-target ppc_float128_sw } */ -/* { dg-options "-mcpu=power7 -O2 -mfloat128 -static-libgcc" } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O2" } */ + +/* This is the same as test float128-1.c, using the _Float128 keyword instead + of __float128, and not using -mfloat128. */ #ifdef DEBUG #include @@ -10,19 +14,19 @@ #endif #if !defined(__FLOAT128__) || !defined(_ARCH_PPC) -static __float128 -pass_through (__float128 x) +static _Float128 +pass_through (_Float128 x) { return x; } -__float128 (*no_optimize) (__float128) = pass_through; +_Float128 (*no_optimize) (_Float128) = pass_through; #endif #ifdef DEBUG __attribute__((__noinline__)) static void -print_f128 (__float128 x) +print_f128 (_Float128 x) { unsigned sign; unsigned exponent; @@ -48,7 +52,7 @@ print_f128 (__float128 x) #endif union { - __float128 f128; + _Float128 f128; struct ieee128 s128; } u; @@ -71,7 +75,7 @@ print_f128 (__float128 x) __attribute__((__noinline__)) static void -do_test (__float128 expected, __float128 got, const char *name) +do_test (_Float128 expected, _Float128 got, const char *name) { int equal_p = (expected == got); @@ -93,21 +97,22 @@ do_test (__float128 expected, __float128 got, const char *name) int main (void) { - __float128 one = 1.0q; - __float128 two = 2.0q; - __float128 three = 3.0q; - __float128 four = 4.0q; - __float128 five = 5.0q; - __float128 add_result = (1.0q + 2.0q); - __float128 mul_result = ((1.0q + 2.0q) * 3.0q); - __float128 div_result = (((1.0q + 2.0q) * 3.0q) / 4.0q); - __float128 sub_result = ((((1.0q + 2.0q) * 3.0q) / 4.0q) - 5.0q); - __float128 neg_result = - sub_result; - __float128 add_xresult; - __float128 mul_xresult; - __float128 div_xresult; - __float128 sub_xresult; - __float128 neg_xresult; + _Float128 one = 1.0f128; + _Float128 two = 2.0f128; + _Float128 three = 3.0f128; + _Float128 four = 4.0f128; + _Float128 five = 5.0f128; + _Float128 add_result = (1.0f128 + 2.0f128); + _Float128 mul_result = ((1.0f128 + 2.0f128) * 3.0f128); + _Float128 div_result = (((1.0f128 + 2.0f128) * 3.0f128) / 4.0f128); + _Float128 sub_result = ((((1.0f128 + 2.0f128) * 3.0f128) / 4.0f128) + - 5.0f128); + _Float128 neg_result = - sub_result; + _Float128 add_xresult; + _Float128 mul_xresult; + _Float128 div_xresult; + _Float128 sub_xresult; + _Float128 neg_xresult; #if defined(__FLOAT128__) && defined(_ARCH_PPC) __asm__ (" #prevent constant folding, %x0" : "+wa" (one)); diff --git a/gcc/testsuite/gcc.target/powerpc/float128-5.c b/gcc/testsuite/gcc.target/powerpc/float128-5.c new file mode 100644 index 00000000000..f3cfee9baae --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/float128-5.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target { powerpc*-*-linux* } } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-O2 -mpower9-vector -mno-float128" } */ + +/* Test that we can use #pragma GCC target to enable -mfloat128 and generate + code on ISA 3.0 for the float128 built-in functions. */ + +#ifdef __FLOAT128__ +#error "-mno-float128 should disable initially defining __FLOAT128__" +#endif + +#pragma GCC target("float128") + +#ifndef __FLOAT128__ +#error "#pragma GCC target(\"float128\") should enable -mfloat128" +#endif + +__float128 +qabs (__float128 a) +{ + return __builtin_fabsq (a); +} + +/* { dg-final { scan-assembler "xsabsqp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/float128-cmp.c b/gcc/testsuite/gcc.target/powerpc/float128-cmp.c index 247abc0f7d9..ede510d8484 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-cmp.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-cmp.c @@ -1,6 +1,6 @@ /* { dg-do run { target { powerpc*-*-linux* } } } */ /* { dg-require-effective-target ppc_float128_sw } */ -/* { dg-options "-mvsx -O2 -mfloat128" } */ +/* { dg-options "-mvsx -O2" } */ #include #include diff --git a/gcc/testsuite/gcc.target/powerpc/float128-complex-1.c b/gcc/testsuite/gcc.target/powerpc/float128-complex-1.c index 4e3b3253caf..008cc17643f 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-complex-1.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-complex-1.c @@ -1,7 +1,6 @@ /* { dg-do compile { target { powerpc*-*-linux* } } } */ /* { dg-require-effective-target powerpc_float128_sw_ok } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-O2 -mcpu=power7 -mfloat128" } */ +/* { dg-options "-O2 -mvsx" } */ #ifndef NO_FLOAT typedef _Complex float float_complex; diff --git a/gcc/testsuite/gcc.target/powerpc/float128-complex-2.c b/gcc/testsuite/gcc.target/powerpc/float128-complex-2.c index 06dd8e2f01b..2364e1288c2 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-complex-2.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-complex-2.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc*-*-linux* } } } */ /* { dg-require-effective-target powerpc_float128_hw_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-O2 -mcpu=power9 -mfloat128 -mfloat128-hardware" } */ +/* { dg-options "-O2 -mpower9-vector -mfloat128-hardware" } */ #ifndef NO_FLOAT typedef _Complex float float_complex; diff --git a/gcc/testsuite/gcc.target/powerpc/float128-hw.c b/gcc/testsuite/gcc.target/powerpc/float128-hw.c index 65958bcac83..68e4c27aa58 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-hw.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-hw.c @@ -1,7 +1,6 @@ /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O2 -mfloat128" } */ +/* { dg-options "-mpower9-vector -O2" } */ __float128 f128_add (__float128 a, __float128 b) { return a+b; } __float128 f128_sub (__float128 a, __float128 b) { return a-b; } diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix.c b/gcc/testsuite/gcc.target/powerpc/float128-mix.c index 8979cdfcd4d..71f840c9490 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-mix.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-mix.c @@ -1,7 +1,6 @@ /* { dg-do compile { target { powerpc*-*-linux* } } } */ -/* { dg-require-effective-target powerpc_float128_sw_ok } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-O2 -mcpu=power7 -mfloat128" } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O2 -mvsx" } */ /* Test to make sure that __float128 and long double cannot be combined together. */ diff --git a/gcc/testsuite/gcc.target/powerpc/float128-type-1.c b/gcc/testsuite/gcc.target/powerpc/float128-type-1.c index a8326bd9630..e148948a4b0 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-type-1.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-type-1.c @@ -1,16 +1,21 @@ /* { dg-do compile { target { powerpc64*-*-linux* && lp64 } } } */ -/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2" } */ +/* { dg-options "-mcpu=power8 -O2 -mno-float128" } */ -/* This test tests whether -mfloat128-type (which enables the underlying IEEE - 128-bit floating point) is enabled by default on VSX Linux 64-bit systems, - even if the keywords __float128 and _Float128 (-mfloat128) are not enabled - via the -mfloat128 switch. Test that power8 generates a call to the +/* This test tests whether the underlying IEEE 128-bit floating point) is + enabled by default on VSX Linux 64-bit systems, even if the keyword + __float128 is not enabled . Test that power8 generates a call to the __addkf3 emulation function. */ +#ifdef __LONG_DOUBLE_IEEE128 +typedef double __attribute__((__mode__(__TF__))) f128_t; +typedef _Complex double __attribute__((__mode__(__TC__))) f128c_t; + +#else typedef double __attribute__((__mode__(__KF__))) f128_t; typedef _Complex double __attribute__((__mode__(__KC__))) f128c_t; +#endif f128_t add_scalar (f128_t a, f128_t b) diff --git a/gcc/testsuite/gcc.target/powerpc/float128-type-2.c b/gcc/testsuite/gcc.target/powerpc/float128-type-2.c index c5d6e35e5a8..99100f1d3da 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-type-2.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-type-2.c @@ -1,19 +1,21 @@ /* { dg-do compile { target { powerpc64-*-linux* && lp64 } } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O2" } */ +/* { dg-options "-mcpu=power9 -O2 -mno-float128" } */ -/* This test tests whether -mfloat128-type (which enables the underlying IEEE - 128-bit floating point) is enabled by default on VSX Linux 64-bit systems, - even if the keywords __float128 and _Float128 (-mfloat128) are not enabled - via the -mfloat128 switch. Test that power9 generates the xsaddqp +/* This test tests whether the underlying IEEE 128-bit floating point) is + enabled by default on VSX Linux 64-bit systems, even if the keyword + __float128 is not enabled . Test that power9 generates the xsaddqp instruction. */ -/* The effective target powerpc_float128_hw_ok is not used, as that will pass - -mfloat128. */ +#ifdef __LONG_DOUBLE_IEEE128 +typedef double __attribute__((__mode__(__TF__))) f128_t; +typedef _Complex double __attribute__((__mode__(__TC__))) f128c_t; +#else typedef double __attribute__((__mode__(__KF__))) f128_t; typedef _Complex double __attribute__((__mode__(__KC__))) f128c_t; +#endif f128_t add_scalar (f128_t a, f128_t b) -- 2.11.4.GIT