[libclc] 78b5bb7 - [libclc][NFC] Move key math headers to CLC (#124739)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 06:17:27 PST 2025


Author: Fraser Cormack
Date: 2025-01-28T14:17:23Z
New Revision: 78b5bb702fe97fe85f66d72598d0dfa7c49fe001

URL: https://github.com/llvm/llvm-project/commit/78b5bb702fe97fe85f66d72598d0dfa7c49fe001
DIFF: https://github.com/llvm/llvm-project/commit/78b5bb702fe97fe85f66d72598d0dfa7c49fe001.diff

LOG: [libclc][NFC] Move key math headers to CLC (#124739)

Added: 
    libclc/clc/include/clc/math/clc_subnormal_config.h
    libclc/clc/include/clc/math/math.h
    libclc/clc/include/clc/math/tables.h

Modified: 
    libclc/clspv/lib/math/fma.cl
    libclc/clspv/lib/subnormal_config.cl
    libclc/generic/include/math/clc_ldexp.h
    libclc/generic/lib/math/acos.cl
    libclc/generic/lib/math/acosh.cl
    libclc/generic/lib/math/acospi.cl
    libclc/generic/lib/math/asin.cl
    libclc/generic/lib/math/asinh.cl
    libclc/generic/lib/math/asinpi.cl
    libclc/generic/lib/math/atan.cl
    libclc/generic/lib/math/atan2.cl
    libclc/generic/lib/math/atan2pi.cl
    libclc/generic/lib/math/atanh.cl
    libclc/generic/lib/math/atanpi.cl
    libclc/generic/lib/math/cbrt.cl
    libclc/generic/lib/math/clc_exp10.cl
    libclc/generic/lib/math/clc_fma.cl
    libclc/generic/lib/math/clc_fmod.cl
    libclc/generic/lib/math/clc_hypot.cl
    libclc/generic/lib/math/clc_ldexp.cl
    libclc/generic/lib/math/clc_pow.cl
    libclc/generic/lib/math/clc_pown.cl
    libclc/generic/lib/math/clc_powr.cl
    libclc/generic/lib/math/clc_remainder.cl
    libclc/generic/lib/math/clc_remquo.cl
    libclc/generic/lib/math/clc_rootn.cl
    libclc/generic/lib/math/clc_tan.cl
    libclc/generic/lib/math/clc_tanpi.cl
    libclc/generic/lib/math/cos.cl
    libclc/generic/lib/math/cosh.cl
    libclc/generic/lib/math/cospi.cl
    libclc/generic/lib/math/ep_log.cl
    libclc/generic/lib/math/ep_log.h
    libclc/generic/lib/math/erf.cl
    libclc/generic/lib/math/erfc.cl
    libclc/generic/lib/math/exp.cl
    libclc/generic/lib/math/exp2.cl
    libclc/generic/lib/math/exp_helper.cl
    libclc/generic/lib/math/expm1.cl
    libclc/generic/lib/math/fdim.cl
    libclc/generic/lib/math/fma.cl
    libclc/generic/lib/math/ilogb.cl
    libclc/generic/lib/math/ldexp.cl
    libclc/generic/lib/math/lgamma_r.cl
    libclc/generic/lib/math/log10.cl
    libclc/generic/lib/math/log1p.cl
    libclc/generic/lib/math/log2.cl
    libclc/generic/lib/math/log_base.h
    libclc/generic/lib/math/logb.cl
    libclc/generic/lib/math/modf.cl
    libclc/generic/lib/math/sin.cl
    libclc/generic/lib/math/sincos_helpers.cl
    libclc/generic/lib/math/sincos_helpers.h
    libclc/generic/lib/math/sinh.cl
    libclc/generic/lib/math/sinpi.cl
    libclc/generic/lib/math/tables.cl
    libclc/generic/lib/math/tanh.cl
    libclc/generic/lib/math/tgamma.cl
    libclc/generic/lib/subnormal_config.cl
    libclc/r600/lib/math/fmax.cl
    libclc/r600/lib/math/fmin.cl
    libclc/spirv/lib/subnormal_config.cl
    libclc/spirv64/lib/subnormal_config.cl

Removed: 
    libclc/generic/include/config.h
    libclc/generic/lib/math/math.h
    libclc/generic/lib/math/tables.h


################################################################################
diff  --git a/libclc/generic/include/config.h b/libclc/clc/include/clc/math/clc_subnormal_config.h
similarity index 90%
rename from libclc/generic/include/config.h
rename to libclc/clc/include/clc/math/clc_subnormal_config.h
index 7aa5967f4eb688..eaab5aaee985b5 100644
--- a/libclc/generic/include/config.h
+++ b/libclc/clc/include/clc/math/clc_subnormal_config.h
@@ -19,6 +19,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef __CLC_MATH_CLC_SUBNORMAL_CONFIG_H__
+#define __CLC_MATH_CLC_SUBNORMAL_CONFIG_H__
 
 #include <clc/clcfunc.h>
 
@@ -26,3 +28,5 @@ _CLC_DECL bool __clc_subnormals_disabled();
 _CLC_DECL bool __clc_fp16_subnormals_supported();
 _CLC_DECL bool __clc_fp32_subnormals_supported();
 _CLC_DECL bool __clc_fp64_subnormals_supported();
+
+#endif // __CLC_MATH_CLC_SUBNORMAL_CONFIG_H__

diff  --git a/libclc/generic/lib/math/math.h b/libclc/clc/include/clc/math/math.h
similarity index 52%
rename from libclc/generic/lib/math/math.h
rename to libclc/clc/include/clc/math/math.h
index d5ef0871e52019..ed37af237bf821 100644
--- a/libclc/generic/lib/math/math.h
+++ b/libclc/clc/include/clc/math/math.h
@@ -20,12 +20,12 @@
  * THE SOFTWARE.
  */
 
-#ifndef __CLC_MATH_H_
-#define __CLC_MATH_H_
+#ifndef __CLC_MATH_MATH_H__
+#define __CLC_MATH_MATH_H__
 
-#include "clc/clcfunc.h"
-#include "clc/as_type.h"
-#include "config.h"
+#include <clc/clc_as_type.h>
+#include <clc/clcfunc.h>
+#include <clc/math/clc_subnormal_config.h>
 
 #define SNAN 0x001
 #define QNAN 0x002
@@ -54,64 +54,64 @@ bool __attribute__((noinline)) __clc_runtime_has_hw_fma32(void);
 #define MATH_RECIP(X) (1.0f / (X))
 #define MATH_SQRT(X) sqrt(X)
 
-#define SIGNBIT_SP32      0x80000000
-#define EXSIGNBIT_SP32    0x7fffffff
-#define EXPBITS_SP32      0x7f800000
-#define MANTBITS_SP32     0x007fffff
-#define ONEEXPBITS_SP32   0x3f800000
-#define TWOEXPBITS_SP32   0x40000000
-#define HALFEXPBITS_SP32  0x3f000000
-#define IMPBIT_SP32       0x00800000
-#define QNANBITPATT_SP32  0x7fc00000
+#define SIGNBIT_SP32 0x80000000
+#define EXSIGNBIT_SP32 0x7fffffff
+#define EXPBITS_SP32 0x7f800000
+#define MANTBITS_SP32 0x007fffff
+#define ONEEXPBITS_SP32 0x3f800000
+#define TWOEXPBITS_SP32 0x40000000
+#define HALFEXPBITS_SP32 0x3f000000
+#define IMPBIT_SP32 0x00800000
+#define QNANBITPATT_SP32 0x7fc00000
 #define INDEFBITPATT_SP32 0xffc00000
-#define PINFBITPATT_SP32  0x7f800000
-#define NINFBITPATT_SP32  0xff800000
-#define EXPBIAS_SP32      127
+#define PINFBITPATT_SP32 0x7f800000
+#define NINFBITPATT_SP32 0xff800000
+#define EXPBIAS_SP32 127
 #define EXPSHIFTBITS_SP32 23
-#define BIASEDEMIN_SP32   1
-#define EMIN_SP32         -126
-#define BIASEDEMAX_SP32   254
-#define EMAX_SP32         127
-#define LAMBDA_SP32       1.0e30
-#define MANTLENGTH_SP32   24
-#define BASEDIGITS_SP32   7
+#define BIASEDEMIN_SP32 1
+#define EMIN_SP32 -126
+#define BIASEDEMAX_SP32 254
+#define EMAX_SP32 127
+#define LAMBDA_SP32 1.0e30
+#define MANTLENGTH_SP32 24
+#define BASEDIGITS_SP32 7
 
-_CLC_OVERLOAD _CLC_INLINE float __clc_flush_denormal_if_not_supported(float x)
-{
-	int ix = as_int(x);
-	if (!__clc_fp32_subnormals_supported() &&
-		((ix & EXPBITS_SP32) == 0) && ((ix & MANTBITS_SP32) != 0)) {
-		ix &= SIGNBIT_SP32;
-		x = as_float(ix);
-	}
-	return x;
+_CLC_OVERLOAD _CLC_INLINE float __clc_flush_denormal_if_not_supported(float x) {
+  int ix = __clc_as_int(x);
+  if (!__clc_fp32_subnormals_supported() && ((ix & EXPBITS_SP32) == 0) &&
+      ((ix & MANTBITS_SP32) != 0)) {
+    ix &= SIGNBIT_SP32;
+    x = __clc_as_float(ix);
+  }
+  return x;
 }
 
 #ifdef cl_khr_fp64
 
-#define SIGNBIT_DP64      0x8000000000000000L
-#define EXSIGNBIT_DP64    0x7fffffffffffffffL
-#define EXPBITS_DP64      0x7ff0000000000000L
-#define MANTBITS_DP64     0x000fffffffffffffL
-#define ONEEXPBITS_DP64   0x3ff0000000000000L
-#define TWOEXPBITS_DP64   0x4000000000000000L
-#define HALFEXPBITS_DP64  0x3fe0000000000000L
-#define IMPBIT_DP64       0x0010000000000000L
-#define QNANBITPATT_DP64  0x7ff8000000000000L
+#define SIGNBIT_DP64 0x8000000000000000L
+#define EXSIGNBIT_DP64 0x7fffffffffffffffL
+#define EXPBITS_DP64 0x7ff0000000000000L
+#define MANTBITS_DP64 0x000fffffffffffffL
+#define ONEEXPBITS_DP64 0x3ff0000000000000L
+#define TWOEXPBITS_DP64 0x4000000000000000L
+#define HALFEXPBITS_DP64 0x3fe0000000000000L
+#define IMPBIT_DP64 0x0010000000000000L
+#define QNANBITPATT_DP64 0x7ff8000000000000L
 #define INDEFBITPATT_DP64 0xfff8000000000000L
-#define PINFBITPATT_DP64  0x7ff0000000000000L
-#define NINFBITPATT_DP64  0xfff0000000000000L
-#define EXPBIAS_DP64      1023
+#define PINFBITPATT_DP64 0x7ff0000000000000L
+#define NINFBITPATT_DP64 0xfff0000000000000L
+#define EXPBIAS_DP64 1023
 #define EXPSHIFTBITS_DP64 52
-#define BIASEDEMIN_DP64   1
-#define EMIN_DP64         -1022
-#define BIASEDEMAX_DP64   2046 /* 0x7fe */
-#define EMAX_DP64         1023 /* 0x3ff */
-#define LAMBDA_DP64       1.0e300
-#define MANTLENGTH_DP64   53
-#define BASEDIGITS_DP64   15
+#define BIASEDEMIN_DP64 1
+#define EMIN_DP64 -1022
+#define BIASEDEMAX_DP64 2046 /* 0x7fe */
+#define EMAX_DP64 1023       /* 0x3ff */
+#define LAMBDA_DP64 1.0e300
+#define MANTLENGTH_DP64 53
+#define BASEDIGITS_DP64 15
 
 #endif // cl_khr_fp64
 
-#define ALIGNED(x)	__attribute__((aligned(x)))
-#endif // __CLC_MATH_H_
+#define ALIGNED(x) __attribute__((aligned(x)))
+
+#endif // __CLC_MATH_MATH_H__

diff  --git a/libclc/generic/lib/math/tables.h b/libclc/clc/include/clc/math/tables.h
similarity index 81%
rename from libclc/generic/lib/math/tables.h
rename to libclc/clc/include/clc/math/tables.h
index ea5221e1f72b07..71a332144c4749 100644
--- a/libclc/generic/lib/math/tables.h
+++ b/libclc/clc/include/clc/math/tables.h
@@ -20,32 +20,30 @@
  * THE SOFTWARE.
  */
 
+#ifndef __CLC_MATH_TABLES_H__
+#define __CLC_MATH_TABLES_H__
+
 #include <clc/clctypes.h>
 
 #define TABLE_SPACE __constant
 
 #define TABLE_MANGLE(NAME) __clc_##NAME
 
-#define DECLARE_TABLE(TYPE,NAME,LENGTH) \
-    TABLE_SPACE TYPE NAME [ LENGTH ]
+#define DECLARE_TABLE(TYPE, NAME, LENGTH) TABLE_SPACE TYPE NAME[LENGTH]
 
-#define TABLE_FUNCTION(TYPE,TABLE,NAME) \
-    TYPE TABLE_MANGLE(NAME)(size_t idx) { \
-        return TABLE[idx]; \
-    }
+#define TABLE_FUNCTION(TYPE, TABLE, NAME)                                      \
+  TYPE TABLE_MANGLE(NAME)(size_t idx) { return TABLE[idx]; }
 
-#define TABLE_FUNCTION_DECL(TYPE, NAME) \
-    TYPE TABLE_MANGLE(NAME)(size_t idx);
+#define TABLE_FUNCTION_DECL(TYPE, NAME) TYPE TABLE_MANGLE(NAME)(size_t idx);
 
-#define USE_TABLE(NAME, IDX) \
-    TABLE_MANGLE(NAME)(IDX)
+#define USE_TABLE(NAME, IDX) TABLE_MANGLE(NAME)(IDX)
 
 TABLE_FUNCTION_DECL(float2, loge_tbl);
 TABLE_FUNCTION_DECL(float, log_inv_tbl);
 TABLE_FUNCTION_DECL(float2, log_inv_tbl_ep);
 TABLE_FUNCTION_DECL(float2, log2_tbl);
 TABLE_FUNCTION_DECL(float2, log10_tbl);
-TABLE_FUNCTION_DECL(uint4,  pibits_tbl);
+TABLE_FUNCTION_DECL(uint4, pibits_tbl);
 TABLE_FUNCTION_DECL(float2, sinhcosh_tbl);
 TABLE_FUNCTION_DECL(float2, cbrt_tbl);
 TABLE_FUNCTION_DECL(float, exp_tbl);
@@ -67,3 +65,5 @@ TABLE_FUNCTION_DECL(double2, powlog_tbl);
 TABLE_FUNCTION_DECL(double2, log_f_inv_tbl);
 
 #endif // cl_khr_fp64
+
+#endif // __CLC_MATH_TABLES_H__

diff  --git a/libclc/clspv/lib/math/fma.cl b/libclc/clspv/lib/math/fma.cl
index e6251db4e92dbe..73c6e158601d9a 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 "../../../generic/lib/math/math.h"
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
+#include <clc/math/math.h>
 
 struct fp {
   uint2 mantissa;

diff  --git a/libclc/clspv/lib/subnormal_config.cl b/libclc/clspv/lib/subnormal_config.cl
index 167fe1b1a1bcfd..3ab5a6394b9333 100644
--- a/libclc/clspv/lib/subnormal_config.cl
+++ b/libclc/clspv/lib/subnormal_config.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "config.h"
+#include <clc/math/clc_subnormal_config.h>
 
 _CLC_DEF bool __clc_fp16_subnormals_supported() { return false; }
 

diff  --git a/libclc/generic/include/math/clc_ldexp.h b/libclc/generic/include/math/clc_ldexp.h
index 454b7ed3dcee5a..eb83f16240185e 100644
--- a/libclc/generic/include/math/clc_ldexp.h
+++ b/libclc/generic/include/math/clc_ldexp.h
@@ -1,3 +1,5 @@
+#include <clc/clcfunc.h>
+
 _CLC_DEF _CLC_OVERLOAD float __clc_ldexp(float, int);
 
 #ifdef cl_khr_fp64

diff  --git a/libclc/generic/lib/math/acos.cl b/libclc/generic/lib/math/acos.cl
index d71d10024b1800..273ddbd4b1ee53 100644
--- a/libclc/generic/lib/math/acos.cl
+++ b/libclc/generic/lib/math/acos.cl
@@ -19,10 +19,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.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 977c2e929b34cb..41671e94ea78c8 100644
--- a/libclc/generic/lib/math/acosh.cl
+++ b/libclc/generic/lib/math/acosh.cl
@@ -20,11 +20,10 @@
  * THE SOFTWARE.
  */
 
+#include "ep_log.h"
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "ep_log.h"
-#include "math.h"
+#include <clc/math/math.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 5aa8a083df4e97..d640ff24e5386f 100644
--- a/libclc/generic/lib/math/acospi.cl
+++ b/libclc/generic/lib/math/acospi.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.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 443dec830eb2f8..ae60b88e9037c4 100644
--- a/libclc/generic/lib/math/asin.cl
+++ b/libclc/generic/lib/math/asin.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.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 686d9f7a95e5d9..1a60fae8bdf9b6 100644
--- a/libclc/generic/lib/math/asinh.cl
+++ b/libclc/generic/lib/math/asinh.cl
@@ -20,11 +20,10 @@
  * THE SOFTWARE.
  */
 
+#include "ep_log.h"
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "ep_log.h"
+#include <clc/math/math.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 18dc53000b034e..64b15aff6792c6 100644
--- a/libclc/generic/lib/math/asinpi.cl
+++ b/libclc/generic/lib/math/asinpi.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.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 b6b067f2bf4ffe..95c247304f91a4 100644
--- a/libclc/generic/lib/math/atan.cl
+++ b/libclc/generic/lib/math/atan.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.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 32419937a856bd..067e43e445ed1d 100644
--- a/libclc/generic/lib/math/atan2.cl
+++ b/libclc/generic/lib/math/atan2.cl
@@ -22,9 +22,8 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "tables.h"
+#include <clc/math/math.h>
+#include <clc/math/tables.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 e631918f7539e2..d67cf90df63f84 100644
--- a/libclc/generic/lib/math/atan2pi.cl
+++ b/libclc/generic/lib/math/atan2pi.cl
@@ -22,9 +22,8 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "tables.h"
+#include <clc/math/math.h>
+#include <clc/math/tables.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 10bad190cc0dc0..81ae1a2ca801c4 100644
--- a/libclc/generic/lib/math/atanh.cl
+++ b/libclc/generic/lib/math/atanh.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.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 8522acf3499332..8c7bac4bb4bb29 100644
--- a/libclc/generic/lib/math/atanpi.cl
+++ b/libclc/generic/lib/math/atanpi.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.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 49f2ba8a411cbf..a2bf152f35f94f 100644
--- a/libclc/generic/lib/math/cbrt.cl
+++ b/libclc/generic/lib/math/cbrt.cl
@@ -22,9 +22,8 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "tables.h"
+#include <clc/math/math.h>
+#include <clc/math/tables.h>
 
 _CLC_OVERLOAD _CLC_DEF float cbrt(float x) {
 

diff  --git a/libclc/generic/lib/math/clc_exp10.cl b/libclc/generic/lib/math/clc_exp10.cl
index 572aa396942b7d..0eb53d013a85af 100644
--- a/libclc/generic/lib/math/clc_exp10.cl
+++ b/libclc/generic/lib/math/clc_exp10.cl
@@ -23,12 +23,11 @@
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
 #include <clc/math/clc_mad.h>
+#include <clc/math/clc_subnormal_config.h>
+#include <clc/math/math.h>
+#include <clc/math/tables.h>
 #include <clc/relational/clc_isnan.h>
 
-#include "config.h"
-#include "math.h"
-#include "tables.h"
-
 //    Algorithm:
 //
 //    e^x = 2^(x/ln(2)) = 2^(x*(64/ln(2))/64)

diff  --git a/libclc/generic/lib/math/clc_fma.cl b/libclc/generic/lib/math/clc_fma.cl
index 15de4c8032a932..3f29e7f92615a9 100644
--- a/libclc/generic/lib/math/clc_fma.cl
+++ b/libclc/generic/lib/math/clc_fma.cl
@@ -23,13 +23,12 @@
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
 #include <clc/integer/clc_abs.h>
+#include <clc/math/clc_subnormal_config.h>
+#include <clc/math/math.h>
 #include <clc/relational/clc_isinf.h>
 #include <clc/relational/clc_isnan.h>
 #include <clc/shared/clc_max.h>
 
-#include "config.h"
-#include "math.h"
-
 struct fp {
   ulong mantissa;
   int exponent;

diff  --git a/libclc/generic/lib/math/clc_fmod.cl b/libclc/generic/lib/math/clc_fmod.cl
index 5d101373178dd1..db47536833342f 100644
--- a/libclc/generic/lib/math/clc_fmod.cl
+++ b/libclc/generic/lib/math/clc_fmod.cl
@@ -23,12 +23,11 @@
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
 #include <clc/math/clc_floor.h>
+#include <clc/math/clc_subnormal_config.h>
 #include <clc/math/clc_trunc.h>
+#include <clc/math/math.h>
 #include <clc/shared/clc_max.h>
-
 #include <math/clc_remainder.h>
-#include "config.h"
-#include "math.h"
 
 _CLC_DEF _CLC_OVERLOAD float __clc_fmod(float x, float y)
 {

diff  --git a/libclc/generic/lib/math/clc_hypot.cl b/libclc/generic/lib/math/clc_hypot.cl
index d889969d6d8c23..fd2e87b4a1ed85 100644
--- a/libclc/generic/lib/math/clc_hypot.cl
+++ b/libclc/generic/lib/math/clc_hypot.cl
@@ -24,13 +24,12 @@
 #include <clc/clcmacro.h>
 #include <clc/integer/clc_abs.h>
 #include <clc/math/clc_mad.h>
+#include <clc/math/clc_subnormal_config.h>
+#include <clc/math/math.h>
 #include <clc/relational/clc_isnan.h>
 #include <clc/shared/clc_clamp.h>
 #include <math/clc_hypot.h>
 
-#include "config.h"
-#include "math.h"
-
 // Returns sqrt(x*x + y*y) with no overflow or underflow unless the result
 // warrants it
 _CLC_DEF _CLC_OVERLOAD float __clc_hypot(float x, float y) {

diff  --git a/libclc/generic/lib/math/clc_ldexp.cl b/libclc/generic/lib/math/clc_ldexp.cl
index 6d3721588df813..09c27062c63f93 100644
--- a/libclc/generic/lib/math/clc_ldexp.cl
+++ b/libclc/generic/lib/math/clc_ldexp.cl
@@ -20,8 +20,8 @@
  * THE SOFTWARE.
  */
 
-#include "config.h"
-#include "math.h"
+#include <clc/math/clc_subnormal_config.h>
+#include <clc/math/math.h>
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
 #include <clc/relational/clc_isinf.h>

diff  --git a/libclc/generic/lib/math/clc_pow.cl b/libclc/generic/lib/math/clc_pow.cl
index 4abfaf1c10df42..5dcd392c0f7edb 100644
--- a/libclc/generic/lib/math/clc_pow.cl
+++ b/libclc/generic/lib/math/clc_pow.cl
@@ -24,10 +24,9 @@
 #include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 #include <clc/math/clc_mad.h>
-
-#include "config.h"
-#include "math.h"
-#include "tables.h"
+#include <clc/math/clc_subnormal_config.h>
+#include <clc/math/math.h>
+#include <clc/math/tables.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 c0208926646027..a0f968c238e99e 100644
--- a/libclc/generic/lib/math/clc_pown.cl
+++ b/libclc/generic/lib/math/clc_pown.cl
@@ -24,10 +24,9 @@
 #include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 #include <clc/math/clc_mad.h>
-
-#include "config.h"
-#include "math.h"
-#include "tables.h"
+#include <clc/math/clc_subnormal_config.h>
+#include <clc/math/math.h>
+#include <clc/math/tables.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 9516be34456b8d..7e1a6f2a02e7a8 100644
--- a/libclc/generic/lib/math/clc_powr.cl
+++ b/libclc/generic/lib/math/clc_powr.cl
@@ -24,10 +24,9 @@
 #include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 #include <clc/math/clc_mad.h>
-
-#include "config.h"
-#include "math.h"
-#include "tables.h"
+#include <clc/math/clc_subnormal_config.h>
+#include <clc/math/math.h>
+#include <clc/math/tables.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 8a0ce8816fcb38..e9d2e382d9beb3 100644
--- a/libclc/generic/lib/math/clc_remainder.cl
+++ b/libclc/generic/lib/math/clc_remainder.cl
@@ -23,12 +23,11 @@
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
 #include <clc/math/clc_floor.h>
+#include <clc/math/clc_subnormal_config.h>
 #include <clc/math/clc_trunc.h>
+#include <clc/math/math.h>
 #include <clc/shared/clc_max.h>
-
 #include <math/clc_remainder.h>
-#include "config.h"
-#include "math.h"
 
 _CLC_DEF _CLC_OVERLOAD float __clc_remainder(float x, float y)
 {

diff  --git a/libclc/generic/lib/math/clc_remquo.cl b/libclc/generic/lib/math/clc_remquo.cl
index 8d2e5f9a74bfef..9cbda094294ad1 100644
--- a/libclc/generic/lib/math/clc_remquo.cl
+++ b/libclc/generic/lib/math/clc_remquo.cl
@@ -23,13 +23,12 @@
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
 #include <clc/math/clc_floor.h>
+#include <clc/math/clc_subnormal_config.h>
 #include <clc/math/clc_trunc.h>
+#include <clc/math/math.h>
 #include <clc/shared/clc_max.h>
 #include <math/clc_remainder.h>
 
-#include "config.h"
-#include "math.h"
-
 _CLC_DEF _CLC_OVERLOAD float __clc_remquo(float x, float y,
                                           __private int *quo) {
   x = __clc_flush_denormal_if_not_supported(x);

diff  --git a/libclc/generic/lib/math/clc_rootn.cl b/libclc/generic/lib/math/clc_rootn.cl
index 70ae02ac2370c9..42b983784c14d6 100644
--- a/libclc/generic/lib/math/clc_rootn.cl
+++ b/libclc/generic/lib/math/clc_rootn.cl
@@ -24,10 +24,9 @@
 #include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
 #include <clc/math/clc_mad.h>
-
-#include "config.h"
-#include "math.h"
-#include "tables.h"
+#include <clc/math/clc_subnormal_config.h>
+#include <clc/math/math.h>
+#include <clc/math/tables.h>
 
 // compute pow using log and exp
 // x^y = exp(y * log(x))

diff  --git a/libclc/generic/lib/math/clc_tan.cl b/libclc/generic/lib/math/clc_tan.cl
index 4daaee59b10d2d..c1af01fbb7ec7d 100644
--- a/libclc/generic/lib/math/clc_tan.cl
+++ b/libclc/generic/lib/math/clc_tan.cl
@@ -19,16 +19,15 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#include "sincos_helpers.h"
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
 #include <clc/math/clc_fabs.h>
+#include <clc/math/math.h>
+#include <clc/math/tables.h>
 #include <clc/relational/clc_isinf.h>
 #include <clc/relational/clc_isnan.h>
 
-#include "math.h"
-#include "sincos_helpers.h"
-#include "tables.h"
-
 _CLC_DEF _CLC_OVERLOAD float __clc_tan(float x) {
   int ix = as_int(x);
   int ax = ix & 0x7fffffff;

diff  --git a/libclc/generic/lib/math/clc_tanpi.cl b/libclc/generic/lib/math/clc_tanpi.cl
index 65d19845937060..90f36eae639967 100644
--- a/libclc/generic/lib/math/clc_tanpi.cl
+++ b/libclc/generic/lib/math/clc_tanpi.cl
@@ -19,12 +19,12 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include <clc/clc.h>
-#include <clc/clcmacro.h>
 
-#include "math.h"
 #include "sincos_helpers.h"
-#include "tables.h"
+#include <clc/clc.h>
+#include <clc/clcmacro.h>
+#include <clc/math/math.h>
+#include <clc/math/tables.h>
 
 _CLC_DEF _CLC_OVERLOAD float __clc_tanpi(float x)
 {

diff  --git a/libclc/generic/lib/math/cos.cl b/libclc/generic/lib/math/cos.cl
index 2945c90d6fe0f3..e13210cd408641 100644
--- a/libclc/generic/lib/math/cos.cl
+++ b/libclc/generic/lib/math/cos.cl
@@ -20,11 +20,10 @@
  * THE SOFTWARE.
  */
 
+#include "sincos_helpers.h"
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "sincos_helpers.h"
+#include <clc/math/math.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 02b03a761aa19a..5b5400178e28e2 100644
--- a/libclc/generic/lib/math/cosh.cl
+++ b/libclc/generic/lib/math/cosh.cl
@@ -22,9 +22,8 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "tables.h"
+#include <clc/math/math.h>
+#include <clc/math/tables.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 98e989267c9173..a3bfb8f20eee44 100644
--- a/libclc/generic/lib/math/cospi.cl
+++ b/libclc/generic/lib/math/cospi.cl
@@ -22,8 +22,8 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
+#include <clc/math/math.h>
 
-#include "math.h"
 #include "sincos_helpers.h"
 #include "sincospiF_piby4.h"
 #ifdef cl_khr_fp64

diff  --git a/libclc/generic/lib/math/ep_log.cl b/libclc/generic/lib/math/ep_log.cl
index 3c2c62c3d305b7..90c9fa426fec10 100644
--- a/libclc/generic/lib/math/ep_log.cl
+++ b/libclc/generic/lib/math/ep_log.cl
@@ -22,10 +22,10 @@
 
 #ifdef cl_khr_fp64
 
-#include <clc/clc.h>
 #include "ep_log.h"
-#include "math.h"
-#include "tables.h"
+#include <clc/clc.h>
+#include <clc/math/math.h>
+#include <clc/math/tables.h>
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 

diff  --git a/libclc/generic/lib/math/ep_log.h b/libclc/generic/lib/math/ep_log.h
index 7f99ac60b72fbc..414e6231f7fd63 100644
--- a/libclc/generic/lib/math/ep_log.h
+++ b/libclc/generic/lib/math/ep_log.h
@@ -20,6 +20,8 @@
  * THE SOFTWARE.
  */
 
+#include <clc/clcfunc.h>
+
 #ifdef cl_khr_fp64
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable

diff  --git a/libclc/generic/lib/math/erf.cl b/libclc/generic/lib/math/erf.cl
index ae8b6ab7845581..bc305fe414a325 100644
--- a/libclc/generic/lib/math/erf.cl
+++ b/libclc/generic/lib/math/erf.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.h>
 
 /*
  * ====================================================

diff  --git a/libclc/generic/lib/math/erfc.cl b/libclc/generic/lib/math/erfc.cl
index c4d34ea85e98b3..39d8d826280bc1 100644
--- a/libclc/generic/lib/math/erfc.cl
+++ b/libclc/generic/lib/math/erfc.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.h>
 
 /*
  * ====================================================

diff  --git a/libclc/generic/lib/math/exp.cl b/libclc/generic/lib/math/exp.cl
index 95dc0db44df76d..f71ed07c76b364 100644
--- a/libclc/generic/lib/math/exp.cl
+++ b/libclc/generic/lib/math/exp.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.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 8d718311f896f0..13c4789797da96 100644
--- a/libclc/generic/lib/math/exp2.cl
+++ b/libclc/generic/lib/math/exp2.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.h>
 
 _CLC_OVERLOAD _CLC_DEF float exp2(float x) {
 

diff  --git a/libclc/generic/lib/math/exp_helper.cl b/libclc/generic/lib/math/exp_helper.cl
index 046f306466bca1..ea58d498153931 100644
--- a/libclc/generic/lib/math/exp_helper.cl
+++ b/libclc/generic/lib/math/exp_helper.cl
@@ -21,9 +21,8 @@
  */
 
 #include <clc/clc.h>
-
-#include "math.h"
-#include "tables.h"
+#include <clc/math/math.h>
+#include <clc/math/tables.h>
 
 #ifdef cl_khr_fp64
 

diff  --git a/libclc/generic/lib/math/expm1.cl b/libclc/generic/lib/math/expm1.cl
index d50a88e0aaae8e..5e2141ae791f51 100644
--- a/libclc/generic/lib/math/expm1.cl
+++ b/libclc/generic/lib/math/expm1.cl
@@ -1,8 +1,7 @@
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "tables.h"
+#include <clc/math/math.h>
+#include <clc/math/tables.h>
 
 /* Refer to the exp routine for the underlying algorithm */
 

diff  --git a/libclc/generic/lib/math/fdim.cl b/libclc/generic/lib/math/fdim.cl
index 6899cb7549bc80..4980d6266a5188 100644
--- a/libclc/generic/lib/math/fdim.cl
+++ b/libclc/generic/lib/math/fdim.cl
@@ -1,6 +1,5 @@
 #include <clc/clc.h>
-
-#include "math.h"
+#include <clc/math/math.h>
 
 #define __CLC_BODY <fdim.inc>
 #include <clc/math/gentype.inc>

diff  --git a/libclc/generic/lib/math/fma.cl b/libclc/generic/lib/math/fma.cl
index 9ad81be696d957..00d5857fb897b1 100644
--- a/libclc/generic/lib/math/fma.cl
+++ b/libclc/generic/lib/math/fma.cl
@@ -1,6 +1,6 @@
 #include <clc/clc.h>
+#include <clc/math/math.h>
 
-#include "math.h"
 #include "math/clc_fma.h"
 
 #define __CLC_BODY <fma.inc>

diff  --git a/libclc/generic/lib/math/ilogb.cl b/libclc/generic/lib/math/ilogb.cl
index f16b4404fbebe8..c9a5014a975dbe 100644
--- a/libclc/generic/lib/math/ilogb.cl
+++ b/libclc/generic/lib/math/ilogb.cl
@@ -21,9 +21,9 @@
  * THE SOFTWARE.
  */
 
-#include "math.h"
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
+#include <clc/math/math.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 a999c63902ce82..72708f74b5cc1c 100644
--- a/libclc/generic/lib/math/ldexp.cl
+++ b/libclc/generic/lib/math/ldexp.cl
@@ -20,11 +20,11 @@
  * THE SOFTWARE.
  */
 
-#include "config.h"
-#include "math.h"
 #include "math/clc_ldexp.h"
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
+#include <clc/math/clc_subnormal_config.h>
+#include <clc/math/math.h>
 
 _CLC_DEFINE_BINARY_BUILTIN(float, ldexp, __clc_ldexp, float, int)
 

diff  --git a/libclc/generic/lib/math/lgamma_r.cl b/libclc/generic/lib/math/lgamma_r.cl
index bd68a76068ec5e..cef836ae9747e1 100644
--- a/libclc/generic/lib/math/lgamma_r.cl
+++ b/libclc/generic/lib/math/lgamma_r.cl
@@ -23,8 +23,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.h>
 
 /*
  * ====================================================

diff  --git a/libclc/generic/lib/math/log10.cl b/libclc/generic/lib/math/log10.cl
index 3abb14a28d8ad8..38e36d7992bcec 100644
--- a/libclc/generic/lib/math/log10.cl
+++ b/libclc/generic/lib/math/log10.cl
@@ -20,7 +20,7 @@
  * THE SOFTWARE.
  */
 
-#include "tables.h"
+#include <clc/math/tables.h>
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
 

diff  --git a/libclc/generic/lib/math/log1p.cl b/libclc/generic/lib/math/log1p.cl
index 7fef79ca7b8f39..da4a921e986593 100644
--- a/libclc/generic/lib/math/log1p.cl
+++ b/libclc/generic/lib/math/log1p.cl
@@ -22,9 +22,8 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "tables.h"
+#include <clc/math/math.h>
+#include <clc/math/tables.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 a6f9692881bb8f..c3bcf64a01ab04 100644
--- a/libclc/generic/lib/math/log2.cl
+++ b/libclc/generic/lib/math/log2.cl
@@ -20,7 +20,7 @@
  * THE SOFTWARE.
  */
 
-#include "tables.h"
+#include <clc/math/tables.h>
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
 

diff  --git a/libclc/generic/lib/math/log_base.h b/libclc/generic/lib/math/log_base.h
index b8110ca1779a23..bd0169c03236f8 100644
--- a/libclc/generic/lib/math/log_base.h
+++ b/libclc/generic/lib/math/log_base.h
@@ -20,7 +20,7 @@
  * THE SOFTWARE.
  */
 
-#include "math.h"
+#include <clc/math/math.h>
 
 /*
    Algorithm:

diff  --git a/libclc/generic/lib/math/logb.cl b/libclc/generic/lib/math/logb.cl
index d91972f780ba9d..ae3813225265f1 100644
--- a/libclc/generic/lib/math/logb.cl
+++ b/libclc/generic/lib/math/logb.cl
@@ -1,6 +1,6 @@
-#include "math.h"
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
+#include <clc/math/math.h>
 
 _CLC_OVERLOAD _CLC_DEF float logb(float x) {
     int ax = as_int(x) & EXSIGNBIT_SP32;

diff  --git a/libclc/generic/lib/math/modf.cl b/libclc/generic/lib/math/modf.cl
index a462cab2e802bd..5098a41d079c54 100644
--- a/libclc/generic/lib/math/modf.cl
+++ b/libclc/generic/lib/math/modf.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "math.h"
+#include <clc/math/math.h>
 
 #define __CLC_BODY <modf.inc>
 #include <clc/math/gentype.inc>

diff  --git a/libclc/generic/lib/math/sin.cl b/libclc/generic/lib/math/sin.cl
index c271e67828066f..9b3d7a9580b144 100644
--- a/libclc/generic/lib/math/sin.cl
+++ b/libclc/generic/lib/math/sin.cl
@@ -20,11 +20,10 @@
  * THE SOFTWARE.
  */
 
+#include "sincos_helpers.h"
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "sincos_helpers.h"
+#include <clc/math/math.h>
 
 _CLC_OVERLOAD _CLC_DEF float sin(float x)
 {

diff  --git a/libclc/generic/lib/math/sincos_helpers.cl b/libclc/generic/lib/math/sincos_helpers.cl
index e291e81ed980de..6afb1887d77979 100644
--- a/libclc/generic/lib/math/sincos_helpers.cl
+++ b/libclc/generic/lib/math/sincos_helpers.cl
@@ -20,15 +20,14 @@
  * THE SOFTWARE.
  */
 
+#include "sincos_helpers.h"
 #include <clc/clc.h>
 #include <clc/math/clc_mad.h>
 #include <clc/math/clc_trunc.h>
+#include <clc/math/math.h>
+#include <clc/math/tables.h>
 #include <clc/shared/clc_max.h>
 
-#include "math.h"
-#include "sincos_helpers.h"
-#include "tables.h"
-
 #define bitalign(hi, lo, shift) ((hi) << (32 - (shift))) | ((lo) >> (shift));
 
 #define bytealign(src0, src1, src2)                                            \

diff  --git a/libclc/generic/lib/math/sincos_helpers.h b/libclc/generic/lib/math/sincos_helpers.h
index e307abc48b2df1..6dbca73aa2a2e6 100644
--- a/libclc/generic/lib/math/sincos_helpers.h
+++ b/libclc/generic/lib/math/sincos_helpers.h
@@ -20,7 +20,8 @@
  * THE SOFTWARE.
  */
 
-#include "clc/clcfunc.h"
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
 
 _CLC_DECL float __clc_sinf_piby4(float x, float y);
 _CLC_DECL float __clc_cosf_piby4(float x, float y);
@@ -31,8 +32,10 @@ _CLC_DECL int __clc_argReductionS(float *r, float *rr, float x);
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 
-_CLC_DECL void __clc_remainder_piby2_medium(double x, double *r, double *rr, int *regn);
-_CLC_DECL void __clc_remainder_piby2_large(double x, double *r, double *rr, int *regn);
+_CLC_DECL void __clc_remainder_piby2_medium(double x, double *r, double *rr,
+                                            int *regn);
+_CLC_DECL void __clc_remainder_piby2_large(double x, double *r, double *rr,
+                                           int *regn);
 _CLC_DECL double2 __clc_sincos_piby4(double x, double xx);
 
 #endif

diff  --git a/libclc/generic/lib/math/sinh.cl b/libclc/generic/lib/math/sinh.cl
index 23500c1f49b7a0..41a8bffb3a69cb 100644
--- a/libclc/generic/lib/math/sinh.cl
+++ b/libclc/generic/lib/math/sinh.cl
@@ -22,9 +22,8 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
-#include "tables.h"
+#include <clc/math/math.h>
+#include <clc/math/tables.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 01b340b855c44c..81cad9cc17800b 100644
--- a/libclc/generic/lib/math/sinpi.cl
+++ b/libclc/generic/lib/math/sinpi.cl
@@ -22,8 +22,8 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
+#include <clc/math/math.h>
 
-#include "math.h"
 #include "sincospiF_piby4.h"
 #ifdef cl_khr_fp64
 #include "sincosD_piby4.h"

diff  --git a/libclc/generic/lib/math/tables.cl b/libclc/generic/lib/math/tables.cl
index 596487c89e568e..8eefbffb234f17 100644
--- a/libclc/generic/lib/math/tables.cl
+++ b/libclc/generic/lib/math/tables.cl
@@ -22,7 +22,7 @@
 
 #include <clc/clc.h>
 
-#include "tables.h"
+#include <clc/math/tables.h>
 
 DECLARE_TABLE(float2, LOGE_TBL, 129) = {
     (float2)(0x0.000000p+0f, 0x0.000000p+0f),

diff  --git a/libclc/generic/lib/math/tanh.cl b/libclc/generic/lib/math/tanh.cl
index d9509c57b05074..80eb33fab903ec 100644
--- a/libclc/generic/lib/math/tanh.cl
+++ b/libclc/generic/lib/math/tanh.cl
@@ -22,8 +22,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.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 314ffda4ec9d59..76614b575b6325 100644
--- a/libclc/generic/lib/math/tgamma.cl
+++ b/libclc/generic/lib/math/tgamma.cl
@@ -23,8 +23,7 @@
 
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "math.h"
+#include <clc/math/math.h>
 
 _CLC_OVERLOAD _CLC_DEF float tgamma(float x) {
     const float pi = 3.1415926535897932384626433832795f;

diff  --git a/libclc/generic/lib/subnormal_config.cl b/libclc/generic/lib/subnormal_config.cl
index 4bcecfd82e18a2..7bb25cedc1a43b 100644
--- a/libclc/generic/lib/subnormal_config.cl
+++ b/libclc/generic/lib/subnormal_config.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "config.h"
+#include <clc/math/clc_subnormal_config.h>
 
 _CLC_DEF bool __clc_fp16_subnormals_supported() {
   return false;

diff  --git a/libclc/r600/lib/math/fmax.cl b/libclc/r600/lib/math/fmax.cl
index a43530fc7507ee..7c258e666b66ec 100644
--- a/libclc/r600/lib/math/fmax.cl
+++ b/libclc/r600/lib/math/fmax.cl
@@ -1,7 +1,6 @@
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "../../../generic/lib/math/math.h"
+#include <clc/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 a43655da138451..052980dd111566 100644
--- a/libclc/r600/lib/math/fmin.cl
+++ b/libclc/r600/lib/math/fmin.cl
@@ -1,7 +1,6 @@
 #include <clc/clc.h>
 #include <clc/clcmacro.h>
-
-#include "../../../generic/lib/math/math.h"
+#include <clc/math/math.h>
 
 _CLC_DEF _CLC_OVERLOAD float fmin(float x, float y)
 {

diff  --git a/libclc/spirv/lib/subnormal_config.cl b/libclc/spirv/lib/subnormal_config.cl
index 167fe1b1a1bcfd..3ab5a6394b9333 100644
--- a/libclc/spirv/lib/subnormal_config.cl
+++ b/libclc/spirv/lib/subnormal_config.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "config.h"
+#include <clc/math/clc_subnormal_config.h>
 
 _CLC_DEF bool __clc_fp16_subnormals_supported() { return false; }
 

diff  --git a/libclc/spirv64/lib/subnormal_config.cl b/libclc/spirv64/lib/subnormal_config.cl
index 167fe1b1a1bcfd..3ab5a6394b9333 100644
--- a/libclc/spirv64/lib/subnormal_config.cl
+++ b/libclc/spirv64/lib/subnormal_config.cl
@@ -21,8 +21,7 @@
  */
 
 #include <clc/clc.h>
-
-#include "config.h"
+#include <clc/math/clc_subnormal_config.h>
 
 _CLC_DEF bool __clc_fp16_subnormals_supported() { return false; }
 


        


More information about the cfe-commits mailing list