summaryrefslogtreecommitdiffstats
path: root/libclc/generic/lib/relational
diff options
context:
space:
mode:
authorAaron Watry <awatry@gmail.com>2014-07-17 22:07:19 +0000
committerAaron Watry <awatry@gmail.com>2014-07-17 22:07:19 +0000
commit803a992f045f7f88f29750592f460962d5633f46 (patch)
tree885679c66fa402fb3b4dae79a07961b512a3af91 /libclc/generic/lib/relational
parent9335fe8eff5bfd0a5e71fe61416d4a0aad2c20cb (diff)
downloadbcm5719-llvm-803a992f045f7f88f29750592f460962d5633f46.tar.gz
bcm5719-llvm-803a992f045f7f88f29750592f460962d5633f46.zip
relational: Implement isgreater
v2: Use relational macros instead of hand-rolled macros Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 213318
Diffstat (limited to 'libclc/generic/lib/relational')
-rw-r--r--libclc/generic/lib/relational/isgreater.cl22
1 files changed, 22 insertions, 0 deletions
diff --git a/libclc/generic/lib/relational/isgreater.cl b/libclc/generic/lib/relational/isgreater.cl
new file mode 100644
index 00000000000..79456e56d51
--- /dev/null
+++ b/libclc/generic/lib/relational/isgreater.cl
@@ -0,0 +1,22 @@
+#include <clc/clc.h>
+#include "relational.h"
+
+//Note: It would be nice to use __builtin_isgreater with vector inputs, but it seems to only take scalar values as
+// input, which will produce incorrect output for vector input types.
+
+_CLC_DEFINE_RELATIONAL_BINARY(int, isgreater, __builtin_isgreater, float, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+// The scalar version of isgreater(double, double) returns an int, but the vector versions
+// return long.
+
+_CLC_DEF _CLC_OVERLOAD int isgreater(double x, double y){
+ return __builtin_isgreater(x, y);
+}
+
+_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isgreater, double, double)
+
+#endif
OpenPOWER on IntegriCloud