[libclc] r327324 - nan: Implement

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 12 12:46:52 PDT 2018


Author: jvesely
Date: Mon Mar 12 12:46:52 2018
New Revision: 327324

URL: http://llvm.org/viewvc/llvm-project?rev=327324&view=rev
Log:
nan: Implement

Passes CTS on carrizo and turks

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

Added:
    libclc/trunk/generic/include/clc/math/nan.h
    libclc/trunk/generic/include/clc/math/nan.inc
    libclc/trunk/generic/lib/math/nan.cl
    libclc/trunk/generic/lib/math/nan.inc
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=327324&r1=327323&r2=327324&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Mon Mar 12 12:46:52 2018
@@ -98,6 +98,7 @@
 #include <clc/math/maxmag.h>
 #include <clc/math/minmag.h>
 #include <clc/math/modf.h>
+#include <clc/math/nan.h>
 #include <clc/math/nextafter.h>
 #include <clc/math/pow.h>
 #include <clc/math/pown.h>

Added: libclc/trunk/generic/include/clc/math/nan.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/nan.h?rev=327324&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/nan.h (added)
+++ libclc/trunk/generic/include/clc/math/nan.h Mon Mar 12 12:46:52 2018
@@ -0,0 +1,8 @@
+#define __CLC_CONCAT(x, y) x ## y
+#define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y)
+
+#define __CLC_BODY <clc/math/nan.inc>
+#include <clc/math/gentype.inc>
+
+#undef __CLC_XCONCAT
+#undef __CLC_CONCAT

Added: libclc/trunk/generic/include/clc/math/nan.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/nan.inc?rev=327324&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/nan.inc (added)
+++ libclc/trunk/generic/include/clc/math/nan.inc Mon Mar 12 12:46:52 2018
@@ -0,0 +1,16 @@
+#ifdef __CLC_SCALAR
+#define __CLC_VECSIZE
+#endif
+
+#if __CLC_FPSIZE == 64
+#define __CLC_NATN __CLC_XCONCAT(ulong, __CLC_VECSIZE)
+#else
+#define __CLC_NATN __CLC_XCONCAT(uint, __CLC_VECSIZE)
+#endif
+
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE nan(__CLC_NATN code);
+
+#undef __CLC_NATN
+#ifdef __CLC_SCALAR
+#undef __CLC_VECSIZE
+#endif

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=327324&r1=327323&r2=327324&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Mon Mar 12 12:46:52 2018
@@ -134,6 +134,7 @@ math/mad.cl
 math/maxmag.cl
 math/minmag.cl
 math/modf.cl
+math/nan.cl
 math/native_cos.cl
 math/native_divide.cl
 math/native_exp.cl

Added: libclc/trunk/generic/lib/math/nan.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/nan.cl?rev=327324&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/nan.cl (added)
+++ libclc/trunk/generic/lib/math/nan.cl Mon Mar 12 12:46:52 2018
@@ -0,0 +1,6 @@
+#include <clc/clc.h>
+#include "utils.h"
+
+#define __CLC_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE)
+#define __CLC_BODY <nan.inc>
+#include <clc/math/gentype.inc>

Added: libclc/trunk/generic/lib/math/nan.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/nan.inc?rev=327324&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/nan.inc (added)
+++ libclc/trunk/generic/lib/math/nan.inc Mon Mar 12 12:46:52 2018
@@ -0,0 +1,20 @@
+#ifdef __CLC_SCALAR
+#define __CLC_VECSIZE
+#endif
+
+#if __CLC_FPSIZE == 64
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE nan(__CLC_XCONCAT(ulong, __CLC_VECSIZE) code)
+{
+	return __CLC_AS_GENTYPE(code | 0x7ff0000000000000ul);
+}
+#else
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE nan(__CLC_XCONCAT(uint, __CLC_VECSIZE) code)
+{
+	return __CLC_AS_GENTYPE(code | 0x7fc00000);
+}
+#endif
+
+
+#ifdef __CLC_SCALAR
+#undef __CLC_VECSIZE
+#endif




More information about the cfe-commits mailing list