summaryrefslogtreecommitdiff
path: root/kernels/compiler_unstructured_branch3.cl
diff options
context:
space:
mode:
authorBenjamin Segovia <segovia.benjamin@gmail.com>2012-05-04 18:28:46 +0000
committerKeith Packard <keithp@keithp.com>2012-08-10 16:17:06 -0700
commit63f79ae569e27ad124f498b403e22248f538fbd5 (patch)
tree041abd919371bdf0c96bfe66f4986dc57be5c8e3 /kernels/compiler_unstructured_branch3.cl
parenta82d804dc1d9c1e9739daa9a20a0cb8bf21264f4 (diff)
Added more tests for structured and unstructured branches Debugged the unstructured branch code
Diffstat (limited to 'kernels/compiler_unstructured_branch3.cl')
-rw-r--r--kernels/compiler_unstructured_branch3.cl16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernels/compiler_unstructured_branch3.cl b/kernels/compiler_unstructured_branch3.cl
new file mode 100644
index 00000000..67b47610
--- /dev/null
+++ b/kernels/compiler_unstructured_branch3.cl
@@ -0,0 +1,16 @@
+__kernel void
+compiler_unstructured_branch3(__global int *src, __global int *dst)
+{
+ int id = (int)get_global_id(0);
+ dst[id] = src[id];
+ if (dst[id] >= 2) goto label1;
+ dst[id] = 1;
+ if (src[id] < 2) goto label2;
+ dst[id]--;
+ label1:
+ dst[id] -= 2;
+ label2:
+ dst[id] += 2;
+}
+
+