[libclc] r185001 - libclc: implement initial version of min()
Tom Stellard
thomas.stellard at amd.com
Wed Jun 26 11:21:38 PDT 2013
Author: tstellar
Date: Wed Jun 26 13:21:38 2013
New Revision: 185001
URL: http://llvm.org/viewvc/llvm-project?rev=185001&view=rev
Log:
libclc: implement initial version of min()
This doesn't handle the integer cases for min(vector, scalar).
Patch by: Aaron Watry
Added:
libclc/trunk/generic/include/clc/shared/min.h
libclc/trunk/generic/include/clc/shared/min.inc
libclc/trunk/generic/lib/shared/min.cl
libclc/trunk/generic/lib/shared/min.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=185001&r1=185000&r2=185001&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Wed Jun 26 13:21:38 2013
@@ -69,6 +69,7 @@
/* 6.11.2 and 6.11.3 Shared Integer/Math Functions */
#include <clc/shared/clamp.h>
#include <clc/shared/max.h>
+#include <clc/shared/min.h>
/* 6.11.5 Geometric Functions */
#include <clc/geometric/cross.h>
Added: libclc/trunk/generic/include/clc/shared/min.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/shared/min.h?rev=185001&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/shared/min.h (added)
+++ libclc/trunk/generic/include/clc/shared/min.h Wed Jun 26 13:21:38 2013
@@ -0,0 +1,5 @@
+#define BODY <clc/shared/min.inc>
+#include <clc/integer/gentype.inc>
+
+#define BODY <clc/shared/min.inc>
+#include <clc/math/gentype.inc>
Added: libclc/trunk/generic/include/clc/shared/min.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/shared/min.inc?rev=185001&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/shared/min.inc (added)
+++ libclc/trunk/generic/include/clc/shared/min.inc Wed Jun 26 13:21:38 2013
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL GENTYPE min(GENTYPE a, GENTYPE b);
Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=185001&r1=185000&r2=185001&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Wed Jun 26 13:21:38 2013
@@ -19,5 +19,6 @@ math/mad.cl
relational/any.cl
shared/clamp.cl
shared/max.cl
+shared/min.cl
workitem/get_global_id.cl
workitem/get_global_size.cl
Added: libclc/trunk/generic/lib/shared/min.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/shared/min.cl?rev=185001&view=auto
==============================================================================
--- libclc/trunk/generic/lib/shared/min.cl (added)
+++ libclc/trunk/generic/lib/shared/min.cl Wed Jun 26 13:21:38 2013
@@ -0,0 +1,11 @@
+#include <clc/clc.h>
+
+#define BODY <min.inc>
+#include <clc/integer/gentype.inc>
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
+#define BODY <min.inc>
+#include <clc/math/gentype.inc>
Added: libclc/trunk/generic/lib/shared/min.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/shared/min.inc?rev=185001&view=auto
==============================================================================
--- libclc/trunk/generic/lib/shared/min.inc (added)
+++ libclc/trunk/generic/lib/shared/min.inc Wed Jun 26 13:21:38 2013
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF GENTYPE min(GENTYPE a, GENTYPE b) {
+ return (a < b ? a : b);
+}
More information about the cfe-commits
mailing list