[PATCH] D19125: Enable __float128 on X86_64
Nemanja Ivanovic via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 14 10:40:04 PDT 2016
nemanjai created this revision.
nemanjai added reviewers: echristo, bruno, nadav, hfinkel.
nemanjai added a subscriber: llvm-commits.
nemanjai set the repository for this revision to rL LLVM.
It would appear that gcc supports the __float128 type on X86_64. Systems with this architecture that I've seen have the GNU C++ library configured with _GLIBCXX_USE_FLOAT128 defined. This in turn is used in at least one header (type_traits) and there is one template specialization with this type in the header. As a result, Clang no longer compiles this header with -std=gnu++11.
This patch enables this type on X86_64 targets.
Repository:
rL LLVM
http://reviews.llvm.org/D19125
Files:
lib/Basic/Targets.cpp
test/Sema/128bitfloat.cpp
test/Sema/attr-mode.c
Index: test/Sema/attr-mode.c
===================================================================
--- test/Sema/attr-mode.c
+++ test/Sema/attr-mode.c
@@ -76,7 +76,7 @@
void test_long_to_i64(long* y) { f_i64_arg(y); }
void test_long_to_ui64(unsigned long* y) { f_ui64_arg(y); }
#endif
-typedef float f128ibm __attribute__ ((mode (TF))); // expected-error{{unsupported machine mode 'TF'}}
+typedef float f128ibm __attribute__ ((mode (TF)));
#elif TEST_64BIT_PPC64
typedef float f128ibm __attribute__ ((mode (TF)));
typedef _Complex float c128ibm __attribute__ ((mode (TC)));
Index: test/Sema/128bitfloat.cpp
===================================================================
--- test/Sema/128bitfloat.cpp
+++ test/Sema/128bitfloat.cpp
@@ -1,6 +1,16 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++11 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+#ifdef __x86_64__
+__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-diagnostics
+#else
#if !defined(__STRICT_ANSI__)
__float128 f; // expected-error {{__float128 is not supported on this target}}
// But this should work:
@@ -22,3 +32,4 @@
}
#endif
+#endif
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4170,6 +4170,10 @@
unsigned getUnwindWordWidth() const override { return 64; }
unsigned getRegisterWidth() const override { return 64; }
+ bool hasFloat128Type() const override {
+ return true;
+ }
+
bool validateGlobalRegisterVariable(StringRef RegName,
unsigned RegSize,
bool &HasSizeMismatch) const override {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19125.53752.patch
Type: text/x-patch
Size: 1883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160414/ac014afb/attachment.bin>
More information about the llvm-commits
mailing list