[PATCH] D119420: [OpenCL] Add OpenCL 3.0 atomics to -fdeclare-opencl-builtins

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 10 03:49:25 PST 2022


Anastasia added inline comments.


================
Comment at: clang/lib/Sema/OpenCLBuiltins.td:1151
   foreach addrspace = [GlobalAS, LocalAS, GenericAS] in {
-    let Extension = !cast<FunctionExtension>("FuncExtFloatAtomicsFp16" # addrspace # "LoadStore") in {
-      defm : BuiltinAtomicExplicit<"atomic_store",
-          [Void, PointerType<VolatileType<AtomicHalf>, addrspace>, AtomicHalf]>;
-      defm : BuiltinAtomicExplicit<"atomic_load",
-          [Half, PointerType<VolatileType<AtomicHalf>, addrspace>]>;
-      defm : BuiltinAtomicExplicit<"atomic_exchange",
-          [Half, PointerType<VolatileType<AtomicHalf>, addrspace>, Half]>;
-    }
+    defvar extension = !cast<FunctionExtension>("FuncExtFloatAtomicsFp16" # addrspace # "LoadStore");
+
----------------
maybe we can improve the name, so something like `extension_fp16`?

Same for below: `extension_fp16`, `extension_32`, `extension_64`?


================
Comment at: clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl:84
 
+#if (__OPENCL_CPP_VERSION__ == 100 || __OPENCL_C_VERSION__ == 200)
+#define __opencl_c_atomic_order_seq_cst 1
----------------
Why do we need to set those for `__OPENCL_CPP_VERSION__ == 100` since those atomics are for OpenCL 2.0 onwards?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119420/new/

https://reviews.llvm.org/D119420



More information about the cfe-commits mailing list