Currently, we have no front-end type for ppc_fp128 type in IR. PowerPC target generates ppc_fp128 type from long double now, but there's option (-mabi=(ieee|ibm)longdouble) to control it and we're going to do transition from IBM extended double-double ppc_fp128 to IEEE fp128 in the future. This patch adds type __ibm128 which always represents ppc_fp128 in IR, as what GCC did for that type. Without this type in Clang, compilation will fail if compiling against future version of libstdcxx (which uses __ibm128 in headers). Although all operations in backend for __ibm128 is done by software, only PowerPC enables support for it. There's something not implemented in this commit, which can be done in future ones: - Literal suffix for __ibm128 type. w/W is suitable as GCC documented. - __attribute__((mode(IF))) should be for __ibm128. - Complex __ibm128 type. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D93377
62 lines
2.4 KiB
C++
62 lines
2.4 KiB
C++
// RUN: %clang_cc1 -verify -std=gnu++11 %s
|
|
// RUN: %clang_cc1 -verify -std=c++11 %s
|
|
// RUN: %clang_cc1 -triple powerpc64-linux -verify -std=c++11 %s
|
|
// RUN: %clang_cc1 -triple i686-windows-gnu -verify -std=c++11 %s
|
|
// RUN: %clang_cc1 -triple x86_64-windows-gnu -verify -std=c++11 %s
|
|
// RUN: %clang_cc1 -triple x86_64-windows-msvc -verify -std=c++11 %s
|
|
|
|
#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
|
|
|
|
#if defined(__ppc__)
|
|
template <typename> struct __is_float128 { static constexpr bool value = false; };
|
|
template <> struct __is_float128<__float128> { static constexpr bool value = true; };
|
|
static_assert(__is_float128<__ieee128>::value, "__ieee128 aliases to __float128");
|
|
#endif
|
|
|
|
__float128 f;
|
|
template<typename> struct __is_floating_point_helper {};
|
|
template<> struct __is_floating_point_helper<__float128> {};
|
|
int g(int x, __float128 *y) {
|
|
return x + *y;
|
|
}
|
|
|
|
// expected-no-error {{__float128 is not supported on this target}}
|
|
#else
|
|
#if !defined(__STRICT_ANSI__)
|
|
__float128 f; // expected-error {{__float128 is not supported on this target}}
|
|
// But this should work:
|
|
template<typename> struct __is_floating_point_helper {};
|
|
template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}}
|
|
|
|
// FIXME: This could have a better diag.
|
|
int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}}
|
|
return x + *y;
|
|
}
|
|
|
|
#else
|
|
__float128 f; // expected-error {{__float128 is not supported on this target}}
|
|
template<typename> struct __is_floating_point_helper {};
|
|
template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}}
|
|
|
|
int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}}
|
|
return x + *y;
|
|
}
|
|
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef __ppc__
|
|
__ibm128 i;
|
|
template <> struct __is_floating_point_helper<__ibm128> {};
|
|
int w(int x, __ibm128 *y) {
|
|
return x + *y;
|
|
}
|
|
// expected-no-error {{__ibm128 is not supported on this target}}
|
|
#else
|
|
__ibm128 i; // expected-error {{__ibm128 is not supported on this target}}
|
|
template <> struct __is_floating_point_helper<__ibm128> {}; // expected-error {{__ibm128 is not supported on this target}}
|
|
int w(int x, __ibm128 *y) { // expected-error {{__ibm128 is not supported on this target}}
|
|
return x + *y;
|
|
}
|
|
#endif
|