diff options
author | Yaxun (Sam) Liu <yaxun.liu@amd.com> | 2020-11-16 10:58:48 -0500 |
---|---|---|
committer | Yaxun (Sam) Liu <yaxun.liu@amd.com> | 2020-11-16 21:52:12 -0500 |
commit | 3f4b5893efed620d93015896d79eb276628286f8 (patch) | |
tree | 8a7c662725aa71b40c41e3d058616ca31c3d8362 /clang/lib/CodeGen/TargetInfo.cpp | |
parent | 69cd776e1ee79e72ccbdad30749eac04579715ee (diff) | |
download | llvm-3f4b5893efed620d93015896d79eb276628286f8.zip llvm-3f4b5893efed620d93015896d79eb276628286f8.tar.gz llvm-3f4b5893efed620d93015896d79eb276628286f8.tar.bz2 |
[AMDGPU] Add option -munsafe-fp-atomics
Add an option -munsafe-fp-atomics for AMDGPU target.
When enabled, clang adds function attribute "amdgpu-unsafe-fp-atomics"
to any functions for amdgpu target. This allows amdgpu backend to use
unsafe fp atomic instructions in these functions.
Differential Revision: https://reviews.llvm.org/D91546
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 1e59203..a98e409 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -9080,6 +9080,9 @@ void AMDGPUTargetCodeGenInfo::setTargetAttributes( if (NumVGPR != 0) F->addFnAttr("amdgpu-num-vgpr", llvm::utostr(NumVGPR)); } + + if (M.getContext().getTargetInfo().allowAMDGPUUnsafeFPAtomics()) + F->addFnAttr("amdgpu-unsafe-fp-atomics", "true"); } unsigned AMDGPUTargetCodeGenInfo::getOpenCLKernelCallingConv() const { |