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