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

This commit is contained in:
Fraser Cormack 2024-11-04 22:00:01 +00:00 committed by GitHub
parent 8d023b7d66
commit d2d1b5897e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
95 changed files with 218 additions and 218 deletions

View File

@ -1,5 +1,5 @@
#include <clc/clc.h>
#include <utils.h>
#include <clc/utils.h>
#include <integer/popcount.h>
#define __CLC_BODY "popcount.inc"

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -1,92 +1,105 @@
#include <clc/clc.h>
#include <utils.h>
#ifndef __CLC_CLCMACRO_H__
#define __CLC_CLCMACRO_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)); \
#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_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_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__

View File

@ -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;

View File

@ -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>

View File

@ -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

View File

@ -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) { \

View File

@ -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

View File

@ -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

View File

@ -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) { \

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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).

View File

@ -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);

View File

@ -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).

View File

@ -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).

View File

@ -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);

View File

@ -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).

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -1,5 +1,5 @@
#include "../clcmacro.h"
#include <clc/clc.h>
#include <clc/clcmacro.h>
#include <clc/math/clc_ceil.h>
#undef __CLC_FUNCTION

View File

@ -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:
//

View File

@ -21,8 +21,8 @@
*/
#include <clc/clc.h>
#include <clc/clcmacro.h>
#include "../clcmacro.h"
#include "config.h"
#include "math.h"

View File

@ -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"

View File

@ -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

View File

@ -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) {

View File

@ -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.

View File

@ -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

View File

@ -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))

View File

@ -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))

View File

@ -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"

View File

@ -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"

View File

@ -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))

View File

@ -1,4 +1,4 @@
#include <utils.h>
#include <clc/utils.h>
#define __CLC_SW_FUNC(x) __CLC_CONCAT(__clc_, x)

View File

@ -1,4 +1,4 @@
#include <utils.h>
#include <clc/utils.h>
#define __CLC_SW_FUNC(x) __CLC_CONCAT(__clc_, x)

View File

@ -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) {

View File

@ -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)

View File

@ -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)

View File

@ -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)
{

View File

@ -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) {

View File

@ -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

View File

@ -21,9 +21,9 @@
*/
#include <clc/clc.h>
#include <clc/clcmacro.h>
#include "math.h"
#include "../clcmacro.h"
/*
* ====================================================

View File

@ -21,9 +21,9 @@
*/
#include <clc/clc.h>
#include <clc/clcmacro.h>
#include "math.h"
#include "../clcmacro.h"
/*
* ====================================================

View File

@ -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) {

View File

@ -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) {

View File

@ -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 */

View File

@ -1,5 +1,5 @@
#include "../clcmacro.h"
#include <clc/clc.h>
#include <clc/clcmacro.h>
#include <clc/math/clc_fabs.h>
#undef __CLC_FUNCTION

View File

@ -1,5 +1,5 @@
#include "../clcmacro.h"
#include <clc/clc.h>
#include <clc/clcmacro.h>
#include <clc/math/clc_floor.h>
#undef __CLC_FUNCTION

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -1,4 +1,4 @@
#include <utils.h>
#include <clc/utils.h>
#define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x)

View File

@ -1,4 +1,4 @@
#include <utils.h>
#include <clc/utils.h>
#define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x)

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -22,8 +22,8 @@
*/
#include <clc/clc.h>
#include <clc/clcmacro.h>
#include "../clcmacro.h"
#include "math.h"
/*

View File

@ -1,5 +1,5 @@
#include <clc/clc.h>
#include "../clcmacro.h"
#include <clc/clcmacro.h>
/*
*log(x) = log2(x) * (1/log2(e))

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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)

View File

@ -1,6 +1,5 @@
#include <clc/clc.h>
#include "../clcmacro.h"
#include <clc/clcmacro.h>
_CLC_OVERLOAD _CLC_DEF float rsqrt(float x)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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

View File

@ -20,6 +20,8 @@
* THE SOFTWARE.
*/
#include <clc/clctypes.h>
#define TABLE_SPACE __constant
#define TABLE_MANGLE(NAME) __clc_##NAME

View File

@ -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)
{

View File

@ -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;

View File

@ -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)

View File

@ -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>

View File

@ -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>

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
{