[PATCH] D28691: Support synchronisation scope in atomic builtin functions
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 13 12:16:57 PST 2017
yaxunl created this revision.
yaxunl added reviewers: Anastasia, bader, rjmccall.
yaxunl added a subscriber: cfe-commits.
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 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 allows Clang atomic builtin functions to accept an optional synchronization scope argument, so that they can be used to implement OpenCL atomic builtin functions.
There is no functional change for other languages, since the synchronization scope argument is optional, and its default value generates the same LLVM instruction as before.
Currently only constant integer argument is supported. Support of non-constant synchronization scope will be added later.
https://reviews.llvm.org/D28691
Files:
include/clang/AST/Expr.h
lib/AST/Expr.cpp
lib/Basic/Targets.cpp
lib/CodeGen/CGAtomic.cpp
lib/Sema/SemaChecking.cpp
test/CodeGenOpenCL/atomic-ops.cl
test/Sema/atomic-ops.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28691.84350.patch
Type: text/x-patch
Size: 23132 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170113/7fae8584/attachment-0001.bin>
More information about the cfe-commits
mailing list