summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--if_eq.cl7
-rw-r--r--if_ge.cl7
-rw-r--r--if_le.cl7
-rw-r--r--if_lt.cl7
-rw-r--r--if_ne.cl7
-rw-r--r--run_tests.sh71
6 files changed, 105 insertions, 1 deletions
diff --git a/if_eq.cl b/if_eq.cl
new file mode 100644
index 0000000..3cdcfda
--- /dev/null
+++ b/if_eq.cl
@@ -0,0 +1,7 @@
+__kernel void if_eq(__global int * out, int arg0, int arg1)
+{
+ out[0] = 0;
+ if (arg0 == arg1) {
+ out[0] = 1;
+ }
+}
diff --git a/if_ge.cl b/if_ge.cl
new file mode 100644
index 0000000..045d156
--- /dev/null
+++ b/if_ge.cl
@@ -0,0 +1,7 @@
+__kernel void if_ge(__global int * out, int arg0, int arg1)
+{
+ out[0] = 0;
+ if (arg0 >= arg1) {
+ out[0] = 1;
+ }
+}
diff --git a/if_le.cl b/if_le.cl
new file mode 100644
index 0000000..eb672ea
--- /dev/null
+++ b/if_le.cl
@@ -0,0 +1,7 @@
+__kernel void if_le(__global int * out, int arg0, int arg1)
+{
+ out[0] = 0;
+ if (arg0 <= arg1) {
+ out[0] = 1;
+ }
+}
diff --git a/if_lt.cl b/if_lt.cl
new file mode 100644
index 0000000..b59c1c9
--- /dev/null
+++ b/if_lt.cl
@@ -0,0 +1,7 @@
+__kernel void if_lt(__global int * out, int arg0, int arg1)
+{
+ out[0] = 0;
+ if (arg0 < arg1) {
+ out[0] = 1;
+ }
+}
diff --git a/if_ne.cl b/if_ne.cl
new file mode 100644
index 0000000..ecbfef5
--- /dev/null
+++ b/if_ne.cl
@@ -0,0 +1,7 @@
+__kernel void if_ne(__global int * out, int arg0, arg1)
+{
+ out[0] = 0;
+ if (arg0 != arg1) {
+ out[0] = 1;
+ }
+}
diff --git a/run_tests.sh b/run_tests.sh
index 42f21cb..3ef76f0 100644
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -129,9 +129,78 @@ run_test "./math-int if_gt 5 6 0"
run_test "./math-int if_gt -20 10 0"
# x < y and abs(x) > y
run_test "./math-int if_gt -5 8 0"
-# x > y, but x < abs(x)
+# x > y, but x < abs(y)
run_test "./math-int if_gt 12 -15 1"
# x > y and x > abs(y)
run_test "./math-int if_gt 16 -3 1"
+################################################################################
+#if (x >= y) #
+################################################################################
+
+#True (x > y)
+run_test "./math-int if_ge 8 7 1"
+#True (x == y)
+run_test "./math-int if_ge 10 10 1"
+#False (x < y)
+run_test "./math-int if_ge 20 30 0"
+#True (x > y), but x < abs(y)
+run_test "./math-int if_ge 3 -8 1"
+#False (x < y), but abs(x) == y
+run_test "./math-int if_ge -5 5 0"
+#False (x < y), but abs(x) > y
+run_test "./math-int if_ge -20 10 0"
+
+################################################################################
+#if (x == y) #
+################################################################################
+
+#True
+run_test "./math-int if_eq 21 21 1"
+#False
+run_test "./math-int if_eq 30 18 0"
+#False, but abs(x) == y
+run_test "./math-int if_eq -12 12 0"
+#False, but x == abs(y)
+run_test "./math-int if_eq 81 -81 0"
+
+################################################################################
+#if (x < y) #
+################################################################################
+
+#True
+run_test "./math-int if_lt 2 10 1"
+#True, but abs(x) > y
+run_test "./math if_lt -20 3 1"
+#False
+run_test "./math-int if_lt 15 3 0"
+
+################################################################################
+#if (x <= y) #
+################################################################################
+
+#True
+run_test "./math-int if_le 20 25 1"
+#True x == y
+run_test "./mat-int if_le 18 18 1"
+#True, but abs(x) > y
+run_test "./math-int if_le -10 5 1"
+#False
+run_test "./math-int if_le 18 9 0"
+#False, but x < abs(y)
+run_test "./math-int if_le 10 -20 0"
+
+################################################################################
+#if (x != y) #
+################################################################################
+
+#True
+run_test "./math-int if_ne 10 9 1"
+#True, but abs(x) == y
+run_test "./math-int if_ne -20 20 1"
+#True, but x == abs(y)
+run_test "./math-int if_ne 31 -31 1"
+#False
+run_test "./math-int if_ne 3 3 0"
+
echo "$PASS passes, $FAIL fails"