[clang] 2fe674b - [OpenCL] Add remaining vector data builtin functions
Sven van Haastregt via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 02:17:03 PST 2019
Author: Sven van Haastregt
Date: 2019-11-13T10:16:33Z
New Revision: 2fe674baa3f304b5fa497e71b51ea6315f89c5e0
URL: https://github.com/llvm/llvm-project/commit/2fe674baa3f304b5fa497e71b51ea6315f89c5e0
DIFF: https://github.com/llvm/llvm-project/commit/2fe674baa3f304b5fa497e71b51ea6315f89c5e0.diff
LOG: [OpenCL] Add remaining vector data builtin functions
Add the remaining half (fp16) vector data load and store builtin
functions from the OpenCL C specification.
Patch by Pierre Gondois and Sven van Haastregt.
Added:
Modified:
clang/lib/Sema/OpenCLBuiltins.td
Removed:
################################################################################
diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
index 080963acd09b..0bd4c51a04c2 100644
--- a/clang/lib/Sema/OpenCLBuiltins.td
+++ b/clang/lib/Sema/OpenCLBuiltins.td
@@ -666,8 +666,9 @@ foreach name = ["select"] in {
}
+//--------------------------------------------------------------------
// OpenCL v1.1 s6.11.7, v1.2 s6.12.7, v2.0 s6.13.7 - Vector Data Load and Store Functions
-// OpenCL Extension v1.1 s9.3.6 and s9.6.6, v1.2 s9.5.6, v2.0 s9.4.6, v2.0 s5.1.6 and 6.1.6 - Vector Data Load and Store Functions
+// OpenCL Extension v1.1 s9.3.6 and s9.6.6, v1.2 s9.5.6, v2.0 s5.1.6 and s6.1.6 - Vector Data Load and Store Functions
// --- Table 15 ---
// Variants for OpenCL versions below 2.0, using pointers to the global, local
// and private address spaces.
@@ -778,6 +779,55 @@ foreach VSize = [2, 3, 4, 8, 16] in {
}
}
}
+let MaxVersion = CL20 in {
+ foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
+ def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
+ foreach VSize = [2, 3, 4, 8, 16] in {
+ foreach name = ["vload_half" # VSize] in {
+ def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, AS>]>;
+ }
+ }
+ foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
+ def : Builtin<"vstore_half" # rnd, [Void, Float, Size, PointerType<Half, AS>]>;
+ def : Builtin<"vstore_half" # rnd, [Void, Double, Size, PointerType<Half, AS>]>;
+ foreach VSize = [2, 3, 4, 8, 16] in {
+ foreach name = ["vstore_half" # VSize # rnd] in {
+ def : Builtin<name, [Void, VectorType<Float, VSize>, Size, PointerType<Half, AS>]>;
+ def : Builtin<name, [Void, VectorType<Double, VSize>, Size, PointerType<Half, AS>]>;
+ }
+ }
+ }
+ }
+}
+let MinVersion = CL20 in {
+ foreach AS = [GenericAS] in {
+ def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
+ foreach VSize = [2, 3, 4, 8, 16] in {
+ foreach name = ["vload_half" # VSize] in {
+ def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, AS>]>;
+ }
+ }
+ foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
+ def : Builtin<"vstore_half" # rnd, [Void, Float, Size, PointerType<Half, AS>]>;
+ def : Builtin<"vstore_half" # rnd, [Void, Double, Size, PointerType<Half, AS>]>;
+ foreach VSize = [2, 3, 4, 8, 16] in {
+ foreach name = ["vstore_half" # VSize # rnd] in {
+ def : Builtin<name, [Void, VectorType<Float, VSize>, Size, PointerType<Half, AS>]>;
+ def : Builtin<name, [Void, VectorType<Double, VSize>, Size, PointerType<Half, AS>]>;
+ }
+ }
+ }
+ }
+}
+
+foreach AS = [ConstantAS] in {
+ def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
+ foreach VSize = [2, 3, 4, 8, 16] in {
+ foreach name = ["vload_half" # VSize] in {
+ def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, AS>]>;
+ }
+ }
+}
//--------------------------------------------------------------------
// OpenCL v1.1 s6.11.10, v1.2 s6.12.10, v2.0 s6.13.10: Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch
More information about the cfe-commits
mailing list