return created this revision. return added reviewers: chandlerc, joerg. return added a project: clang. Herald added a subscriber: cfe-commits.
This patch addresses a compilation error with clang when running in Haiku being unable to compile code using __float128 (throws compilation error such as '__float128 is not supported on this target'). Repository: rC Clang https://reviews.llvm.org/D53696 Files: lib/Basic/Targets/OSTargets.h test/CodeGenCXX/float128-declarations.cpp Index: test/CodeGenCXX/float128-declarations.cpp =================================================================== --- test/CodeGenCXX/float128-declarations.cpp +++ test/CodeGenCXX/float128-declarations.cpp @@ -16,6 +16,10 @@ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // RUN: %clang_cc1 -emit-llvm -triple x86_64-pc-solaris2.11 -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple i586-pc-haiku -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-haiku -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // /* Various contexts where type __float128 can appear. The different check prefixes are due to different mangling on X86 and different calling Index: lib/Basic/Targets/OSTargets.h =================================================================== --- lib/Basic/Targets/OSTargets.h +++ lib/Basic/Targets/OSTargets.h @@ -257,6 +257,10 @@ Builder.defineMacro("__HAIKU__"); Builder.defineMacro("__ELF__"); DefineStd(Builder, "unix", Opts); + if (this->HasFloat128) { + Builder.defineMacro("__FLOAT128__"); + Builder.defineMacro("_GLIBCXX_USE_FLOAT128"); + } } public: @@ -267,6 +271,14 @@ this->PtrDiffType = TargetInfo::SignedLong; this->ProcessIDType = TargetInfo::SignedLong; this->TLSSupported = false; + switch (Triple.getArch()) { + default: + break; + case llvm::Triple::x86: + case llvm::Triple::x86_64: + this->HasFloat128 = true; + break; + } } };
Index: test/CodeGenCXX/float128-declarations.cpp =================================================================== --- test/CodeGenCXX/float128-declarations.cpp +++ test/CodeGenCXX/float128-declarations.cpp @@ -16,6 +16,10 @@ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // RUN: %clang_cc1 -emit-llvm -triple x86_64-pc-solaris2.11 -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple i586-pc-haiku -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-haiku -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // /* Various contexts where type __float128 can appear. The different check prefixes are due to different mangling on X86 and different calling Index: lib/Basic/Targets/OSTargets.h =================================================================== --- lib/Basic/Targets/OSTargets.h +++ lib/Basic/Targets/OSTargets.h @@ -257,6 +257,10 @@ Builder.defineMacro("__HAIKU__"); Builder.defineMacro("__ELF__"); DefineStd(Builder, "unix", Opts); + if (this->HasFloat128) { + Builder.defineMacro("__FLOAT128__"); + Builder.defineMacro("_GLIBCXX_USE_FLOAT128"); + } } public: @@ -267,6 +271,14 @@ this->PtrDiffType = TargetInfo::SignedLong; this->ProcessIDType = TargetInfo::SignedLong; this->TLSSupported = false; + switch (Triple.getArch()) { + default: + break; + case llvm::Triple::x86: + case llvm::Triple::x86_64: + this->HasFloat128 = true; + break; + } } };
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits