[libclc] r217046 - Implement isinf builtin
Tom Stellard
thomas.stellard at amd.com
Wed Sep 3 08:55:40 PDT 2014
Author: tstellar
Date: Wed Sep 3 10:55:40 2014
New Revision: 217046
URL: http://llvm.org/viewvc/llvm-project?rev=217046&view=rev
Log:
Implement isinf builtin
Added:
libclc/trunk/generic/include/clc/relational/isinf.h
libclc/trunk/generic/lib/relational/isinf.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES
Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=217046&r1=217045&r2=217046&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Wed Sep 3 10:55:40 2014
@@ -116,6 +116,7 @@
#include <clc/relational/isequal.h>
#include <clc/relational/isgreater.h>
#include <clc/relational/isgreaterequal.h>
+#include <clc/relational/isinf.h>
#include <clc/relational/isless.h>
#include <clc/relational/islessequal.h>
#include <clc/relational/isnan.h>
Added: libclc/trunk/generic/include/clc/relational/isinf.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/relational/isinf.h?rev=217046&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/relational/isinf.h (added)
+++ libclc/trunk/generic/include/clc/relational/isinf.h Wed Sep 3 10:55:40 2014
@@ -0,0 +1,21 @@
+
+#define _CLC_ISINF_DECL(RET_TYPE, ARG_TYPE) \
+ _CLC_OVERLOAD _CLC_DECL RET_TYPE isinf(ARG_TYPE);
+
+#define _CLC_VECTOR_ISINF_DECL(RET_TYPE, ARG_TYPE) \
+ _CLC_ISINF_DECL(RET_TYPE##2, ARG_TYPE##2) \
+ _CLC_ISINF_DECL(RET_TYPE##3, ARG_TYPE##3) \
+ _CLC_ISINF_DECL(RET_TYPE##4, ARG_TYPE##4) \
+ _CLC_ISINF_DECL(RET_TYPE##8, ARG_TYPE##8) \
+ _CLC_ISINF_DECL(RET_TYPE##16, ARG_TYPE##16)
+
+_CLC_ISINF_DECL(int, float)
+_CLC_VECTOR_ISINF_DECL(int, float)
+
+#ifdef cl_khr_fp64
+_CLC_ISINF_DECL(int, double)
+_CLC_VECTOR_ISINF_DECL(long, double)
+#endif
+
+#undef _CLC_ISINF_DECL
+#undef _CLC_VECTOR_ISINF_DECL
Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=217046&r1=217045&r2=217046&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Wed Sep 3 10:55:40 2014
@@ -51,6 +51,7 @@ relational/any.cl
relational/isequal.cl
relational/isgreater.cl
relational/isgreaterequal.cl
+relational/isinf.cl
relational/isless.cl
relational/islessequal.cl
relational/isnan.cl
Added: libclc/trunk/generic/lib/relational/isinf.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/relational/isinf.cl?rev=217046&view=auto
==============================================================================
--- libclc/trunk/generic/lib/relational/isinf.cl (added)
+++ libclc/trunk/generic/lib/relational/isinf.cl Wed Sep 3 10:55:40 2014
@@ -0,0 +1,18 @@
+#include <clc/clc.h>
+#include "relational.h"
+
+_CLC_DEFINE_RELATIONAL_UNARY(int, isinf, __builtin_isinf, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+// The scalar version of isinf(double) returns an int, but the vector versions
+// return long.
+_CLC_DEF _CLC_OVERLOAD int isinf(double x) {
+ return __builtin_isinf(x);
+}
+
+_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isinf, double)
+
+#endif
More information about the cfe-commits
mailing list