[Piglit] [PATCH 2/2] Add one test case for OpenCL's switch cause

junyan.he at linux.intel.com junyan.he at linux.intel.com
Mon May 27 00:12:51 PDT 2013


From: Junyan He <junyan.he at linux.intel.com>

Add a "switch case" test kernel for OpenCL

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 tests/cl/program/execute/switch-case.cl |   37 +++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 tests/cl/program/execute/switch-case.cl

diff --git a/tests/cl/program/execute/switch-case.cl b/tests/cl/program/execute/switch-case.cl
new file mode 100644
index 0000000..d0c6ce1
--- /dev/null
+++ b/tests/cl/program/execute/switch-case.cl
@@ -0,0 +1,37 @@
+/*!
+[config]
+name: switch_case_result
+clc_version_min: 10
+kernel_name: switch_case
+
+[test]
+name: switch_case
+kernel_name: switch_case
+dimensions: 1
+global_size: 16 0 0
+local_size: 16 0 0
+arg_out: 0 buffer int[16] 4 15 15 11 12 13 17 17 16 17 19 19 18 21 22 23
+!*/
+
+__kernel void switch_case(__global int *out)
+{
+	switch (get_global_id(0)) {
+		case 0: out[get_global_id(0)] = get_global_id(0) + 4;
+			break;
+		case 1: out[get_global_id(0)] = get_global_id(0) + 14;
+			break;
+		case 2: out[get_global_id(0)] = get_global_id(0) + 13;
+			break;
+		case 6: out[get_global_id(0)] = get_global_id(0) + 11;
+			break;
+		case 7: out[get_global_id(0)] = get_global_id(0) + 10;
+			break;
+		case 10: out[get_global_id(0)] = get_global_id(0) + 9;
+			 break;
+		case 12: out[get_global_id(0)] = get_global_id(0) + 6;
+			 break;
+		default: out[get_global_id(0)] = get_global_id(0) + 8;
+			 break;
+	}
+}
+
-- 
1.7.9.5



More information about the Piglit mailing list