diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2019-01-31 21:57:51 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2019-01-31 21:57:51 +0000 |
commit | 277e064bf5297e91b273daa7018d5f2341a346a9 (patch) | |
tree | e9bd8caebdd9e875b4a9a0ba8b82d8f1ec36f2fb /clang/lib/Basic/Targets/AMDGPU.cpp | |
parent | fadf25068e32b44b010e6e03c6ab93bec41eae82 (diff) | |
download | bcm5719-llvm-277e064bf5297e91b273daa7018d5f2341a346a9.tar.gz bcm5719-llvm-277e064bf5297e91b273daa7018d5f2341a346a9.zip |
Do not copy long double and 128-bit fp format from aux target for AMDGPU
rC352620 caused regressions because it copied floating point format from
aux target.
floating point format decides whether extended long double is supported.
It is x86_fp80 on x86 but IEEE double on amdgcn.
Document usage of long doubel type in HIP programming guide
https://github.com/ROCm-Developer-Tools/HIP/pull/890
Differential Revision: https://reviews.llvm.org/D57527
llvm-svn: 352801
Diffstat (limited to 'clang/lib/Basic/Targets/AMDGPU.cpp')
-rw-r--r-- | clang/lib/Basic/Targets/AMDGPU.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets/AMDGPU.cpp b/clang/lib/Basic/Targets/AMDGPU.cpp index 19dc05f5b0a..b04d894855e 100644 --- a/clang/lib/Basic/Targets/AMDGPU.cpp +++ b/clang/lib/Basic/Targets/AMDGPU.cpp @@ -307,5 +307,16 @@ void AMDGPUTargetInfo::getTargetDefines(const LangOptions &Opts, } void AMDGPUTargetInfo::setAuxTarget(const TargetInfo *Aux) { + assert(HalfFormat == Aux->HalfFormat); + assert(FloatFormat == Aux->FloatFormat); + assert(DoubleFormat == Aux->DoubleFormat); + + // On x86_64 long double is 80-bit extended precision format, which is + // not supported by AMDGPU. 128-bit floating point format is also not + // supported by AMDGPU. Therefore keep its own format for these two types. + auto SaveLongDoubleFormat = LongDoubleFormat; + auto SaveFloat128Format = Float128Format; copyAuxTarget(Aux); + LongDoubleFormat = SaveLongDoubleFormat; + Float128Format = SaveFloat128Format; } |