summaryrefslogtreecommitdiffstats
path: root/libclc/generic/lib/relational
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-10-10 19:08:41 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-10-10 19:08:41 +0000
commite36e9dec65626dcf54eb0ec2ac1bef6fd605a8f0 (patch)
treeb30fa7ec6d20701aa7ff83d3ba63131b046d644c /libclc/generic/lib/relational
parentef13294c931f42cf303adb2104fa2aa1a6adc9a7 (diff)
downloadbcm5719-llvm-e36e9dec65626dcf54eb0ec2ac1bef6fd605a8f0.tar.gz
bcm5719-llvm-e36e9dec65626dcf54eb0ec2ac1bef6fd605a8f0.zip
Implement isnan() builtin
llvm-svn: 192382
Diffstat (limited to 'libclc/generic/lib/relational')
-rw-r--r--libclc/generic/lib/relational/isnan.cl17
1 files changed, 17 insertions, 0 deletions
diff --git a/libclc/generic/lib/relational/isnan.cl b/libclc/generic/lib/relational/isnan.cl
new file mode 100644
index 00000000000..1a64f67dbd2
--- /dev/null
+++ b/libclc/generic/lib/relational/isnan.cl
@@ -0,0 +1,17 @@
+#include <clc/clc.h>
+
+_CLC_DEFINE_UNARY_BUILTIN(int, isnan, __builtin_isnan, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+// The scalar version of isnan(double) returns an int, but the vector versions
+// return long.
+_CLC_DEF _CLC_OVERLOAD int isnan(double x) {
+ return __builtin_isnan(x);
+}
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, isnan, double)
+
+#endif
OpenPOWER on IntegriCloud