Skip to content

Commit

Permalink
[hip] Claim builtin type __float128 supported if the host target su…
Browse files Browse the repository at this point in the history
…pports it.

Reviewers: tra, yaxunl

Subscribers: jvesely, nhaehnle, kerbowa, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78513
  • Loading branch information
darkbuck committed Apr 21, 2020
1 parent 6a30894 commit 86e3b73
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions clang/lib/Basic/Targets/AMDGPU.cpp
Expand Up @@ -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 different representations of the same builtin type, such
// as `size_t` in the MSVC environment.
if (Aux->hasFloat128Type()) {
HasFloat128 = true;
Float128Format = DoubleFormat;
}
}
4 changes: 4 additions & 0 deletions 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;

0 comments on commit 86e3b73

Please sign in to comment.