if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128)
{
+ /* Determine if the user can change the default long double type at
+ compilation time. Only C and C++ support this, and you need GLIBC
+ 2.32 or newer. Only issue one warning. */
static bool warned_change_long_double;
- if (!warned_change_long_double)
+
+ if (!warned_change_long_double
+ && (!OPTION_GLIBC
+ || (!lang_GNU_C () && !lang_GNU_CXX ())
+ || ((TARGET_GLIBC_MAJOR * 1000) + TARGET_GLIBC_MINOR) < 2032))
{
warned_change_long_double = true;
if (TARGET_IEEEQUAD)
if (!TARGET_FLOAT128_CVT)
{
- if ((mode1 == KFmode && mode2 == IFmode)
- || (mode1 == IFmode && mode2 == KFmode))
- return N_("__float128 and __ibm128 cannot be used in the same "
- "expression");
-
- if (TARGET_IEEEQUAD
- && ((mode1 == IFmode && mode2 == TFmode)
- || (mode1 == TFmode && mode2 == IFmode)))
- return N_("__ibm128 and long double cannot be used in the same "
- "expression");
-
- if (!TARGET_IEEEQUAD
- && ((mode1 == KFmode && mode2 == TFmode)
- || (mode1 == TFmode && mode2 == KFmode)))
- return N_("__float128 and long double cannot be used in the same "
- "expression");
+ if ((FLOAT128_IEEE_P (mode1) && FLOAT128_IBM_P (mode2))
+ || (FLOAT128_IBM_P (mode1) && FLOAT128_IEEE_P (mode2)))
+ return N_("Invalid mixing of IEEE 128-bit and IBM 128-bit floating "
+ "point types");
}
return NULL;
--- /dev/null
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ieeelongdouble -mlong-double-128" } */
+
+/* Test to make sure that __float128 and long double do not generate errors if
+ long double uses the IEEE 128-bit format. */
+__float128
+add (__float128 a, long double b)
+{
+ return a+b;
+}
+
+long double
+sub (long double a, __float128 b)
+{
+ return a-b;
+}
--- /dev/null
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
+
+/* Test to make sure that __float128 and __ibm128 cannot be combined
+ together. */
+__float128
+add (__float128 a, __ibm128 b)
+{
+ return a+b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
+
+__ibm128
+sub (__ibm128 a, __float128 b)
+{
+ return a-b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
-/* { dg-options "-O2 -mvsx" } */
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
-
-/* Test to make sure that __float128 and long double cannot be combined together. */
-__float128 add (__float128 a, long double b)
+/* Test to make sure that __float128 and long double cannot be combined
+ together, when long double uses the IBM extended double format, and
+ __float128 uses the IEEE 128-bit format. */
+__float128
+add (__float128 a, long double b)
{
- return a+b; /* { dg-error "__float128 and long double cannot be used in the same expression" } */
+ return a+b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
}
-__ibm128 sub (long double a, __float128 b)
+long double
+sub (long double a, __float128 b)
{
- return a-b; /* { dg-error "__float128 and long double cannot be used in the same expression" } */
+ return a-b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
}