]> granicus.if.org Git - clang/commitdiff
[Haiku] Support __float128 for x86 and x86_64
authorKristina Brooks <kristina@nym.hush.com>
Wed, 5 Dec 2018 15:05:06 +0000 (15:05 +0000)
committerKristina Brooks <kristina@nym.hush.com>
Wed, 5 Dec 2018 15:05:06 +0000 (15:05 +0000)
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').

Patch by kallisti5 (Alexander von Gluck IV)

Differential Revision: https://reviews.llvm.org/D54901

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348368 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets/OSTargets.h
test/CodeGenCXX/float128-declarations.cpp

index 4a2aec8431efbf83d7e403e34b69cf39160baf65..5510ca369846235cfcf77421ea4a8ab1278aaa5c 100644 (file)
@@ -257,6 +257,8 @@ protected:
     Builder.defineMacro("__HAIKU__");
     Builder.defineMacro("__ELF__");
     DefineStd(Builder, "unix", Opts);
+    if (this->HasFloat128) 
+      Builder.defineMacro("__FLOAT128__");
   }
 
 public:
@@ -267,6 +269,14 @@ public:
     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 fca77ddb6b4fc7b3fec44df76a6d759dba6f7528..18a25d9faba81a68ce247e984603f95364cead96 100644 (file)
 // 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.  */