summaryrefslogtreecommitdiffstats
path: root/libclc/generic/include/clc/relational/signbit.h
diff options
context:
space:
mode:
authorAaron Watry <awatry@gmail.com>2014-06-25 13:29:23 +0000
committerAaron Watry <awatry@gmail.com>2014-06-25 13:29:23 +0000
commitd9ee196eab5a00e48ef2022a0952d93f5edad2e1 (patch)
treeccd6441afcca005ed99bc4ccd89a0e306f32fc4b /libclc/generic/include/clc/relational/signbit.h
parentbfa644b91def589f1dd38668f3e094b581a44583 (diff)
downloadbcm5719-llvm-d9ee196eab5a00e48ef2022a0952d93f5edad2e1.tar.gz
bcm5719-llvm-d9ee196eab5a00e48ef2022a0952d93f5edad2e1.zip
relational: Implement signbit
v2 Changes: - use __builtin_signbit instead of shifting by hand - significantly improve vector shuffling - Works correctly now for signbit(float16) on radeonsi Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 211696
Diffstat (limited to 'libclc/generic/include/clc/relational/signbit.h')
-rw-r--r--libclc/generic/include/clc/relational/signbit.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/libclc/generic/include/clc/relational/signbit.h b/libclc/generic/include/clc/relational/signbit.h
new file mode 100644
index 00000000000..774d6e0433e
--- /dev/null
+++ b/libclc/generic/include/clc/relational/signbit.h
@@ -0,0 +1,18 @@
+
+#define _CLC_SIGNBIT_DECL(TYPE, RETTYPE) \
+ _CLC_OVERLOAD _CLC_DECL RETTYPE signbit(TYPE x);
+
+#define _CLC_VECTOR_SIGNBIT_DECL(TYPE, RETTYPE) \
+ _CLC_SIGNBIT_DECL(TYPE##2, RETTYPE##2) \
+ _CLC_SIGNBIT_DECL(TYPE##3, RETTYPE##3) \
+ _CLC_SIGNBIT_DECL(TYPE##4, RETTYPE##4) \
+ _CLC_SIGNBIT_DECL(TYPE##8, RETTYPE##8) \
+ _CLC_SIGNBIT_DECL(TYPE##16, RETTYPE##16)
+
+_CLC_SIGNBIT_DECL(float, int)
+_CLC_VECTOR_SIGNBIT_DECL(float, int)
+
+#ifdef cl_khr_fp64
+_CLC_SIGNBIT_DECL(double, int)
+_CLC_VECTOR_SIGNBIT_DECL(double, long)
+#endif \ No newline at end of file
OpenPOWER on IntegriCloud