[clang] 86e3b73 - [hip] Claim builtin type `__float128` supported if the host target supports it.

Michael Liao via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 21 12:56:55 PDT 2020


Author: Michael Liao
Date: 2020-04-21T15:56:40-04:00
New Revision: 86e3b735cd803cc22c9eae15d99ce9df5956aae6

URL: https://github.com/llvm/llvm-project/commit/86e3b735cd803cc22c9eae15d99ce9df5956aae6
DIFF: https://github.com/llvm/llvm-project/commit/86e3b735cd803cc22c9eae15d99ce9df5956aae6.diff

LOG: [hip] Claim builtin type `__float128` supported if the host target supports it.

Reviewers: tra, yaxunl

Subscribers: jvesely, nhaehnle, kerbowa, cfe-commits

Tags: #clang

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

Added: 
    clang/test/SemaCUDA/amdgpu-f128.cu

Modified: 
    clang/lib/Basic/Targets/AMDGPU.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/AMDGPU.cpp b/clang/lib/Basic/Targets/AMDGPU.cpp
index 3fd9008e4660..b9d7640a10b8 100644
--- a/clang/lib/Basic/Targets/AMDGPU.cpp
+++ b/clang/lib/Basic/Targets/AMDGPU.cpp
@@ -363,4 +363,17 @@ void AMDGPUTargetInfo::setAuxTarget(const TargetInfo *Aux) {
   copyAuxTarget(Aux);
   LongDoubleFormat = SaveLongDoubleFormat;
   Float128Format = SaveFloat128Format;
+  // For certain builtin types support on the host target, claim they are
+  // support to pass the compilation of the host code during the device-side
+  // compilation.
+  // FIXME: As the side effect, we also accept `__float128` uses in the device
+  // code. To rejct these builtin types supported in the host target but not in
+  // the device target, one approach would support `device_builtin` attribute
+  // so that we could tell the device builtin types from the host ones. The
+  // also solves the 
diff erent representations of the same builtin type, such
+  // as `size_t` in the MSVC environment.
+  if (Aux->hasFloat128Type()) {
+    HasFloat128 = true;
+    Float128Format = DoubleFormat;
+  }
 }

diff  --git a/clang/test/SemaCUDA/amdgpu-f128.cu b/clang/test/SemaCUDA/amdgpu-f128.cu
new file mode 100644
index 000000000000..9a0212cdb93c
--- /dev/null
+++ b/clang/test/SemaCUDA/amdgpu-f128.cu
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+typedef __float128 f128_t;


        


More information about the cfe-commits mailing list