summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven van Haastregt <sven.vanhaastregt@arm.com>2019-11-13 10:16:33 +0000
committerSven van Haastregt <sven.vanhaastregt@arm.com>2019-11-13 10:16:33 +0000
commit2fe674baa3f304b5fa497e71b51ea6315f89c5e0 (patch)
tree75ff030f9a5e05e13163560569880c6fde4fa2a3
parentcba4a27745ab33b828476eff47caf3e1b6e060f5 (diff)
downloadbcm5719-llvm-2fe674baa3f304b5fa497e71b51ea6315f89c5e0.tar.gz
bcm5719-llvm-2fe674baa3f304b5fa497e71b51ea6315f89c5e0.zip
[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.
-rw-r--r--clang/lib/Sema/OpenCLBuiltins.td52
1 files changed, 51 insertions, 1 deletions
diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
index 080963acd09..0bd4c51a04c 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
OpenPOWER on IntegriCloud