[libclc] r318265 - math: Implement minmag
Jan Vesely via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 14 20:10:40 PST 2017
Author: jvesely
Date: Tue Nov 14 20:10:39 2017
New Revision: 318265
URL: http://llvm.org/viewvc/llvm-project?rev=318265&view=rev
Log:
math: Implement minmag
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Added:
libclc/trunk/generic/include/clc/math/minmag.h
libclc/trunk/generic/lib/math/minmag.cl
libclc/trunk/generic/lib/math/minmag.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=318265&r1=318264&r2=318265&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Nov 14 20:10:39 2017
@@ -84,6 +84,7 @@
#include <clc/math/logb.h>
#include <clc/math/mad.h>
#include <clc/math/maxmag.h>
+#include <clc/math/minmag.h>
#include <clc/math/modf.h>
#include <clc/math/nextafter.h>
#include <clc/math/pow.h>
Added: libclc/trunk/generic/include/clc/math/minmag.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/minmag.h?rev=318265&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/minmag.h (added)
+++ libclc/trunk/generic/include/clc/math/minmag.h Tue Nov 14 20:10:39 2017
@@ -0,0 +1,7 @@
+#define __CLC_BODY <clc/math/binary_decl_tt.inc>
+#define __CLC_FUNCTION minmag
+
+#include <clc/math/gentype.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=318265&r1=318264&r2=318265&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Tue Nov 14 20:10:39 2017
@@ -119,6 +119,7 @@ math/log2.cl
math/logb.cl
math/mad.cl
math/maxmag.cl
+math/minmag.cl
math/modf.cl
math/native_cos.cl
math/native_divide.cl
Added: libclc/trunk/generic/lib/math/minmag.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/minmag.cl?rev=318265&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/minmag.cl (added)
+++ libclc/trunk/generic/lib/math/minmag.cl Tue Nov 14 20:10:39 2017
@@ -0,0 +1,4 @@
+#include <clc/clc.h>
+
+#define __CLC_BODY <minmag.inc>
+#include <clc/math/gentype.inc>
Added: libclc/trunk/generic/lib/math/minmag.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/minmag.inc?rev=318265&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/minmag.inc (added)
+++ libclc/trunk/generic/lib/math/minmag.inc Tue Nov 14 20:10:39 2017
@@ -0,0 +1,4 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE minmag(__CLC_GENTYPE x, __CLC_GENTYPE y) {
+ const __CLC_GENTYPE res = select(y, x, isless(fabs(x), fabs(y)));
+ return select(res, fmin(x, y), isnan(x) | isnan(y) | isequal(fabs(x), fabs(y)));
+}
More information about the cfe-commits
mailing list