[libclc] [libclc] Move clcmacro.h to CLC library. NFC (PR #114845)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 10:21:28 PST 2024


https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/114845

None

>From e2ac0ddbd762774282e878e043bac0edbbe75407 Mon Sep 17 00:00:00 2001
From: Fraser Cormack <fraser at codeplay.com>
Date: Mon, 4 Nov 2024 14:35:59 +0000
Subject: [PATCH] [libclc] Move clcmacro.h to CLC library. NFC

---
 libclc/amdgcn/lib/integer/popcount.cl         |   2 +-
 libclc/amdgcn/lib/math/fmax.cl                |   3 +-
 libclc/amdgcn/lib/math/fmin.cl                |   3 +-
 libclc/amdgcn/lib/math/ldexp.cl               |   3 +-
 libclc/amdgpu/lib/math/half_native_unary.inc  |   2 +-
 libclc/amdgpu/lib/math/nextafter.cl           |   2 +-
 libclc/amdgpu/lib/math/sqrt.cl                |   4 +-
 .../lib => clc/include/clc}/clcmacro.h        | 214 ++++++++++--------
 libclc/clspv/lib/math/fma.cl                  |   4 +-
 libclc/generic/include/math/clc_sqrt.h        |   3 +
 libclc/generic/include/utils.h                |  10 -
 libclc/generic/lib/atom_int32_binary.inc      |   2 +-
 libclc/generic/lib/common/degrees.cl          |   3 +-
 libclc/generic/lib/common/radians.cl          |   3 +-
 libclc/generic/lib/common/sign.cl             |   2 +-
 libclc/generic/lib/common/smoothstep.cl       |   3 +-
 libclc/generic/lib/common/step.cl             |   3 +-
 libclc/generic/lib/integer/add_sat.cl         |   2 +-
 libclc/generic/lib/integer/clz.cl             |   2 +-
 libclc/generic/lib/integer/mad_sat.cl         |   2 +-
 libclc/generic/lib/integer/sub_sat.cl         |   2 +-
 libclc/generic/lib/math/acos.cl               |   2 +-
 libclc/generic/lib/math/acosh.cl              |   2 +-
 libclc/generic/lib/math/acospi.cl             |   2 +-
 libclc/generic/lib/math/asin.cl               |   2 +-
 libclc/generic/lib/math/asinh.cl              |   2 +-
 libclc/generic/lib/math/asinpi.cl             |   2 +-
 libclc/generic/lib/math/atan.cl               |   2 +-
 libclc/generic/lib/math/atan2.cl              |   2 +-
 libclc/generic/lib/math/atan2pi.cl            |   2 +-
 libclc/generic/lib/math/atanh.cl              |   2 +-
 libclc/generic/lib/math/atanpi.cl             |   2 +-
 libclc/generic/lib/math/cbrt.cl               |   2 +-
 libclc/generic/lib/math/ceil.cl               |   2 +-
 libclc/generic/lib/math/clc_exp10.cl          |   2 +-
 libclc/generic/lib/math/clc_fma.cl            |   2 +-
 libclc/generic/lib/math/clc_fmod.cl           |   2 +-
 libclc/generic/lib/math/clc_hypot.cl          |   2 +-
 libclc/generic/lib/math/clc_ldexp.cl          |   2 +-
 libclc/generic/lib/math/clc_nextafter.cl      |   2 +-
 libclc/generic/lib/math/clc_pow.cl            |   2 +-
 libclc/generic/lib/math/clc_pown.cl           |   2 +-
 libclc/generic/lib/math/clc_powr.cl           |   2 +-
 libclc/generic/lib/math/clc_remainder.cl      |   2 +-
 libclc/generic/lib/math/clc_remquo.cl         |   2 +-
 libclc/generic/lib/math/clc_rootn.cl          |   2 +-
 libclc/generic/lib/math/clc_sw_binary.inc     |   2 +-
 libclc/generic/lib/math/clc_sw_unary.inc      |   2 +-
 libclc/generic/lib/math/clc_tan.cl            |   2 +-
 libclc/generic/lib/math/clc_tanpi.cl          |   2 +-
 libclc/generic/lib/math/copysign.cl           |   2 +-
 libclc/generic/lib/math/cos.cl                |   2 +-
 libclc/generic/lib/math/cosh.cl               |   2 +-
 libclc/generic/lib/math/cospi.cl              |   2 +-
 libclc/generic/lib/math/erf.cl                |   2 +-
 libclc/generic/lib/math/erfc.cl               |   2 +-
 libclc/generic/lib/math/exp.cl                |   2 +-
 libclc/generic/lib/math/exp2.cl               |   2 +-
 libclc/generic/lib/math/expm1.cl              |   2 +-
 libclc/generic/lib/math/fabs.cl               |   2 +-
 libclc/generic/lib/math/floor.cl              |   2 +-
 libclc/generic/lib/math/fmax.cl               |   3 +-
 libclc/generic/lib/math/fmin.cl               |   3 +-
 libclc/generic/lib/math/frexp.cl              |   2 +-
 libclc/generic/lib/math/frexp.inc             |   2 +-
 libclc/generic/lib/math/half_binary.inc       |   2 +-
 libclc/generic/lib/math/half_unary.inc        |   2 +-
 libclc/generic/lib/math/ilogb.cl              |   4 +-
 libclc/generic/lib/math/ldexp.cl              |   4 +-
 libclc/generic/lib/math/lgamma.cl             |   2 +-
 libclc/generic/lib/math/lgamma_r.cl           |   2 +-
 libclc/generic/lib/math/log.cl                |   2 +-
 libclc/generic/lib/math/log10.cl              |   4 +-
 libclc/generic/lib/math/log1p.cl              |   2 +-
 libclc/generic/lib/math/log2.cl               |   4 +-
 libclc/generic/lib/math/logb.cl               |   4 +-
 libclc/generic/lib/math/maxmag.cl             |   2 +-
 libclc/generic/lib/math/minmag.cl             |   2 +-
 libclc/generic/lib/math/nan.cl                |   2 +-
 .../lib/math/native_unary_intrinsic.inc       |   2 +-
 libclc/generic/lib/math/rsqrt.cl              |   3 +-
 libclc/generic/lib/math/sin.cl                |   2 +-
 libclc/generic/lib/math/sinh.cl               |   2 +-
 libclc/generic/lib/math/sinpi.cl              |   2 +-
 libclc/generic/lib/math/tables.h              |   2 +
 libclc/generic/lib/math/tanh.cl               |   2 +-
 libclc/generic/lib/math/tgamma.cl             |   2 +-
 libclc/generic/lib/math/unary_builtin.inc     |   4 +-
 libclc/generic/lib/relational/bitselect.cl    |   3 +-
 libclc/generic/lib/relational/select.cl       |   2 +-
 libclc/ptx/lib/math/nextafter.cl              |   2 +-
 libclc/r600/lib/math/fmax.cl                  |   2 +-
 libclc/r600/lib/math/fmin.cl                  |   2 +-
 libclc/r600/lib/math/native_rsqrt.cl          |   3 +-
 libclc/r600/lib/math/rsqrt.cl                 |   3 +-
 95 files changed, 220 insertions(+), 220 deletions(-)
 rename libclc/{generic/lib => clc/include/clc}/clcmacro.h (55%)
 delete mode 100644 libclc/generic/include/utils.h

