[libclc] r211576 - Move clcmacro.h to avoid cluttering user namespace v2
Jeroen Ketema
j.ketema at imperial.ac.uk
Tue Jun 24 02:36:33 PDT 2014
Author: jketema
Date: Tue Jun 24 04:36:32 2014
New Revision: 211576
URL: http://llvm.org/viewvc/llvm-project?rev=211576&view=rev
Log:
Move clcmacro.h to avoid cluttering user namespace v2
v2: - use quotes instead of <>
- add include to r600/lib/math/nextafter.c changed
Reviewed-by: Tom Stellard <tom at stellard.net>
Reviewed-by: Aaron Watry <awatry at gmail.com>
Added:
libclc/trunk/generic/lib/clcmacro.h
Removed:
libclc/trunk/generic/include/clc/clcmacro.h
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/common/sign.cl
libclc/trunk/generic/lib/integer/add_sat.cl
libclc/trunk/generic/lib/integer/clz.cl
libclc/trunk/generic/lib/integer/sub_sat.cl
libclc/trunk/generic/lib/math/clc_nextafter.cl
libclc/trunk/generic/lib/math/nextafter.cl
libclc/trunk/generic/lib/math/pown.cl
libclc/trunk/generic/lib/relational/isnan.cl
libclc/trunk/r600/lib/math/nextafter.cl
Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Jun 24 04:36:32 2014
@@ -11,9 +11,6 @@
/* Function Attributes */
#include <clc/clcfunc.h>
-/* Pattern Macro Definitions */
-#include <clc/clcmacro.h>
-
/* 6.1 Supported Data Types */
#include <clc/clctypes.h>
Removed: libclc/trunk/generic/include/clc/clcmacro.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clcmacro.h?rev=211575&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/clcmacro.h (original)
+++ libclc/trunk/generic/include/clc/clcmacro.h (removed)
@@ -1,54 +0,0 @@
-#define _CLC_UNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE) \
- DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x) { \
- return (RET_TYPE##2)(FUNCTION(x.x), FUNCTION(x.y)); \
- } \
-\
- DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x) { \
- return (RET_TYPE##3)(FUNCTION(x.x), FUNCTION(x.y), FUNCTION(x.z)); \
- } \
-\
- DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x) { \
- return (RET_TYPE##4)(FUNCTION(x.lo), FUNCTION(x.hi)); \
- } \
-\
- DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x) { \
- return (RET_TYPE##8)(FUNCTION(x.lo), FUNCTION(x.hi)); \
- } \
-\
- DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x) { \
- return (RET_TYPE##16)(FUNCTION(x.lo), FUNCTION(x.hi)); \
- }
-
-#define _CLC_BINARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
- DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y) { \
- return (RET_TYPE##2)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y)); \
- } \
-\
- DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y) { \
- return (RET_TYPE##3)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y), \
- FUNCTION(x.z, y.z)); \
- } \
-\
- DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y) { \
- return (RET_TYPE##4)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
- } \
-\
- DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y) { \
- return (RET_TYPE##8)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
- } \
-\
- DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y) { \
- return (RET_TYPE##16)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
- }
-
-#define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \
-_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
- return BUILTIN(x, y); \
-} \
-_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE)
-
-#define _CLC_DEFINE_UNARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE) \
-_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x) { \
- return BUILTIN(x); \
-} \
-_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE)
Added: libclc/trunk/generic/lib/clcmacro.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/clcmacro.h?rev=211576&view=auto
==============================================================================
--- libclc/trunk/generic/lib/clcmacro.h (added)
+++ libclc/trunk/generic/lib/clcmacro.h Tue Jun 24 04:36:32 2014
@@ -0,0 +1,54 @@
+#define _CLC_UNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE) \
+ DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x) { \
+ return (RET_TYPE##2)(FUNCTION(x.x), FUNCTION(x.y)); \
+ } \
+\
+ DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x) { \
+ return (RET_TYPE##3)(FUNCTION(x.x), FUNCTION(x.y), FUNCTION(x.z)); \
+ } \
+\
+ DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x) { \
+ return (RET_TYPE##4)(FUNCTION(x.lo), FUNCTION(x.hi)); \
+ } \
+\
+ DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x) { \
+ return (RET_TYPE##8)(FUNCTION(x.lo), FUNCTION(x.hi)); \
+ } \
+\
+ DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x) { \
+ return (RET_TYPE##16)(FUNCTION(x.lo), FUNCTION(x.hi)); \
+ }
+
+#define _CLC_BINARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
+ DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y) { \
+ return (RET_TYPE##2)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y)); \
+ } \
+\
+ DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y) { \
+ return (RET_TYPE##3)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y), \
+ FUNCTION(x.z, y.z)); \
+ } \
+\
+ DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y) { \
+ return (RET_TYPE##4)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
+ } \
+\
+ DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y) { \
+ return (RET_TYPE##8)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
+ } \
+\
+ DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y) { \
+ return (RET_TYPE##16)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
+ }
+
+#define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \
+_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
+ return BUILTIN(x, y); \
+} \
+_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE)
+
+#define _CLC_DEFINE_UNARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE) \
+_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x) { \
+ return BUILTIN(x); \
+} \
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE)
Modified: libclc/trunk/generic/lib/common/sign.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/common/sign.cl?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/generic/lib/common/sign.cl (original)
+++ libclc/trunk/generic/lib/common/sign.cl Tue Jun 24 04:36:32 2014
@@ -1,4 +1,5 @@
#include <clc/clc.h>
+#include "../clcmacro.h"
#define SIGN(TYPE, F) \
_CLC_DEF _CLC_OVERLOAD TYPE sign(TYPE x) { \
Modified: libclc/trunk/generic/lib/integer/add_sat.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/integer/add_sat.cl?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/generic/lib/integer/add_sat.cl (original)
+++ libclc/trunk/generic/lib/integer/add_sat.cl Tue Jun 24 04:36:32 2014
@@ -1,4 +1,5 @@
#include <clc/clc.h>
+#include "../clcmacro.h"
// From add_sat.ll
_CLC_DECL char __clc_add_sat_s8(char, char);
Modified: libclc/trunk/generic/lib/integer/clz.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/integer/clz.cl?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/generic/lib/integer/clz.cl (original)
+++ libclc/trunk/generic/lib/integer/clz.cl Tue Jun 24 04:36:32 2014
@@ -1,4 +1,5 @@
#include <clc/clc.h>
+#include "../clcmacro.h"
// From clz.ll
_CLC_DECL char __clc_clz_s8(char);
Modified: libclc/trunk/generic/lib/integer/sub_sat.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/integer/sub_sat.cl?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/generic/lib/integer/sub_sat.cl (original)
+++ libclc/trunk/generic/lib/integer/sub_sat.cl Tue Jun 24 04:36:32 2014
@@ -1,4 +1,5 @@
#include <clc/clc.h>
+#include "../clcmacro.h"
// From sub_sat.ll
_CLC_DECL char __clc_sub_sat_s8(char, char);
Modified: libclc/trunk/generic/lib/math/clc_nextafter.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/clc_nextafter.cl?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/generic/lib/math/clc_nextafter.cl (original)
+++ libclc/trunk/generic/lib/math/clc_nextafter.cl Tue Jun 24 04:36:32 2014
@@ -1,4 +1,5 @@
#include <clc/clc.h>
+#include "../clcmacro.h"
// This file provides OpenCL C implementations of nextafter for targets that
// don't support the clang builtin.
Modified: libclc/trunk/generic/lib/math/nextafter.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/nextafter.cl?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/generic/lib/math/nextafter.cl (original)
+++ libclc/trunk/generic/lib/math/nextafter.cl Tue Jun 24 04:36:32 2014
@@ -1,4 +1,5 @@
#include <clc/clc.h>
+#include "../clcmacro.h"
_CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __builtin_nextafterf, float, float)
Modified: libclc/trunk/generic/lib/math/pown.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/pown.cl?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/generic/lib/math/pown.cl (original)
+++ libclc/trunk/generic/lib/math/pown.cl Tue Jun 24 04:36:32 2014
@@ -1,4 +1,5 @@
#include <clc/clc.h>
+#include "../clcmacro.h"
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, pown, float, int)
Modified: libclc/trunk/generic/lib/relational/isnan.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/relational/isnan.cl?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/generic/lib/relational/isnan.cl (original)
+++ libclc/trunk/generic/lib/relational/isnan.cl Tue Jun 24 04:36:32 2014
@@ -1,4 +1,5 @@
#include <clc/clc.h>
+#include "../clcmacro.h"
_CLC_DEFINE_UNARY_BUILTIN(int, isnan, __builtin_isnan, float)
Modified: libclc/trunk/r600/lib/math/nextafter.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/math/nextafter.cl?rev=211576&r1=211575&r2=211576&view=diff
==============================================================================
--- libclc/trunk/r600/lib/math/nextafter.cl (original)
+++ libclc/trunk/r600/lib/math/nextafter.cl Tue Jun 24 04:36:32 2014
@@ -1,3 +1,4 @@
#include <clc/clc.h>
+#include "../lib/clcmacro.h"
_CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __clc_nextafter, float, float)
More information about the cfe-commits
mailing list