[libclc] r217243 - add isfinite builtin

Jan Vesely jan.vesely at rutgers.edu
Fri Sep 5 06:59:06 PDT 2014


Author: jvesely
Date: Fri Sep  5 08:59:06 2014
New Revision: 217243

URL: http://llvm.org/viewvc/llvm-project?rev=217243&view=rev
Log:
add isfinite builtin

v2: simplify and remove isinf leftovers
    remove trailing newline

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Reviewed-by: Aaron Watry <awatry at gmail.com>

Added:
    libclc/trunk/generic/include/clc/relational/isfinite.h
    libclc/trunk/generic/lib/relational/isfinite.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=217243&r1=217242&r2=217243&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep  5 08:59:06 2014
@@ -114,6 +114,7 @@
 #include <clc/relational/any.h>
 #include <clc/relational/bitselect.h>
 #include <clc/relational/isequal.h>
+#include <clc/relational/isfinite.h>
 #include <clc/relational/isgreater.h>
 #include <clc/relational/isgreaterequal.h>
 #include <clc/relational/isinf.h>

Added: libclc/trunk/generic/include/clc/relational/isfinite.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/relational/isfinite.h?rev=217243&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/relational/isfinite.h (added)
+++ libclc/trunk/generic/include/clc/relational/isfinite.h Fri Sep  5 08:59:06 2014
@@ -0,0 +1,9 @@
+#undef isfinite
+
+#define __CLC_FUNCTION isfinite
+#define __CLC_BODY <clc/relational/unary_decl.inc>
+
+#include <clc/relational/floatn.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=217243&r1=217242&r2=217243&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Sep  5 08:59:06 2014
@@ -49,6 +49,7 @@ math/sincos_helpers.cl
 relational/all.cl
 relational/any.cl
 relational/isequal.cl
+relational/isfinite.cl
 relational/isgreater.cl
 relational/isgreaterequal.cl
 relational/isinf.cl

Added: libclc/trunk/generic/lib/relational/isfinite.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/relational/isfinite.cl?rev=217243&view=auto
==============================================================================
--- libclc/trunk/generic/lib/relational/isfinite.cl (added)
+++ libclc/trunk/generic/lib/relational/isfinite.cl Fri Sep  5 08:59:06 2014
@@ -0,0 +1,18 @@
+#include <clc/clc.h>
+#include "relational.h"
+
+_CLC_DEFINE_RELATIONAL_UNARY(int, isfinite, __builtin_isfinite, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+// The scalar version of isfinite(double) returns an int, but the vector versions
+// return long.
+_CLC_DEF _CLC_OVERLOAD int isfinite(double x) {
+  return __builtin_isfinite(x);
+}
+
+_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isfinite, double)
+
+#endif





More information about the cfe-commits mailing list