aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.vnet.ibm.com>2017-11-06 18:31:48 +0000
committerMichael Meissner <meissner@gcc.gnu.org>2017-11-06 18:31:48 +0000
commitaeed6d61ef523e1a651ac146c020e499631e4ed2 (patch)
tree4750f4bf2c74b38c4131d0dd014c672688dd60ff /gcc
parent65371a7eddd37f9d5d15790486296cb441cabb40 (diff)
downloadgcc-aeed6d61ef523e1a651ac146c020e499631e4ed2.zip
gcc-aeed6d61ef523e1a651ac146c020e499631e4ed2.tar.gz
gcc-aeed6d61ef523e1a651ac146c020e499631e4ed2.tar.bz2
re PR target/82748 (ICE with __builtin_fabsq and __float128 in copy_to_mode_reg, at explow.c:612)
[gcc] 2017-11-06 Michael Meissner <meissner@linux.vnet.ibm.com> PR target/82748 * config/rs6000/rs6000-builtin.def (BU_FLOAT128_1): Delete float128 helper macros, which are no longer used after deleting the old 'q' built-in functions, and moving the round to odd built-in functions to being special built-in functions. (BU_FLOAT128_2): Likewise. (BU_FLOAT128_1_HW): Likewise. (BU_FLOAT128_2_HW): Likewise. (BU_FLOAT128_3_HW): Likewise. (FABSQ): Delete old 'q' built-in functions. (COPYSIGNQ): Likewise. (SQRTF128_ODD): Move round to odd built-in functions to be special built-in functions, so that we can handle -mabi=ieeelongdouble. (TRUNCF128_ODD): Likewise. (ADDF128_ODD): Likewise. (SUBF128_ODD): Likewise. (MULF128_ODD): Likewise. (DIVF128_ODD): Likewise. (FMAF128_ODD): Likewise. * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Map old 'q' built-in names to 'f128'. * config/rs6000/rs6000.c (rs6000_fold_builtin): Remove folding the old 'q' built-in functions, as the machine independent code for 'f128' built-in functions handles this. (rs6000_expand_builtin): Add expansion for float128 round to odd functions, keying off on -mabi=ieeelongdouble of whether to use the KFmode or TFmode variant. (rs6000_init_builtins): Initialize the _Float128 round to odd built-in functions. * doc/extend.texi (PowerPC Built-in Functions): Document the old _Float128 'q' built-in functions are now mapped into the new 'f128' built-in functions. [gcc/testsuite] 2017-11-06 Michael Meissner <meissner@linux.vnet.ibm.com> PR target/82748 * gcc.target/powerpc/pr82748-1.c: New test. * gcc.target/powerpc/pr82748-2.c: Likewise. From-SVN: r254462
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog36
-rw-r--r--gcc/config/rs6000/rs6000-builtin.def91
-rw-r--r--gcc/config/rs6000/rs6000-c.c11
-rw-r--r--gcc/config/rs6000/rs6000.c106
-rw-r--r--gcc/doc/extend.texi35
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr82748-1.c82
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr82748-2.c46
8 files changed, 279 insertions, 134 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 798cc37..3663017 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,39 @@
+2017-11-06 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/82748
+ * config/rs6000/rs6000-builtin.def (BU_FLOAT128_1): Delete
+ float128 helper macros, which are no longer used after deleting
+ the old 'q' built-in functions, and moving the round to odd
+ built-in functions to being special built-in functions.
+ (BU_FLOAT128_2): Likewise.
+ (BU_FLOAT128_1_HW): Likewise.
+ (BU_FLOAT128_2_HW): Likewise.
+ (BU_FLOAT128_3_HW): Likewise.
+ (FABSQ): Delete old 'q' built-in functions.
+ (COPYSIGNQ): Likewise.
+ (SQRTF128_ODD): Move round to odd built-in functions to be
+ special built-in functions, so that we can handle
+ -mabi=ieeelongdouble.
+ (TRUNCF128_ODD): Likewise.
+ (ADDF128_ODD): Likewise.
+ (SUBF128_ODD): Likewise.
+ (MULF128_ODD): Likewise.
+ (DIVF128_ODD): Likewise.
+ (FMAF128_ODD): Likewise.
+ * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Map old 'q'
+ built-in names to 'f128'.
+ * config/rs6000/rs6000.c (rs6000_fold_builtin): Remove folding the
+ old 'q' built-in functions, as the machine independent code for
+ 'f128' built-in functions handles this.
+ (rs6000_expand_builtin): Add expansion for float128 round to odd
+ functions, keying off on -mabi=ieeelongdouble of whether to use
+ the KFmode or TFmode variant.
+ (rs6000_init_builtins): Initialize the _Float128 round to odd
+ built-in functions.
+ * doc/extend.texi (PowerPC Built-in Functions): Document the old
+ _Float128 'q' built-in functions are now mapped into the new
+ 'f128' built-in functions.
+
2017-11-06 David Edelsohn <dje.gcc@gmail.com>
* collect2.c (add_lto_object): Compile for OBJECT_COFF.
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index c8a425c..86857c7 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -660,48 +660,6 @@
| RS6000_BTC_BINARY), \
CODE_FOR_ ## ICODE) /* ICODE */
-/* IEEE 128-bit floating-point builtins. */
-#define BU_FLOAT128_2(ENUM, NAME, ATTR, ICODE) \
- RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \
- "__builtin_" NAME, /* NAME */ \
- RS6000_BTM_FLOAT128, /* MASK */ \
- (RS6000_BTC_ ## ATTR /* ATTR */ \
- | RS6000_BTC_BINARY), \
- CODE_FOR_ ## ICODE) /* ICODE */
-
-#define BU_FLOAT128_1(ENUM, NAME, ATTR, ICODE) \
- RS6000_BUILTIN_1 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \
- "__builtin_" NAME, /* NAME */ \
- RS6000_BTM_FLOAT128, /* MASK */ \
- (RS6000_BTC_ ## ATTR /* ATTR */ \
- | RS6000_BTC_UNARY), \
- CODE_FOR_ ## ICODE) /* ICODE */
-
-/* IEEE 128-bit floating-point builtins that need the ISA 3.0 hardware. */
-#define BU_FLOAT128_1_HW(ENUM, NAME, ATTR, ICODE) \
- RS6000_BUILTIN_1 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \
- "__builtin_" NAME, /* NAME */ \
- RS6000_BTM_FLOAT128_HW, /* MASK */ \
- (RS6000_BTC_ ## ATTR /* ATTR */ \
- | RS6000_BTC_UNARY), \
- CODE_FOR_ ## ICODE) /* ICODE */
-
-#define BU_FLOAT128_2_HW(ENUM, NAME, ATTR, ICODE) \
- RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \
- "__builtin_" NAME, /* NAME */ \
- RS6000_BTM_FLOAT128_HW, /* MASK */ \
- (RS6000_BTC_ ## ATTR /* ATTR */ \
- | RS6000_BTC_BINARY), \
- CODE_FOR_ ## ICODE) /* ICODE */
-
-#define BU_FLOAT128_3_HW(ENUM, NAME, ATTR, ICODE) \
- RS6000_BUILTIN_3 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \
- "__builtin_" NAME, /* NAME */ \
- RS6000_BTM_FLOAT128_HW, /* MASK */ \
- (RS6000_BTC_ ## ATTR /* ATTR */ \
- | RS6000_BTC_TERNARY), \
- CODE_FOR_ ## ICODE) /* ICODE */
-
/* Miscellaneous builtins for instructions added in ISA 3.0. These
instructions don't require either the DFP or VSX options, just the basic
ISA 3.0 enablement since they operate on general purpose registers. */
@@ -2365,23 +2323,6 @@ BU_P9_64BIT_2 (CMPEQB, "byte_in_set", CONST, cmpeqb)
BU_P9_OVERLOAD_2 (CMPRB, "byte_in_range")
BU_P9_OVERLOAD_2 (CMPRB2, "byte_in_either_range")
BU_P9_OVERLOAD_2 (CMPEQB, "byte_in_set")
-
-/* 1 and 2 argument IEEE 128-bit floating-point functions. These functions use
- the older 'q' suffix from libquadmath. The standard built-in functions
- support fabsf128 and copysignf128, but older code used these 'q' versions,
- so keep them around. */
-BU_FLOAT128_1 (FABSQ, "fabsq", CONST, abskf2)
-BU_FLOAT128_2 (COPYSIGNQ, "copysignq", CONST, copysignkf3)
-
-/* 1, 2, and 3 argument IEEE 128-bit floating point functions that require ISA
- 3.0 hardware. These functions use the new 'f128' suffix. */
-BU_FLOAT128_1_HW (SQRTF128_ODD, "sqrtf128_round_to_odd", CONST, sqrtkf2_odd)
-BU_FLOAT128_1_HW (TRUNCF128_ODD, "truncf128_round_to_odd", CONST, trunckfdf2_odd)
-BU_FLOAT128_2_HW (ADDF128_ODD, "addf128_round_to_odd", CONST, addkf3_odd)
-BU_FLOAT128_2_HW (SUBF128_ODD, "subf128_round_to_odd", CONST, subkf3_odd)
-BU_FLOAT128_2_HW (MULF128_ODD, "mulf128_round_to_odd", CONST, mulkf3_odd)
-BU_FLOAT128_2_HW (DIVF128_ODD, "divf128_round_to_odd", CONST, divkf3_odd)
-BU_FLOAT128_3_HW (FMAF128_ODD, "fmaf128_round_to_odd", CONST, fmakf4_odd)
/* 1 argument crypto functions. */
BU_CRYPTO_1 (VSBOX, "vsbox", CONST, crypto_vsbox)
@@ -2517,17 +2458,33 @@ BU_SPECIAL_X (RS6000_BUILTIN_CPU_IS, "__builtin_cpu_is",
BU_SPECIAL_X (RS6000_BUILTIN_CPU_SUPPORTS, "__builtin_cpu_supports",
RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
-BU_SPECIAL_X (RS6000_BUILTIN_NANQ, "__builtin_nanq",
- RS6000_BTM_FLOAT128, RS6000_BTC_CONST)
+BU_SPECIAL_X (FLOAT128_BUILTIN_SQRTF128_ODD,
+ "__builtin_sqrtf128_round_to_odd",
+ RS6000_BTM_FLOAT128_HW, RS6000_BTC_MISC)
+
+BU_SPECIAL_X (FLOAT128_BUILTIN_TRUNCF128_ODD,
+ "__builtin_truncf128_round_to_odd",
+ RS6000_BTM_FLOAT128_HW, RS6000_BTC_MISC)
+
+BU_SPECIAL_X (FLOAT128_BUILTIN_ADDF128_ODD,
+ "__builtin_addf128_round_to_odd",
+ RS6000_BTM_FLOAT128_HW, RS6000_BTC_MISC)
+
+BU_SPECIAL_X (FLOAT128_BUILTIN_SUBF128_ODD,
+ "__builtin_subf128_round_to_odd",
+ RS6000_BTM_FLOAT128_HW, RS6000_BTC_MISC)
-BU_SPECIAL_X (RS6000_BUILTIN_NANSQ, "__builtin_nansq",
- RS6000_BTM_FLOAT128, RS6000_BTC_CONST)
+BU_SPECIAL_X (FLOAT128_BUILTIN_MULF128_ODD,
+ "__builtin_mulf128_round_to_odd",
+ RS6000_BTM_FLOAT128_HW, RS6000_BTC_MISC)
-BU_SPECIAL_X (RS6000_BUILTIN_INFQ, "__builtin_infq",
- RS6000_BTM_FLOAT128, RS6000_BTC_CONST)
+BU_SPECIAL_X (FLOAT128_BUILTIN_DIVF128_ODD,
+ "__builtin_divf128_round_to_odd",
+ RS6000_BTM_FLOAT128_HW, RS6000_BTC_MISC)
-BU_SPECIAL_X (RS6000_BUILTIN_HUGE_VALQ, "__builtin_huge_valq",
- RS6000_BTM_FLOAT128, RS6000_BTC_CONST)
+BU_SPECIAL_X (FLOAT128_BUILTIN_FMAF128_ODD,
+ "__builtin_fmaf128_round_to_odd",
+ RS6000_BTM_FLOAT128_HW, RS6000_BTC_MISC)
/* Darwin CfString builtin. */
BU_SPECIAL_X (RS6000_BUILTIN_CFSTRING, "__builtin_cfstring", RS6000_BTM_ALWAYS,
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 8e58124..1e71281 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -683,6 +683,17 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
builtin_define ("__builtin_vsx_xvnmsubmsp=__builtin_vsx_xvnmsubsp");
}
+ /* Map the old _Float128 'q' builtins into the new 'f128' builtins. */
+ if (TARGET_FLOAT128_TYPE)
+ {
+ builtin_define ("__builtin_fabsq=__builtin_fabsf128");
+ builtin_define ("__builtin_copysignq=__builtin_copysignf128");
+ builtin_define ("__builtin_nanq=__builtin_nanf128");
+ builtin_define ("__builtin_nansq=__builtin_nansf128");
+ builtin_define ("__builtin_infq=__builtin_inff128");
+ builtin_define ("__builtin_huge_valq=__builtin_huge_valf128");
+ }
+
/* Tell users they can use __builtin_bswap{16,64}. */
builtin_define ("__HAVE_BSWAP__");
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index e3636dc..b4ab2ab 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16108,39 +16108,11 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode)
from ia64.c. */
static tree
-rs6000_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED,
- tree *args, bool ignore ATTRIBUTE_UNUSED)
+rs6000_fold_builtin (tree fndecl ATTRIBUTE_UNUSED,
+ int n_args ATTRIBUTE_UNUSED,
+ tree *args ATTRIBUTE_UNUSED,
+ bool ignore ATTRIBUTE_UNUSED)
{
- if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
- {
- enum rs6000_builtins fn_code
- = (enum rs6000_builtins) DECL_FUNCTION_CODE (fndecl);
- switch (fn_code)
- {
- case RS6000_BUILTIN_NANQ:
- case RS6000_BUILTIN_NANSQ:
- {
- tree type = TREE_TYPE (TREE_TYPE (fndecl));
- const char *str = c_getstr (*args);
- int quiet = fn_code == RS6000_BUILTIN_NANQ;
- REAL_VALUE_TYPE real;
-
- if (str && real_nan (&real, str, quiet, TYPE_MODE (type)))
- return build_real (type, real);
- return NULL_TREE;
- }
- case RS6000_BUILTIN_INFQ:
- case RS6000_BUILTIN_HUGE_VALQ:
- {
- tree type = TREE_TYPE (TREE_TYPE (fndecl));
- REAL_VALUE_TYPE inf;
- real_inf (&inf);
- return build_real (type, inf);
- }
- default:
- break;
- }
- }
#ifdef SUBTARGET_FOLD_BUILTIN
return SUBTARGET_FOLD_BUILTIN (fndecl, n_args, args, ignore);
#else
@@ -16772,6 +16744,41 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
case RS6000_BUILTIN_CPU_SUPPORTS:
return cpu_expand_builtin (fcode, exp, target);
+ case FLOAT128_BUILTIN_SQRTF128_ODD:
+ return rs6000_expand_unop_builtin (TARGET_IEEEQUAD
+ ? CODE_FOR_sqrttf2_odd
+ : CODE_FOR_sqrtkf2_odd, exp, target);
+
+ case FLOAT128_BUILTIN_TRUNCF128_ODD:
+ return rs6000_expand_unop_builtin (TARGET_IEEEQUAD
+ ? CODE_FOR_trunctfdf2_odd
+ : CODE_FOR_trunckfdf2_odd, exp, target);
+
+ case FLOAT128_BUILTIN_ADDF128_ODD:
+ return rs6000_expand_binop_builtin (TARGET_IEEEQUAD
+ ? CODE_FOR_addtf3_odd
+ : CODE_FOR_addkf3_odd, exp, target);
+
+ case FLOAT128_BUILTIN_SUBF128_ODD:
+ return rs6000_expand_binop_builtin (TARGET_IEEEQUAD
+ ? CODE_FOR_subtf3_odd
+ : CODE_FOR_subkf3_odd, exp, target);
+
+ case FLOAT128_BUILTIN_MULF128_ODD:
+ return rs6000_expand_binop_builtin (TARGET_IEEEQUAD
+ ? CODE_FOR_multf3_odd
+ : CODE_FOR_mulkf3_odd, exp, target);
+
+ case FLOAT128_BUILTIN_DIVF128_ODD:
+ return rs6000_expand_binop_builtin (TARGET_IEEEQUAD
+ ? CODE_FOR_divtf3_odd
+ : CODE_FOR_divkf3_odd, exp, target);
+
+ case FLOAT128_BUILTIN_FMAF128_ODD:
+ return rs6000_expand_ternop_builtin (TARGET_IEEEQUAD
+ ? CODE_FOR_fmatf4_odd
+ : CODE_FOR_fmakf4_odd, exp, target);
+
case ALTIVEC_BUILTIN_MASK_FOR_LOAD:
case ALTIVEC_BUILTIN_MASK_FOR_STORE:
{
@@ -17101,15 +17108,6 @@ rs6000_init_builtins (void)
if (TARGET_EXTRA_BUILTINS || TARGET_PAIRED_FLOAT)
rs6000_common_init_builtins ();
- ftype = build_function_type_list (ieee128_float_type_node,
- const_str_type_node, NULL_TREE);
- def_builtin ("__builtin_nanq", ftype, RS6000_BUILTIN_NANQ);
- def_builtin ("__builtin_nansq", ftype, RS6000_BUILTIN_NANSQ);
-
- ftype = build_function_type_list (ieee128_float_type_node, NULL_TREE);
- def_builtin ("__builtin_infq", ftype, RS6000_BUILTIN_INFQ);
- def_builtin ("__builtin_huge_valq", ftype, RS6000_BUILTIN_HUGE_VALQ);
-
ftype = builtin_function_type (DFmode, DFmode, DFmode, VOIDmode,
RS6000_BUILTIN_RECIP, "__builtin_recipdiv");
def_builtin ("__builtin_recipdiv", ftype, RS6000_BUILTIN_RECIP);
@@ -17159,6 +17157,32 @@ rs6000_init_builtins (void)
def_builtin ("__builtin_cpu_is", ftype, RS6000_BUILTIN_CPU_IS);
def_builtin ("__builtin_cpu_supports", ftype, RS6000_BUILTIN_CPU_SUPPORTS);
+ ftype = build_function_type_list (ieee128_float_type_node,
+ ieee128_float_type_node, NULL_TREE);
+ def_builtin ("__builtin_sqrtf128_round_to_odd", ftype,
+ FLOAT128_BUILTIN_SQRTF128_ODD);
+ def_builtin ("__builtin_truncf128_round_to_odd", ftype,
+ FLOAT128_BUILTIN_TRUNCF128_ODD);
+
+ ftype = build_function_type_list (ieee128_float_type_node,
+ ieee128_float_type_node,
+ ieee128_float_type_node, NULL_TREE);
+ def_builtin ("__builtin_addf128_round_to_odd", ftype,
+ FLOAT128_BUILTIN_ADDF128_ODD);
+ def_builtin ("__builtin_subf128_round_to_odd", ftype,
+ FLOAT128_BUILTIN_SUBF128_ODD);
+ def_builtin ("__builtin_mulf128_round_to_odd", ftype,
+ FLOAT128_BUILTIN_MULF128_ODD);
+ def_builtin ("__builtin_divf128_round_to_odd", ftype,
+ FLOAT128_BUILTIN_DIVF128_ODD);
+
+ ftype = build_function_type_list (ieee128_float_type_node,
+ ieee128_float_type_node,
+ ieee128_float_type_node,
+ ieee128_float_type_node, NULL_TREE);
+ def_builtin ("__builtin_fmaf128_round_to_odd", ftype,
+ FLOAT128_BUILTIN_FMAF128_ODD);
+
/* AIX libm provides clog as __clog. */
if (TARGET_XCOFF &&
(tdecl = builtin_decl_explicit (BUILT_IN_CLOG)) != NULL_TREE)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 8aa443f..63b58c0 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -15547,36 +15547,19 @@ Additional built-in functions are available for the 64-bit PowerPC
family of processors, for efficient use of 128-bit floating point
(@code{__float128}) values.
-The following floating-point built-in functions are available with
-@code{-mfloat128} and Altivec support. All of them implement the
-function that is part of the name.
+Previous versions of GCC supported some 'q' builtins for IEEE 128-bit
+floating point. These functions are now mapped into the equivalent
+'f128' builtin functions.
@smallexample
-__float128 __builtin_fabsq (__float128)
-__float128 __builtin_copysignq (__float128, __float128)
+__builtin_fabsq is mapped into __builtin_fabsf128
+__builtin_copysignq is mapped into __builtin_copysignf128
+__builtin_infq is mapped into __builtin_inff128
+__builtin_huge_valq is mapped into __builtin_huge_valf128
+__builtin_nanq is mapped into __builtin_nanf128
+__builtin_nansq is mapped into __builtin_nansf128
@end smallexample
-The following built-in functions are available with @code{-mfloat128}
-and Altivec support.
-
-@table @code
-@item __float128 __builtin_infq (void)
-Similar to @code{__builtin_inf}, except the return type is @code{__float128}.
-@findex __builtin_infq
-
-@item __float128 __builtin_huge_valq (void)
-Similar to @code{__builtin_huge_val}, except the return type is @code{__float128}.
-@findex __builtin_huge_valq
-
-@item __float128 __builtin_nanq (void)
-Similar to @code{__builtin_nan}, except the return type is @code{__float128}.
-@findex __builtin_nanq
-
-@item __float128 __builtin_nansq (void)
-Similar to @code{__builtin_nans}, except the return type is @code{__float128}.
-@findex __builtin_nansq
-@end table
-
The following built-in functions are available on Linux 64-bit systems
that use the ISA 3.0 instruction set.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b8f7d93..2ab7972 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-06 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/82748
+ * gcc.target/powerpc/pr82748-1.c: New test.
+ * gcc.target/powerpc/pr82748-2.c: Likewise.
+
2017-11-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/65579
diff --git a/gcc/testsuite/gcc.target/powerpc/pr82748-1.c b/gcc/testsuite/gcc.target/powerpc/pr82748-1.c
new file mode 100644
index 0000000..15a746b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr82748-1.c
@@ -0,0 +1,82 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mpower9-vector -O2 -mabi=ieeelongdouble -Wno-psabi" } */
+
+/* Make sure the old 'q' builtin functions work correctly when the long double
+ default has been changed to be IEEE 128-bit floating point. */
+
+_Float128
+do_fabs_f (_Float128 a)
+{
+ return __builtin_fabsq (a);
+}
+
+_Float128
+do_copysign_f (_Float128 a, _Float128 b)
+{
+ return __builtin_copysignq (a, b);
+}
+
+_Float128
+do_inf_f (void)
+{
+ return __builtin_infq ();
+}
+
+_Float128
+do_nan_f (void)
+{
+ return __builtin_nanq ("");
+}
+
+_Float128
+do_nans_f (void)
+{
+ return __builtin_nansq ("");
+}
+
+_Float128
+do_huge_val_f (void)
+{
+ return __builtin_huge_valq ();
+}
+
+long double
+do_fabs_ld (long double a)
+{
+ return __builtin_fabsq (a);
+}
+
+long double
+do_copysign_ld (long double a, long double b)
+{
+ return __builtin_copysignq (a, b);
+}
+
+long double
+do_inf_ld (void)
+{
+ return __builtin_infq ();
+}
+
+long double
+do_nan_ld (void)
+{
+ return __builtin_nanq ("");
+}
+
+long double
+do_nans_ld (void)
+{
+ return __builtin_nansq ("");
+}
+
+long double
+do_huge_val_ld (void)
+{
+ return __builtin_huge_valq ();
+}
+
+/* { dg-final { scan-assembler {\mxsabsqp\M} } } */
+/* { dg-final { scan-assembler {\mxscpsgnqp\M} } } */
+/* { dg-final { scan-assembler-not {\mbl\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr82748-2.c b/gcc/testsuite/gcc.target/powerpc/pr82748-2.c
new file mode 100644
index 0000000..0079394
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr82748-2.c
@@ -0,0 +1,46 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mpower9-vector -O2 -mabi=ibmlongdouble -Wno-psabi" } */
+
+/* Make sure the old 'q' builtin functions work correctly when the long double
+ default uses the IBM double-double format. */
+
+_Float128
+do_fabs (_Float128 a)
+{
+ return __builtin_fabsq (a);
+}
+
+_Float128
+do_copysign (_Float128 a, _Float128 b)
+{
+ return __builtin_copysignq (a, b);
+}
+
+_Float128
+do_inf (void)
+{
+ return __builtin_infq ();
+}
+
+_Float128
+do_nan (void)
+{
+ return __builtin_nanq ("");
+}
+
+_Float128
+do_nans (void)
+{
+ return __builtin_nansq ("");
+}
+
+_Float128
+do_huge_val (void)
+{
+ return __builtin_huge_valq ();
+}
+
+/* { dg-final { scan-assembler {\mxsabsqp\M} } } */
+/* { dg-final { scan-assembler {\mxscpsgnqp\M} } } */
+/* { dg-final { scan-assembler-not {\mbl\M} } } */