diff --git a/libclc/amdgcn/lib/integer/popcount.cl b/libclc/amdgcn/lib/integer/popcount.cl
index ebd167d04da7cb..3b493fbd146f01 100644
--- a/libclc/amdgcn/lib/integer/popcount.cl
+++ b/libclc/amdgcn/lib/integer/popcount.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include <utils.h>
+#include <clc/utils.h>
 #include <integer/popcount.h>
 
 #define __CLC_BODY "popcount.inc"
diff --git a/libclc/amdgcn/lib/math/fmax.cl b/libclc/amdgcn/lib/math/fmax.cl
index cb796161010829..4407d4a87f9ea9 100644
--- a/libclc/amdgcn/lib/math/fmax.cl
+++ b/libclc/amdgcn/lib/math/fmax.cl
@@ -1,6 +1,5 @@
 #include <clc/clc.h>
-
-#include "../../../generic/lib/clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_DEF _CLC_OVERLOAD float fmax(float x, float y)
 {
diff --git a/libclc/amdgcn/lib/math/fmin.cl b/libclc/amdgcn/lib/math/fmin.cl
index 35dea8bc975f7f..4d02a47babdabb 100644
--- a/libclc/amdgcn/lib/math/fmin.cl
+++ b/libclc/amdgcn/lib/math/fmin.cl
@@ -1,6 +1,5 @@
 #include <clc/clc.h>
-
-#include "../../../generic/lib/clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_DEF _CLC_OVERLOAD float fmin(float x, float y)
 {
diff --git a/libclc/amdgcn/lib/math/ldexp.cl b/libclc/amdgcn/lib/math/ldexp.cl
index 9713e4daee0e79..d46d2dc606818a 100644
--- a/libclc/amdgcn/lib/math/ldexp.cl
+++ b/libclc/amdgcn/lib/math/ldexp.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "../../../generic/lib/clcmacro.h"
+#include <clc/clcmacro.h>
 
 #ifdef __HAS_LDEXPF__
 #define BUILTINF __builtin_amdgcn_ldexpf
diff --git a/libclc/amdgpu/lib/math/half_native_unary.inc b/libclc/amdgpu/lib/math/half_native_unary.inc
index 0f99ba5e521630..bdc380600501a6 100644
--- a/libclc/amdgpu/lib/math/half_native_unary.inc
+++ b/libclc/amdgpu/lib/math/half_native_unary.inc
@@ -1,4 +1,4 @@
-#include <utils.h>
+#include <clc/utils.h>
 
 #define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x)
 #define __CLC_NATIVE_FUNC(x) __CLC_CONCAT(native_, x)
diff --git a/libclc/amdgpu/lib/math/nextafter.cl b/libclc/amdgpu/lib/math/nextafter.cl
index b290da0e417dd4..6dc117b8cdd64c 100644
--- a/libclc/amdgpu/lib/math/nextafter.cl
+++ b/libclc/amdgpu/lib/math/nextafter.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../lib/clcmacro.h"
+#include <clc/clcmacro.h>
 #include <math/clc_nextafter.h>
 
 _CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __clc_nextafter, float, float)
diff --git a/libclc/amdgpu/lib/math/sqrt.cl b/libclc/amdgpu/lib/math/sqrt.cl
index 556260033169b6..17d77e50d44d3f 100644
--- a/libclc/amdgpu/lib/math/sqrt.cl
+++ b/libclc/amdgpu/lib/math/sqrt.cl
@@ -20,9 +20,9 @@
  * THE SOFTWARE.
  */
 
-#include <clc/clc.h>
-#include "../../../generic/lib/clcmacro.h"
 #include "math/clc_sqrt.h"
+#include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 _CLC_DEFINE_UNARY_BUILTIN(float, sqrt, __clc_sqrt, float)
 
diff --git a/libclc/generic/lib/clcmacro.h b/libclc/clc/include/clc/clcmacro.h
similarity index 55%
rename from libclc/generic/lib/clcmacro.h
rename to libclc/clc/include/clc/clcmacro.h
index fa302b398adc68..244239284ecabc 100644
--- a/libclc/generic/lib/clcmacro.h
+++ b/libclc/clc/include/clc/clcmacro.h
@@ -1,92 +1,105 @@
-#include <clc/clc.h>
-#include <utils.h>
-
-#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)); \
+#ifndef __CLC_CLCMACRO_H__
+#define __CLC_CLCMACRO_H__
+
+#include <clc/internal/clc.h>
+#include <clc/utils.h>
+
+#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_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_V_S_V_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
-  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE x, ARG2_TYPE##2 y) { \
-    return (RET_TYPE##2)(FUNCTION(x, y.lo), FUNCTION(x, y.hi)); \
-  } \
-\
-  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE x, ARG2_TYPE##3 y) { \
-    return (RET_TYPE##3)(FUNCTION(x, y.x), FUNCTION(x, y.y), \
-                         FUNCTION(x, y.z)); \
-  } \
-\
-  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE x, ARG2_TYPE##4 y) { \
-    return (RET_TYPE##4)(FUNCTION(x, y.lo), FUNCTION(x, y.hi)); \
-  } \
-\
-  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE x, ARG2_TYPE##8 y) { \
-    return (RET_TYPE##8)(FUNCTION(x, y.lo), FUNCTION(x, y.hi)); \
-  } \
-\
-  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE x, ARG2_TYPE##16 y) { \
-    return (RET_TYPE##16)(FUNCTION(x, y.lo), FUNCTION(x, y.hi)); \
-  } \
-\
-
-#define _CLC_TERNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
-  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y, ARG3_TYPE##2 z) { \
-    return (RET_TYPE##2)(FUNCTION(x.x, y.x, z.x), FUNCTION(x.y, y.y, z.y)); \
-  } \
-\
-  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y, ARG3_TYPE##3 z) { \
-    return (RET_TYPE##3)(FUNCTION(x.x, y.x, z.x), FUNCTION(x.y, y.y, z.y), \
-                         FUNCTION(x.z, y.z, z.z)); \
-  } \
-\
-  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y, ARG3_TYPE##4 z) { \
-    return (RET_TYPE##4)(FUNCTION(x.lo, y.lo, z.lo), FUNCTION(x.hi, y.hi, z.hi)); \
-  } \
-\
-  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y, ARG3_TYPE##8 z) { \
-    return (RET_TYPE##8)(FUNCTION(x.lo, y.lo, z.lo), FUNCTION(x.hi, y.hi, z.hi)); \
-  } \
-\
-  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y, ARG3_TYPE##16 z) { \
-    return (RET_TYPE##16)(FUNCTION(x.lo, y.lo, z.lo), FUNCTION(x.hi, y.hi, z.hi)); \
+#define _CLC_V_S_V_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE,          \
+                             ARG2_TYPE)                                        \
+  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE x, ARG2_TYPE##2 y) {                 \
+    return (RET_TYPE##2)(FUNCTION(x, y.lo), FUNCTION(x, y.hi));                \
+  }                                                                            \
+                                                                               \
+  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE x, ARG2_TYPE##3 y) {                 \
+    return (RET_TYPE##3)(FUNCTION(x, y.x), FUNCTION(x, y.y),                   \
+                         FUNCTION(x, y.z));                                    \
+  }                                                                            \
+                                                                               \
+  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE x, ARG2_TYPE##4 y) {                 \
+    return (RET_TYPE##4)(FUNCTION(x, y.lo), FUNCTION(x, y.hi));                \
+  }                                                                            \
+                                                                               \
+  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE x, ARG2_TYPE##8 y) {                 \
+    return (RET_TYPE##8)(FUNCTION(x, y.lo), FUNCTION(x, y.hi));                \
+  }                                                                            \
+                                                                               \
+  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE x, ARG2_TYPE##16 y) {               \
+    return (RET_TYPE##16)(FUNCTION(x, y.lo), FUNCTION(x, y.hi));               \
+  }
+
+#define _CLC_TERNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE,        \
+                               ARG2_TYPE, ARG3_TYPE)                           \
+  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y,                \
+                                ARG3_TYPE##2 z) {                              \
+    return (RET_TYPE##2)(FUNCTION(x.x, y.x, z.x), FUNCTION(x.y, y.y, z.y));    \
+  }                                                                            \
+                                                                               \
+  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y,                \
+                                ARG3_TYPE##3 z) {                              \
+    return (RET_TYPE##3)(FUNCTION(x.x, y.x, z.x), FUNCTION(x.y, y.y, z.y),     \
+                         FUNCTION(x.z, y.z, z.z));                             \
+  }                                                                            \
+                                                                               \
+  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y,                \
+                                ARG3_TYPE##4 z) {                              \
+    return (RET_TYPE##4)(FUNCTION(x.lo, y.lo, z.lo),                           \
+                         FUNCTION(x.hi, y.hi, z.hi));                          \
+  }                                                                            \
+                                                                               \
+  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y,                \
+                                ARG3_TYPE##8 z) {                              \
+    return (RET_TYPE##8)(FUNCTION(x.lo, y.lo, z.lo),                           \
+                         FUNCTION(x.hi, y.hi, z.hi));                          \
+  }                                                                            \
+                                                                               \
+  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y,             \
+                                 ARG3_TYPE##16 z) {                            \
+    return (RET_TYPE##16)(FUNCTION(x.lo, y.lo, z.lo),                          \
+                          FUNCTION(x.hi, y.hi, z.hi));                         \
   }
 
 #define _CLC_V_S_S_V_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE,        \
