Add OpenCL 2.0 atomic builtin functions as Clang builtin
authorYaxun Liu <Yaxun.Liu@amd.com>
Fri, 4 Aug 2017 18:16:31 +0000 (18:16 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Fri, 4 Aug 2017 18:16:31 +0000 (18:16 +0000)
commit39195062c20c5fd7d01678ff87c9c2851644a669
tree91440b8bb2b2bd18fe5a3fa684ae01cca7179ce8
parent0afcef27a12db3730941b257d9535f7e32479fdb
Add OpenCL 2.0 atomic builtin functions as Clang builtin

OpenCL 2.0 atomic builtin functions have a scope argument which is ideally
represented as synchronization scope argument in LLVM atomic instructions.

Clang supports translating Clang atomic builtin functions to LLVM atomic
instructions. However it currently does not support synchronization scope
of LLVM atomic instructions. Without this, users have to use LLVM assembly
code to implement OpenCL atomic builtin functions.

This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin
functions, which supports generating LLVM atomic instructions with
synchronization scope operand.

Currently only constant memory scope argument is supported. Support of
non-constant memory scope argument will be added later.

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

llvm-svn: 310082
21 files changed:
clang/docs/LanguageExtensions.rst
clang/include/clang/AST/Expr.h
clang/include/clang/Basic/Builtins.def
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/SyncScope.h [new file with mode: 0644]
clang/lib/AST/ASTContext.cpp
clang/lib/AST/Expr.cpp
clang/lib/AST/StmtPrinter.cpp
clang/lib/Basic/Targets/AMDGPU.cpp
clang/lib/CodeGen/CGAtomic.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/CodeGen/TargetInfo.h
clang/lib/Frontend/InitPreprocessor.cpp
clang/lib/Headers/opencl-c.h
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGenOpenCL/atomic-ops-libcall.cl [new file with mode: 0644]
clang/test/CodeGenOpenCL/atomic-ops.cl [new file with mode: 0644]
clang/test/Preprocessor/init.c
clang/test/Preprocessor/predefined-macros.c
clang/test/SemaOpenCL/atomic-ops.cl [new file with mode: 0644]