[libclc] r217244 - add isnormal builtin

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


Author: jvesely
Date: Fri Sep  5 08:59:09 2014
New Revision: 217244

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

v2: simplify and remove isnan 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/isnormal.h
    libclc/trunk/generic/lib/relational/isnormal.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=217244&r1=217243&r2=217244&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep  5 08:59:09 2014
@@ -121,6 +121,7 @@
 #include <clc/relational/isless.h>
 #include <clc/relational/islessequal.h>
 #include <clc/relational/isnan.h>
+#include <clc/relational/isnormal.h>
 #include <clc/relational/isnotequal.h>
 #include <clc/relational/select.h>
 #include <clc/relational/signbit.h>

Added: libclc/trunk/generic/include/clc/relational/isnormal.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/relational/isnormal.h?rev=217244&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/relational/isnormal.h (added)
+++ libclc/trunk/generic/include/clc/relational/isnormal.h Fri Sep  5 08:59:09 2014
@@ -0,0 +1,9 @@
+#undef isnormal
+
+#define __CLC_FUNCTION isnormal
+#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=217244&r1=217243&r2=217244&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Sep  5 08:59:09 2014
@@ -56,6 +56,7 @@ relational/isinf.cl
 relational/isless.cl
 relational/islessequal.cl
 relational/isnan.cl
+relational/isnormal.cl
 relational/isnotequal.cl
 relational/signbit.cl
 shared/clamp.cl

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





More information about the cfe-commits mailing list