@@ -161,21 +174,24 @@
                            ARG2_TYPE, 8) *)((ADDR_SPACE ARG2_TYPE *)y + 8)));  \
   }
 
-#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_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_BINARY_BUILTIN_WITH_SCALAR_SECOND_ARG(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \
-_CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \
-_CLC_BINARY_VECTORIZE_SCALAR_SECOND_ARG(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE)
+#define _CLC_DEFINE_BINARY_BUILTIN_WITH_SCALAR_SECOND_ARG(                     \
+    RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE)                         \
+  _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE,           \
+                             ARG2_TYPE)                                        \
+  _CLC_BINARY_VECTORIZE_SCALAR_SECOND_ARG(_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)
+#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)
 
 #ifdef cl_khr_fp16
 
@@ -199,3 +215,5 @@ _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE)
 #define _CLC_DEFINE_BINARY_BUILTIN_FP16(FUNCTION)
 
 #endif
+
+#endif // __CLC_CLCMACRO_H__
diff --git a/libclc/clspv/lib/math/fma.cl b/libclc/clspv/lib/math/fma.cl
index 3ffca28bd3bef6..e6251db4e92dbe 100644
--- a/libclc/clspv/lib/math/fma.cl
+++ b/libclc/clspv/lib/math/fma.cl
@@ -24,9 +24,9 @@
 // (__clc_sw_fma), but avoids the use of ulong in favor of uint2. The logic has
 // been updated as appropriate.
 
-#include <clc/clc.h>
-#include "../../../generic/lib/clcmacro.h"
 #include "../../../generic/lib/math/math.h"
+#include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 struct fp {
   uint2 mantissa;
diff --git a/libclc/generic/include/math/clc_sqrt.h b/libclc/generic/include/math/clc_sqrt.h
index 60e183ff66a5ce..90a7c575c9bad9 100644
--- a/libclc/generic/include/math/clc_sqrt.h
+++ b/libclc/generic/include/math/clc_sqrt.h
@@ -1,3 +1,6 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
 #define __CLC_FUNCTION __clc_sqrt
 #define __CLC_BODY <clc/math/unary_decl.inc>
 #include <clc/math/gentype.inc>
