[libclc] r184992 - libclc: Add max() builtin function
Tom Stellard
thomas.stellard at amd.com
Wed Jun 26 11:20:46 PDT 2013
Author: tstellar
Date: Wed Jun 26 13:20:46 2013
New Revision: 184992
URL: http://llvm.org/viewvc/llvm-project?rev=184992&view=rev
Log:
libclc: Add max() builtin function
Adds this function for both int and floating data types.
Patch by: Aaron Watry
Added:
libclc/trunk/generic/include/clc/integer/max.h
libclc/trunk/generic/include/clc/integer/max.inc
libclc/trunk/generic/include/clc/math/max.h
libclc/trunk/generic/include/clc/math/max.inc
libclc/trunk/generic/lib/integer/max.cl
libclc/trunk/generic/lib/integer/max.inc
libclc/trunk/generic/lib/math/max.cl
libclc/trunk/generic/lib/math/max.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=184992&r1=184991&r2=184992&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Wed Jun 26 13:20:46 2013
@@ -45,6 +45,7 @@
#include <clc/math/log.h>
#include <clc/math/log2.h>
#include <clc/math/mad.h>
+#include <clc/math/max.h>
#include <clc/math/pow.h>
#include <clc/math/sin.h>
#include <clc/math/sqrt.h>
@@ -63,6 +64,7 @@
#include <clc/integer/abs.h>
#include <clc/integer/abs_diff.h>
#include <clc/integer/add_sat.h>
+#include <clc/integer/max.h>
#include <clc/integer/sub_sat.h>
/* 6.11.5 Geometric Functions */
Added: libclc/trunk/generic/include/clc/integer/max.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/integer/max.h?rev=184992&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/integer/max.h (added)
+++ libclc/trunk/generic/include/clc/integer/max.h Wed Jun 26 13:20:46 2013
@@ -0,0 +1,2 @@
+#define BODY <clc/integer/max.inc>
+#include <clc/integer/gentype.inc>
Added: libclc/trunk/generic/include/clc/integer/max.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/integer/max.inc?rev=184992&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/integer/max.inc (added)
+++ libclc/trunk/generic/include/clc/integer/max.inc Wed Jun 26 13:20:46 2013
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL GENTYPE max(GENTYPE a, GENTYPE b);
Added: libclc/trunk/generic/include/clc/math/max.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/max.h?rev=184992&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/max.h (added)
+++ libclc/trunk/generic/include/clc/math/max.h Wed Jun 26 13:20:46 2013
@@ -0,0 +1,2 @@
+#define BODY <clc/math/max.inc>
+#include <clc/math/gentype.inc>
Added: libclc/trunk/generic/include/clc/math/max.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/max.inc?rev=184992&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/max.inc (added)
+++ libclc/trunk/generic/include/clc/math/max.inc Wed Jun 26 13:20:46 2013
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL GENTYPE max(GENTYPE a, GENTYPE b);
Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=184992&r1=184991&r2=184992&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Wed Jun 26 13:20:46 2013
@@ -7,6 +7,7 @@ integer/abs.cl
integer/add_sat.cl
integer/add_sat.ll
integer/add_sat_impl.ll
+integer/max.cl
integer/sub_sat.cl
integer/sub_sat.ll
integer/sub_sat_impl.ll
@@ -14,6 +15,7 @@ math/fmax.cl
math/fmin.cl
math/hypot.cl
math/mad.cl
+math/max.cl
relational/any.cl
workitem/get_global_id.cl
workitem/get_global_size.cl
Added: libclc/trunk/generic/lib/integer/max.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/integer/max.cl?rev=184992&view=auto
==============================================================================
--- libclc/trunk/generic/lib/integer/max.cl (added)
+++ libclc/trunk/generic/lib/integer/max.cl Wed Jun 26 13:20:46 2013
@@ -0,0 +1,4 @@
+#include <clc/clc.h>
+
+#define BODY <max.inc>
+#include <clc/integer/gentype.inc>
Added: libclc/trunk/generic/lib/integer/max.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/integer/max.inc?rev=184992&view=auto
==============================================================================
--- libclc/trunk/generic/lib/integer/max.inc (added)
+++ libclc/trunk/generic/lib/integer/max.inc Wed Jun 26 13:20:46 2013
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF GENTYPE max(GENTYPE a, GENTYPE b) {
+ return (a > b ? a : b);
+}
Added: libclc/trunk/generic/lib/math/max.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/max.cl?rev=184992&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/max.cl (added)
+++ libclc/trunk/generic/lib/math/max.cl Wed Jun 26 13:20:46 2013
@@ -0,0 +1,8 @@
+#include <clc/clc.h>
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
+#define BODY <max.inc>
+#include <clc/math/gentype.inc>
Added: libclc/trunk/generic/lib/math/max.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/max.inc?rev=184992&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/max.inc (added)
+++ libclc/trunk/generic/lib/math/max.inc Wed Jun 26 13:20:46 2013
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF GENTYPE max(GENTYPE a, GENTYPE b) {
+ return (a > b ? a : b);
+}
More information about the cfe-commits
mailing list