diff --git a/libclc/generic/include/utils.h b/libclc/generic/include/utils.h
deleted file mode 100644
index 018a7b31f8ff3d..00000000000000
--- a/libclc/generic/include/utils.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __CLC_UTILS_H_
-#define __CLC_UTILS_H_
-
-#define __CLC_CONCAT(x, y) x ## y
-#define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y)
-
-#define __CLC_STR(x) #x
-#define __CLC_XSTR(x) __CLC_STR(x)
-
-#endif
diff --git a/libclc/generic/lib/atom_int32_binary.inc b/libclc/generic/lib/atom_int32_binary.inc
index 3af4c4bb0ae80f..5d3b33fcc1edfd 100644
--- a/libclc/generic/lib/atom_int32_binary.inc
+++ b/libclc/generic/lib/atom_int32_binary.inc
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "utils.h"
+#include <clc/utils.h>
 
 #define __CLC_ATOM_IMPL(AS, TYPE) \
 _CLC_OVERLOAD _CLC_DEF TYPE __CLC_XCONCAT(atom_, __CLC_ATOMIC_OP) (volatile AS TYPE *p, TYPE val) { \
diff --git a/libclc/generic/lib/common/degrees.cl b/libclc/generic/lib/common/degrees.cl
index 5de56f86c4ca93..cf49b190c76b37 100644
--- a/libclc/generic/lib/common/degrees.cl
+++ b/libclc/generic/lib/common/degrees.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF float degrees(float radians) {
   // 180/pi = ~57.29577951308232087685 or 0x1.ca5dc1a63c1f8p+5 or 0x1.ca5dc2p+5F
diff --git a/libclc/generic/lib/common/radians.cl b/libclc/generic/lib/common/radians.cl
index 3838dd6cde60f0..645a30549afedd 100644
--- a/libclc/generic/lib/common/radians.cl
+++ b/libclc/generic/lib/common/radians.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF float radians(float degrees) {
   // pi/180 = ~0.01745329251994329577 or 0x1.1df46a2529d39p-6 or 0x1.1df46ap-6F
diff --git a/libclc/generic/lib/common/sign.cl b/libclc/generic/lib/common/sign.cl
index 7b6b793be79c19..ad8f7405e0cb30 100644
--- a/libclc/generic/lib/common/sign.cl
+++ b/libclc/generic/lib/common/sign.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 #define SIGN(TYPE, F) \
 _CLC_DEF _CLC_OVERLOAD TYPE sign(TYPE x) { \
diff --git a/libclc/generic/lib/common/smoothstep.cl b/libclc/generic/lib/common/smoothstep.cl
index 1b6a74b89d2c21..4cdecfc4abe26e 100644
--- a/libclc/generic/lib/common/smoothstep.cl
+++ b/libclc/generic/lib/common/smoothstep.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF float smoothstep(float edge0, float edge1, float x) {
   float t = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f);
diff --git a/libclc/generic/lib/common/step.cl b/libclc/generic/lib/common/step.cl
index 8155b469fb210f..3d9bc53c2e146d 100644
--- a/libclc/generic/lib/common/step.cl
+++ b/libclc/generic/lib/common/step.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF float step(float edge, float x) {
   return x < edge ? 0.0f : 1.0f;
diff --git a/libclc/generic/lib/integer/add_sat.cl b/libclc/generic/lib/integer/add_sat.cl
index 252dce9775bfaf..11a4a331fbd02a 100644
--- a/libclc/generic/lib/integer/add_sat.cl
+++ b/libclc/generic/lib/integer/add_sat.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 // From add_sat.ll
 _CLC_DECL char   __clc_add_sat_s8(char, char);
diff --git a/libclc/generic/lib/integer/clz.cl b/libclc/generic/lib/integer/clz.cl
index e2080b5dd18ba6..904d027d376134 100644
--- a/libclc/generic/lib/integer/clz.cl
+++ b/libclc/generic/lib/integer/clz.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF char clz(char x) {
   return clz((ushort)(uchar)x) - 8;
diff --git a/libclc/generic/lib/integer/mad_sat.cl b/libclc/generic/lib/integer/mad_sat.cl
index 1708b29efffc5b..2372eaacd6da82 100644
--- a/libclc/generic/lib/integer/mad_sat.cl
+++ b/libclc/generic/lib/integer/mad_sat.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF char mad_sat(char x, char y, char z) {
   return clamp((short)mad24((short)x, (short)y, (short)z), (short)CHAR_MIN, (short) CHAR_MAX);
diff --git a/libclc/generic/lib/integer/sub_sat.cl b/libclc/generic/lib/integer/sub_sat.cl
index 2fbc31664e711b..e6beef787c0366 100644
--- a/libclc/generic/lib/integer/sub_sat.cl
+++ b/libclc/generic/lib/integer/sub_sat.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF char sub_sat(char x, char y) {
   short r = x - y;
diff --git a/libclc/generic/lib/math/acos.cl b/libclc/generic/lib/math/acos.cl
index af59f443e87173..aeb72872da342c 100644
--- a/libclc/generic/lib/math/acos.cl
+++ b/libclc/generic/lib/math/acos.cl
@@ -20,9 +20,9 @@
  * THE SOFTWARE.
  */
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float acos(float x) {
     // Computes arccos(x).
diff --git a/libclc/generic/lib/math/acosh.cl b/libclc/generic/lib/math/acosh.cl
index 6e8dd78c3c00c1..4656f14457d429 100644
--- a/libclc/generic/lib/math/acosh.cl
+++ b/libclc/generic/lib/math/acosh.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "ep_log.h"
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF  float acosh(float x) {
     uint ux = as_uint(x);
diff --git a/libclc/generic/lib/math/acospi.cl b/libclc/generic/lib/math/acospi.cl
index 7ebf802b5fbc59..83a47eb27e8367 100644
--- a/libclc/generic/lib/math/acospi.cl
+++ b/libclc/generic/lib/math/acospi.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float acospi(float x) {
     // Computes arccos(x).
diff --git a/libclc/generic/lib/math/asin.cl b/libclc/generic/lib/math/asin.cl
index 43ce9055564cf0..443dec830eb2f8 100644
--- a/libclc/generic/lib/math/asin.cl
+++ b/libclc/generic/lib/math/asin.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float asin(float x) {
     // Computes arcsin(x).
diff --git a/libclc/generic/lib/math/asinh.cl b/libclc/generic/lib/math/asinh.cl
index 9f8ddad873af07..f7637ade227ee0 100644
--- a/libclc/generic/lib/math/asinh.cl
+++ b/libclc/generic/lib/math/asinh.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "ep_log.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float asinh(float x) {
     uint ux = as_uint(x);
diff --git a/libclc/generic/lib/math/asinpi.cl b/libclc/generic/lib/math/asinpi.cl
index 511d74ec589fc7..18dc53000b034e 100644
--- a/libclc/generic/lib/math/asinpi.cl
+++ b/libclc/generic/lib/math/asinpi.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float asinpi(float x) {
     // Computes arcsin(x).
diff --git a/libclc/generic/lib/math/atan.cl b/libclc/generic/lib/math/atan.cl
index 2fa6e8d116cc35..28eaaf7b2ae72b 100644
--- a/libclc/generic/lib/math/atan.cl
+++ b/libclc/generic/lib/math/atan.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float atan(float x)
 {
diff --git a/libclc/generic/lib/math/atan2.cl b/libclc/generic/lib/math/atan2.cl
index d260338b83ec7e..98b457a69a0e2e 100644
--- a/libclc/generic/lib/math/atan2.cl
+++ b/libclc/generic/lib/math/atan2.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float atan2(float y, float x)
 {
diff --git a/libclc/generic/lib/math/atan2pi.cl b/libclc/generic/lib/math/atan2pi.cl
index ad2eda3dec87ca..ad41b11bd37413 100644
--- a/libclc/generic/lib/math/atan2pi.cl
+++ b/libclc/generic/lib/math/atan2pi.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF  float atan2pi(float y, float x) {
     const float pi = 0x1.921fb6p+1f;
diff --git a/libclc/generic/lib/math/atanh.cl b/libclc/generic/lib/math/atanh.cl
index 524af025b0b586..f2298a2624e84c 100644
--- a/libclc/generic/lib/math/atanh.cl
+++ b/libclc/generic/lib/math/atanh.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float atanh(float x) {
     uint ux = as_uint(x);
diff --git a/libclc/generic/lib/math/atanpi.cl b/libclc/generic/lib/math/atanpi.cl
index 625af12ba85185..9e6b3ece7f325d 100644
--- a/libclc/generic/lib/math/atanpi.cl
+++ b/libclc/generic/lib/math/atanpi.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float atanpi(float x) {
     const float pi = 3.1415926535897932f;
diff --git a/libclc/generic/lib/math/cbrt.cl b/libclc/generic/lib/math/cbrt.cl
index 2f5ff9516ed768..8462f5f6e14bbc 100644
--- a/libclc/generic/lib/math/cbrt.cl
+++ b/libclc/generic/lib/math/cbrt.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float cbrt(float x) {
 
diff --git a/libclc/generic/lib/math/ceil.cl b/libclc/generic/lib/math/ceil.cl
index 68240892ee1e32..e02789e694e06e 100644
--- a/libclc/generic/lib/math/ceil.cl
+++ b/libclc/generic/lib/math/ceil.cl
@@ -1,5 +1,5 @@
-#include "../clcmacro.h"
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_ceil.h>
 
 #undef __CLC_FUNCTION
diff --git a/libclc/generic/lib/math/clc_exp10.cl b/libclc/generic/lib/math/clc_exp10.cl
index c6a9476939b563..01e6fd652004a9 100644
--- a/libclc/generic/lib/math/clc_exp10.cl
+++ b/libclc/generic/lib/math/clc_exp10.cl
@@ -21,11 +21,11 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "config.h"
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 //    Algorithm:
 //
diff --git a/libclc/generic/lib/math/clc_fma.cl b/libclc/generic/lib/math/clc_fma.cl
index 34355a3b3c0275..609981ac3624b3 100644
--- a/libclc/generic/lib/math/clc_fma.cl
+++ b/libclc/generic/lib/math/clc_fma.cl
@@ -21,8 +21,8 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
-#include "../clcmacro.h"
 #include "config.h"
 #include "math.h"
 
diff --git a/libclc/generic/lib/math/clc_fmod.cl b/libclc/generic/lib/math/clc_fmod.cl
index c167dc893942ca..3a179879e62497 100644
--- a/libclc/generic/lib/math/clc_fmod.cl
+++ b/libclc/generic/lib/math/clc_fmod.cl
@@ -21,11 +21,11 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_floor.h>
 #include <clc/math/clc_trunc.h>
 
 #include <math/clc_remainder.h>
-#include "../clcmacro.h"
 #include "config.h"
 #include "math.h"
 
diff --git a/libclc/generic/lib/math/clc_hypot.cl b/libclc/generic/lib/math/clc_hypot.cl
index ce88f276cf2f20..7ab39bcd67a972 100644
--- a/libclc/generic/lib/math/clc_hypot.cl
+++ b/libclc/generic/lib/math/clc_hypot.cl
@@ -21,12 +21,12 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/shared/clc_clamp.h>
 #include <math/clc_hypot.h>
 
 #include "config.h"
 #include "math.h"
-#include "../clcmacro.h"
 
 // Returns sqrt(x*x + y*y) with no overflow or underflow unless the result
 // warrants it
diff --git a/libclc/generic/lib/math/clc_ldexp.cl b/libclc/generic/lib/math/clc_ldexp.cl
index 438c31835a3648..ccb37631706b80 100644
--- a/libclc/generic/lib/math/clc_ldexp.cl
+++ b/libclc/generic/lib/math/clc_ldexp.cl
@@ -20,10 +20,10 @@
  * THE SOFTWARE.
  */
 
-#include "../clcmacro.h"
 #include "config.h"
 #include "math.h"
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/shared/clc_clamp.h>
 
 _CLC_DEF _CLC_OVERLOAD float __clc_ldexp(float x, int n) {
diff --git a/libclc/generic/lib/math/clc_nextafter.cl b/libclc/generic/lib/math/clc_nextafter.cl
index d32ef7079e1152..ccb7624d20c56f 100644
--- a/libclc/generic/lib/math/clc_nextafter.cl
+++ b/libclc/generic/lib/math/clc_nextafter.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 // This file provides OpenCL C implementations of nextafter for
 // targets that don't support the clang builtin.
diff --git a/libclc/generic/lib/math/clc_pow.cl b/libclc/generic/lib/math/clc_pow.cl
index a41ca2bc1a761c..2e2dade0d6b8fa 100644
--- a/libclc/generic/lib/math/clc_pow.cl
+++ b/libclc/generic/lib/math/clc_pow.cl
@@ -21,12 +21,12 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 
 #include "config.h"
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 /*
  compute pow using log and exp
diff --git a/libclc/generic/lib/math/clc_pown.cl b/libclc/generic/lib/math/clc_pown.cl
index 84668dc0abbb95..031bf9b25e6a1a 100644
--- a/libclc/generic/lib/math/clc_pown.cl
+++ b/libclc/generic/lib/math/clc_pown.cl
@@ -21,12 +21,12 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 
 #include "config.h"
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 // compute pow using log and exp
 // x^y = exp(y * log(x))
diff --git a/libclc/generic/lib/math/clc_powr.cl b/libclc/generic/lib/math/clc_powr.cl
index a67d524c7a6bb9..c431f529f3b97d 100644
--- a/libclc/generic/lib/math/clc_powr.cl
+++ b/libclc/generic/lib/math/clc_powr.cl
@@ -21,12 +21,12 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 
 #include "config.h"
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 // compute pow using log and exp
 // x^y = exp(y * log(x))
diff --git a/libclc/generic/lib/math/clc_remainder.cl b/libclc/generic/lib/math/clc_remainder.cl
index 2275ff0c0e701d..aef2ee973a1fe9 100644
--- a/libclc/generic/lib/math/clc_remainder.cl
+++ b/libclc/generic/lib/math/clc_remainder.cl
@@ -21,11 +21,11 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_floor.h>
 #include <clc/math/clc_trunc.h>
 
 #include <math/clc_remainder.h>
-#include "../clcmacro.h"
 #include "config.h"
 #include "math.h"
 
diff --git a/libclc/generic/lib/math/clc_remquo.cl b/libclc/generic/lib/math/clc_remquo.cl
index 1ece44e93f28ea..003f8a1227f12f 100644
--- a/libclc/generic/lib/math/clc_remquo.cl
+++ b/libclc/generic/lib/math/clc_remquo.cl
@@ -21,11 +21,11 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_floor.h>
 #include <clc/math/clc_trunc.h>
 
 #include <math/clc_remainder.h>
-#include "../clcmacro.h"
 #include "config.h"
 #include "math.h"
 
diff --git a/libclc/generic/lib/math/clc_rootn.cl b/libclc/generic/lib/math/clc_rootn.cl
index e27356b77d8686..eee9c9fcaa2d42 100644
--- a/libclc/generic/lib/math/clc_rootn.cl
+++ b/libclc/generic/lib/math/clc_rootn.cl
@@ -21,12 +21,12 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 
 #include "config.h"
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 // compute pow using log and exp
 // x^y = exp(y * log(x))
diff --git a/libclc/generic/lib/math/clc_sw_binary.inc b/libclc/generic/lib/math/clc_sw_binary.inc
index 5cf15a21f78053..b701d78878c6a5 100644
--- a/libclc/generic/lib/math/clc_sw_binary.inc
+++ b/libclc/generic/lib/math/clc_sw_binary.inc
@@ -1,4 +1,4 @@
-#include <utils.h>
+#include <clc/utils.h>
 
 #define __CLC_SW_FUNC(x) __CLC_CONCAT(__clc_, x)
 
diff --git a/libclc/generic/lib/math/clc_sw_unary.inc b/libclc/generic/lib/math/clc_sw_unary.inc
index 9b908aee87a18c..0cf242dfeb366c 100644
--- a/libclc/generic/lib/math/clc_sw_unary.inc
+++ b/libclc/generic/lib/math/clc_sw_unary.inc
@@ -1,4 +1,4 @@
-#include <utils.h>
+#include <clc/utils.h>
 
 #define __CLC_SW_FUNC(x) __CLC_CONCAT(__clc_, x)
 
diff --git a/libclc/generic/lib/math/clc_tan.cl b/libclc/generic/lib/math/clc_tan.cl
index 29b0369ceb142d..d14ab71740501a 100644
--- a/libclc/generic/lib/math/clc_tan.cl
+++ b/libclc/generic/lib/math/clc_tan.cl
@@ -20,11 +20,11 @@
  * THE SOFTWARE.
  */
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 
 #include "math.h"
 #include "sincos_helpers.h"
-#include "../clcmacro.h"
 #include "tables.h"
 
 _CLC_DEF _CLC_OVERLOAD float __clc_tan(float x) {
diff --git a/libclc/generic/lib/math/clc_tanpi.cl b/libclc/generic/lib/math/clc_tanpi.cl
index d57c3ce3eb2403..65d19845937060 100644
--- a/libclc/generic/lib/math/clc_tanpi.cl
+++ b/libclc/generic/lib/math/clc_tanpi.cl
@@ -20,10 +20,10 @@
  * THE SOFTWARE.
  */
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "sincos_helpers.h"
-#include "../clcmacro.h"
 #include "tables.h"
 
 _CLC_DEF _CLC_OVERLOAD float __clc_tanpi(float x)
diff --git a/libclc/generic/lib/math/copysign.cl b/libclc/generic/lib/math/copysign.cl
index df65e9d7fece1b..08045bebf88a1c 100644
--- a/libclc/generic/lib/math/copysign.cl
+++ b/libclc/generic/lib/math/copysign.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_DEFINE_BINARY_BUILTIN(float, copysign, __builtin_copysignf, float, float)
 
diff --git a/libclc/generic/lib/math/cos.cl b/libclc/generic/lib/math/cos.cl
index 0af7aa67ba0090..42192895151a30 100644
--- a/libclc/generic/lib/math/cos.cl
+++ b/libclc/generic/lib/math/cos.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "sincos_helpers.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float cos(float x)
 {
diff --git a/libclc/generic/lib/math/cosh.cl b/libclc/generic/lib/math/cosh.cl
index 0987d1f9216922..1f58d7acd2b55f 100644
--- a/libclc/generic/lib/math/cosh.cl
+++ b/libclc/generic/lib/math/cosh.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float cosh(float x) {
 
diff --git a/libclc/generic/lib/math/cospi.cl b/libclc/generic/lib/math/cospi.cl
index d6ab27ba021e2e..0e69f7885faa1c 100644
--- a/libclc/generic/lib/math/cospi.cl
+++ b/libclc/generic/lib/math/cospi.cl
@@ -21,11 +21,11 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "sincos_helpers.h"
 #include "sincospiF_piby4.h"
-#include "../clcmacro.h"
 #ifdef cl_khr_fp64
 #include "sincosD_piby4.h"
 #endif
diff --git a/libclc/generic/lib/math/erf.cl b/libclc/generic/lib/math/erf.cl
index 2c395ce1a75267..ae8b6ab7845581 100644
--- a/libclc/generic/lib/math/erf.cl
+++ b/libclc/generic/lib/math/erf.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 /*
  * ====================================================
diff --git a/libclc/generic/lib/math/erfc.cl b/libclc/generic/lib/math/erfc.cl
index cd35ea8def7b6a..c4d34ea85e98b3 100644
--- a/libclc/generic/lib/math/erfc.cl
+++ b/libclc/generic/lib/math/erfc.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 /*
  * ====================================================
diff --git a/libclc/generic/lib/math/exp.cl b/libclc/generic/lib/math/exp.cl
index cc7b7f39bf1dbc..1e37d76f3ac8e8 100644
--- a/libclc/generic/lib/math/exp.cl
+++ b/libclc/generic/lib/math/exp.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float exp(float x) {
 
diff --git a/libclc/generic/lib/math/exp2.cl b/libclc/generic/lib/math/exp2.cl
index 1ddccbd3ee653a..8d718311f896f0 100644
--- a/libclc/generic/lib/math/exp2.cl
+++ b/libclc/generic/lib/math/exp2.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float exp2(float x) {
 
diff --git a/libclc/generic/lib/math/expm1.cl b/libclc/generic/lib/math/expm1.cl
index 9a0aa37ac333bf..fbb9f0d087c897 100644
--- a/libclc/generic/lib/math/expm1.cl
+++ b/libclc/generic/lib/math/expm1.cl
@@ -1,8 +1,8 @@
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 /* Refer to the exp routine for the underlying algorithm */
 
diff --git a/libclc/generic/lib/math/fabs.cl b/libclc/generic/lib/math/fabs.cl
index 888c01d9e231de..9644369d4a0953 100644
--- a/libclc/generic/lib/math/fabs.cl
+++ b/libclc/generic/lib/math/fabs.cl
@@ -1,5 +1,5 @@
-#include "../clcmacro.h"
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 
 #undef __CLC_FUNCTION
diff --git a/libclc/generic/lib/math/floor.cl b/libclc/generic/lib/math/floor.cl
index 2d7ec4182f4855..f5c36b73862a46 100644
--- a/libclc/generic/lib/math/floor.cl
+++ b/libclc/generic/lib/math/floor.cl
@@ -1,5 +1,5 @@
-#include "../clcmacro.h"
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 #include <clc/math/clc_floor.h>
 
 #undef __CLC_FUNCTION
diff --git a/libclc/generic/lib/math/fmax.cl b/libclc/generic/lib/math/fmax.cl
index 5c269ceccdda37..c42fe4f54a9e67 100644
--- a/libclc/generic/lib/math/fmax.cl
+++ b/libclc/generic/lib/math/fmax.cl
@@ -1,6 +1,5 @@
 #include <clc/clc.h>
-
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_DEFINE_BINARY_BUILTIN(float, fmax, __builtin_fmaxf, float, float);
 
diff --git a/libclc/generic/lib/math/fmin.cl b/libclc/generic/lib/math/fmin.cl
index 45c112d991ff92..55575d0486b60a 100644
--- a/libclc/generic/lib/math/fmin.cl
+++ b/libclc/generic/lib/math/fmin.cl
@@ -1,6 +1,5 @@
 #include <clc/clc.h>
-
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_DEFINE_BINARY_BUILTIN(float, fmin, __builtin_fminf, float, float);
 
diff --git a/libclc/generic/lib/math/frexp.cl b/libclc/generic/lib/math/frexp.cl
index cd2c7178151123..75a9158ff318fb 100644
--- a/libclc/generic/lib/math/frexp.cl
+++ b/libclc/generic/lib/math/frexp.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include <utils.h>
+#include <clc/utils.h>
 
 #define __CLC_BODY <frexp.inc>
 #define __CLC_ADDRESS_SPACE private
diff --git a/libclc/generic/lib/math/frexp.inc b/libclc/generic/lib/math/frexp.inc
index e6e2af49235a45..0d938d23c26a19 100644
--- a/libclc/generic/lib/math/frexp.inc
+++ b/libclc/generic/lib/math/frexp.inc
@@ -21,7 +21,7 @@
  * THE SOFTWARE.
  */
 
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 #define __CLC_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE)
 #define __CLC_AS_INTN __CLC_XCONCAT(as_, __CLC_INTN)
diff --git a/libclc/generic/lib/math/half_binary.inc b/libclc/generic/lib/math/half_binary.inc
index f831b530b4b53d..2dc48e512e0978 100644
--- a/libclc/generic/lib/math/half_binary.inc
+++ b/libclc/generic/lib/math/half_binary.inc
@@ -1,4 +1,4 @@
-#include <utils.h>
+#include <clc/utils.h>
 
 #define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x)
 
diff --git a/libclc/generic/lib/math/half_unary.inc b/libclc/generic/lib/math/half_unary.inc
index a68f91a70beb57..aac668a6f0059a 100644
--- a/libclc/generic/lib/math/half_unary.inc
+++ b/libclc/generic/lib/math/half_unary.inc
@@ -1,4 +1,4 @@
-#include <utils.h>
+#include <clc/utils.h>
 
 #define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x)
 
diff --git a/libclc/generic/lib/math/ilogb.cl b/libclc/generic/lib/math/ilogb.cl
index d085e8608b01a5..f16b4404fbebe8 100644
--- a/libclc/generic/lib/math/ilogb.cl
+++ b/libclc/generic/lib/math/ilogb.cl
@@ -21,9 +21,9 @@
  * THE SOFTWARE.
  */
 
-#include <clc/clc.h>
-#include "../clcmacro.h"
 #include "math.h"
+#include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF int ilogb(float x) {
     uint ux = as_uint(x);
diff --git a/libclc/generic/lib/math/ldexp.cl b/libclc/generic/lib/math/ldexp.cl
index 190a4d5f5fc344..a999c63902ce82 100644
--- a/libclc/generic/lib/math/ldexp.cl
+++ b/libclc/generic/lib/math/ldexp.cl
@@ -20,11 +20,11 @@
  * THE SOFTWARE.
  */
 
-#include <clc/clc.h>
 #include "config.h"
-#include "../clcmacro.h"
 #include "math.h"
 #include "math/clc_ldexp.h"
+#include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 _CLC_DEFINE_BINARY_BUILTIN(float, ldexp, __clc_ldexp, float, int)
 
diff --git a/libclc/generic/lib/math/lgamma.cl b/libclc/generic/lib/math/lgamma.cl
index 024894f2f304fd..ca7b9610a31b38 100644
--- a/libclc/generic/lib/math/lgamma.cl
+++ b/libclc/generic/lib/math/lgamma.cl
@@ -22,7 +22,7 @@
  */
 
 #include <clc/clc.h>
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF float lgamma(float x) {
     int s;
diff --git a/libclc/generic/lib/math/lgamma_r.cl b/libclc/generic/lib/math/lgamma_r.cl
index fe28e420d1286b..bd68a76068ec5e 100644
--- a/libclc/generic/lib/math/lgamma_r.cl
+++ b/libclc/generic/lib/math/lgamma_r.cl
@@ -22,8 +22,8 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
-#include "../clcmacro.h"
 #include "math.h"
 
 /*
diff --git a/libclc/generic/lib/math/log.cl b/libclc/generic/lib/math/log.cl
index ec1faa12606aaf..336c8016a6ed8a 100644
--- a/libclc/generic/lib/math/log.cl
+++ b/libclc/generic/lib/math/log.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 /*
  *log(x) = log2(x) * (1/log2(e))
diff --git a/libclc/generic/lib/math/log10.cl b/libclc/generic/lib/math/log10.cl
index e669f3148f9c02..3abb14a28d8ad8 100644
--- a/libclc/generic/lib/math/log10.cl
+++ b/libclc/generic/lib/math/log10.cl
@@ -20,9 +20,9 @@
  * THE SOFTWARE.
  */
 
-#include <clc/clc.h>
-#include "../clcmacro.h"
 #include "tables.h"
+#include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #ifdef cl_khr_fp64
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
diff --git a/libclc/generic/lib/math/log1p.cl b/libclc/generic/lib/math/log1p.cl
index 42fd9d3a23f342..a371995a084928 100644
--- a/libclc/generic/lib/math/log1p.cl
+++ b/libclc/generic/lib/math/log1p.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float log1p(float x)
 {
diff --git a/libclc/generic/lib/math/log2.cl b/libclc/generic/lib/math/log2.cl
index 64463557e3f6db..a6f9692881bb8f 100644
--- a/libclc/generic/lib/math/log2.cl
+++ b/libclc/generic/lib/math/log2.cl
@@ -20,9 +20,9 @@
  * THE SOFTWARE.
  */
 
-#include <clc/clc.h>
-#include "../clcmacro.h"
 #include "tables.h"
+#include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #ifdef cl_khr_fp64
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
diff --git a/libclc/generic/lib/math/logb.cl b/libclc/generic/lib/math/logb.cl
index c0c2b5de40ebce..7a7111d5bc84dd 100644
--- a/libclc/generic/lib/math/logb.cl
+++ b/libclc/generic/lib/math/logb.cl
@@ -1,6 +1,6 @@
-#include <clc/clc.h>
 #include "math.h"
-#include "../clcmacro.h"
+#include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF float logb(float x) {
     int ax = as_int(x) & EXSIGNBIT_SP32;
diff --git a/libclc/generic/lib/math/maxmag.cl b/libclc/generic/lib/math/maxmag.cl
index 7b5902d8a8e569..12d22ae0393886 100644
--- a/libclc/generic/lib/math/maxmag.cl
+++ b/libclc/generic/lib/math/maxmag.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include <utils.h>
+#include <clc/utils.h>
 
 #define __CLC_BODY <maxmag.inc>
 #include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/minmag.cl b/libclc/generic/lib/math/minmag.cl
index 0d898820609726..e9c9c82f29900b 100644
--- a/libclc/generic/lib/math/minmag.cl
+++ b/libclc/generic/lib/math/minmag.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include <utils.h>
+#include <clc/utils.h>
 
 #define __CLC_BODY <minmag.inc>
 #include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/nan.cl b/libclc/generic/lib/math/nan.cl
index 03752ab2d238b9..8f89e8e760de85 100644
--- a/libclc/generic/lib/math/nan.cl
+++ b/libclc/generic/lib/math/nan.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "utils.h"
+#include <clc/utils.h>
 
 #define __CLC_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE)
 #define __CLC_BODY <nan.inc>
diff --git a/libclc/generic/lib/math/native_unary_intrinsic.inc b/libclc/generic/lib/math/native_unary_intrinsic.inc
index dbea2882a128ec..c0a3efdc8b9a3b 100644
--- a/libclc/generic/lib/math/native_unary_intrinsic.inc
+++ b/libclc/generic/lib/math/native_unary_intrinsic.inc
@@ -20,7 +20,7 @@
  * THE SOFTWARE.
  */
 
-#include <utils.h>
+#include <clc/utils.h>
 
 #ifdef __CLC_SCALAR
 #define __CLC_FUNCTION __CLC_XCONCAT(__clc_native_, __CLC_NATIVE_INTRINSIC)
diff --git a/libclc/generic/lib/math/rsqrt.cl b/libclc/generic/lib/math/rsqrt.cl
index 131ffc194a90f4..b38d4a1c3cc82c 100644
--- a/libclc/generic/lib/math/rsqrt.cl
+++ b/libclc/generic/lib/math/rsqrt.cl
@@ -1,6 +1,5 @@
 #include <clc/clc.h>
-
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF float rsqrt(float x)
 {
diff --git a/libclc/generic/lib/math/sin.cl b/libclc/generic/lib/math/sin.cl
index 689c3a1dbd0c8e..30638a57f59b58 100644
--- a/libclc/generic/lib/math/sin.cl
+++ b/libclc/generic/lib/math/sin.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "sincos_helpers.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float sin(float x)
 {
diff --git a/libclc/generic/lib/math/sinh.cl b/libclc/generic/lib/math/sinh.cl
index a7a092f1f547db..3de0792361c2f5 100644
--- a/libclc/generic/lib/math/sinh.cl
+++ b/libclc/generic/lib/math/sinh.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "tables.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float sinh(float x)
 {
diff --git a/libclc/generic/lib/math/sinpi.cl b/libclc/generic/lib/math/sinpi.cl
index c8a1031df0216d..520bba5415c7c0 100644
--- a/libclc/generic/lib/math/sinpi.cl
+++ b/libclc/generic/lib/math/sinpi.cl
@@ -21,10 +21,10 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
 #include "sincospiF_piby4.h"
-#include "../clcmacro.h"
 #ifdef cl_khr_fp64
 #include "sincosD_piby4.h"
 #endif
diff --git a/libclc/generic/lib/math/tables.h b/libclc/generic/lib/math/tables.h
index 8045242b89ce46..ea5221e1f72b07 100644
--- a/libclc/generic/lib/math/tables.h
+++ b/libclc/generic/lib/math/tables.h
@@ -20,6 +20,8 @@
  * THE SOFTWARE.
  */
 
+#include <clc/clctypes.h>
+
 #define TABLE_SPACE __constant
 
 #define TABLE_MANGLE(NAME) __clc_##NAME
diff --git a/libclc/generic/lib/math/tanh.cl b/libclc/generic/lib/math/tanh.cl
index 6a6810cec11384..e558bb93a55964 100644
--- a/libclc/generic/lib/math/tanh.cl
+++ b/libclc/generic/lib/math/tanh.cl
@@ -21,9 +21,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float tanh(float x)
 {
diff --git a/libclc/generic/lib/math/tgamma.cl b/libclc/generic/lib/math/tgamma.cl
index 29c069fc925bb3..314ffda4ec9d59 100644
--- a/libclc/generic/lib/math/tgamma.cl
+++ b/libclc/generic/lib/math/tgamma.cl
@@ -22,9 +22,9 @@
  */
 
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
 #include "math.h"
-#include "../clcmacro.h"
 
 _CLC_OVERLOAD _CLC_DEF float tgamma(float x) {
     const float pi = 3.1415926535897932384626433832795f;
diff --git a/libclc/generic/lib/math/unary_builtin.inc b/libclc/generic/lib/math/unary_builtin.inc
index 4e7ca5ba9b98e4..6405c3fb32f890 100644
--- a/libclc/generic/lib/math/unary_builtin.inc
+++ b/libclc/generic/lib/math/unary_builtin.inc
@@ -1,5 +1,5 @@
-#include "../clcmacro.h"
-#include "utils.h"
+#include <clc/clcmacro.h>
+#include <clc/utils.h>
 
 #ifndef __CLC_BUILTIN
 #define __CLC_BUILTIN __CLC_XCONCAT(__clc_, __CLC_FUNCTION)
diff --git a/libclc/generic/lib/relational/bitselect.cl b/libclc/generic/lib/relational/bitselect.cl
index af4e70ccbdd6b0..d2a7a920606782 100644
--- a/libclc/generic/lib/relational/bitselect.cl
+++ b/libclc/generic/lib/relational/bitselect.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "../clcmacro.h"
+#include <clc/clcmacro.h>
 
 #define __CLC_BODY <bitselect.inc>
 #include <clc/integer/gentype.inc>
diff --git a/libclc/generic/lib/relational/select.cl b/libclc/generic/lib/relational/select.cl
index dc2e273c852b42..094f4f9f29fa91 100644
--- a/libclc/generic/lib/relational/select.cl
+++ b/libclc/generic/lib/relational/select.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include <utils.h>
+#include <clc/utils.h>
 
 #define __CLC_BODY <select.inc>
 #include <clc/math/gentype.inc>
diff --git a/libclc/ptx/lib/math/nextafter.cl b/libclc/ptx/lib/math/nextafter.cl
index 5b4521d21c26a1..809eecac53d8c4 100644
--- a/libclc/ptx/lib/math/nextafter.cl
+++ b/libclc/ptx/lib/math/nextafter.cl
@@ -1,5 +1,5 @@
 #include <clc/clc.h>
-#include "../lib/clcmacro.h"
+#include <clc/clcmacro.h>
 #include <math/clc_nextafter.h>
 
 _CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __clc_nextafter, float, float)
diff --git a/libclc/r600/lib/math/fmax.cl b/libclc/r600/lib/math/fmax.cl
index e4b9e4c821fb27..a43530fc7507ee 100644
--- a/libclc/r600/lib/math/fmax.cl
+++ b/libclc/r600/lib/math/fmax.cl
@@ -1,6 +1,6 @@
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
-#include "../../../generic/lib/clcmacro.h"
 #include "../../../generic/lib/math/math.h"
 
 _CLC_DEF _CLC_OVERLOAD float fmax(float x, float y)
diff --git a/libclc/r600/lib/math/fmin.cl b/libclc/r600/lib/math/fmin.cl
index 09f1e4c7faad38..a43655da138451 100644
--- a/libclc/r600/lib/math/fmin.cl
+++ b/libclc/r600/lib/math/fmin.cl
@@ -1,6 +1,6 @@
 #include <clc/clc.h>
+#include <clc/clcmacro.h>
 
-#include "../../../generic/lib/clcmacro.h"
 #include "../../../generic/lib/math/math.h"
 
 _CLC_DEF _CLC_OVERLOAD float fmin(float x, float y)
diff --git a/libclc/r600/lib/math/native_rsqrt.cl b/libclc/r600/lib/math/native_rsqrt.cl
index edf473e8409c6d..78871f3823a519 100644
--- a/libclc/r600/lib/math/native_rsqrt.cl
+++ b/libclc/r600/lib/math/native_rsqrt.cl
@@ -1,6 +1,5 @@
 #include <clc/clc.h>
-
-#include "../../../generic/lib/clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF float native_rsqrt(float x)
 {
diff --git a/libclc/r600/lib/math/rsqrt.cl b/libclc/r600/lib/math/rsqrt.cl
index 37a8037902c28e..53f7d4040463fb 100644
--- a/libclc/r600/lib/math/rsqrt.cl
+++ b/libclc/r600/lib/math/rsqrt.cl
@@ -1,6 +1,5 @@
 #include <clc/clc.h>
-
-#include "../../../generic/lib/clcmacro.h"
+#include <clc/clcmacro.h>
 
 _CLC_OVERLOAD _CLC_DEF float rsqrt(float x)
 {



More information about the cfe-commits mailing list