[libclc] Move clcmacro.h to CLC library. NFC (#114845)
This commit is contained in:
parent
8d023b7d66
commit
d2d1b5897e
@ -1,5 +1,5 @@
|
||||
#include <clc/clc.h>
|
||||
#include <utils.h>
|
||||
#include <clc/utils.h>
|
||||
#include <integer/popcount.h>
|
||||
|
||||
#define __CLC_BODY "popcount.inc"
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include <clc/clc.h>
|
||||
#include <utils.h>
|
||||
#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) { \
|
||||
@ -22,7 +25,8 @@
|
||||
return (RET_TYPE##16)(FUNCTION(x.lo), FUNCTION(x.hi)); \
|
||||
}
|
||||
|
||||
#define _CLC_BINARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
|
||||
#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)); \
|
||||
} \
|
||||
@ -44,7 +48,8 @@
|
||||
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) \
|
||||
#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)); \
|
||||
} \
|
||||
@ -64,29 +69,37 @@
|
||||
\
|
||||
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) { \
|
||||
#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) { \
|
||||
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##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##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)); \
|
||||
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,20 +174,23 @@
|
||||
ARG2_TYPE, 8) *)((ADDR_SPACE ARG2_TYPE *)y + 8))); \
|
||||
}
|
||||
|
||||
#define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, 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)
|
||||
_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_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__
|
@ -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;
|
||||
|
@ -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>
|
||||
|
@ -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
|
@ -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) { \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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) { \
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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).
|
||||
|
@ -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);
|
||||
|
@ -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).
|
||||
|
@ -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).
|
||||
|
@ -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);
|
||||
|
@ -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).
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../clcmacro.h"
|
||||
#include <clc/clc.h>
|
||||
#include <clc/clcmacro.h>
|
||||
#include <clc/math/clc_ceil.h>
|
||||
|
||||
#undef __CLC_FUNCTION
|
||||
|
@ -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:
|
||||
//
|
||||
|
@ -21,8 +21,8 @@
|
||||
*/
|
||||
|
||||
#include <clc/clc.h>
|
||||
#include <clc/clcmacro.h>
|
||||
|
||||
#include "../clcmacro.h"
|
||||
#include "config.h"
|
||||
#include "math.h"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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))
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <utils.h>
|
||||
#include <clc/utils.h>
|
||||
|
||||
#define __CLC_SW_FUNC(x) __CLC_CONCAT(__clc_, x)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <utils.h>
|
||||
#include <clc/utils.h>
|
||||
|
||||
#define __CLC_SW_FUNC(x) __CLC_CONCAT(__clc_, x)
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -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
|
||||
|
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
#include <clc/clc.h>
|
||||
#include <clc/clcmacro.h>
|
||||
|
||||
#include "math.h"
|
||||
#include "../clcmacro.h"
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
|
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
#include <clc/clc.h>
|
||||
#include <clc/clcmacro.h>
|
||||
|
||||
#include "math.h"
|
||||
#include "../clcmacro.h"
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../clcmacro.h"
|
||||
#include <clc/clc.h>
|
||||
#include <clc/clcmacro.h>
|
||||
#include <clc/math/clc_fabs.h>
|
||||
|
||||
#undef __CLC_FUNCTION
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../clcmacro.h"
|
||||
#include <clc/clc.h>
|
||||
#include <clc/clcmacro.h>
|
||||
#include <clc/math/clc_floor.h>
|
||||
|
||||
#undef __CLC_FUNCTION
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <utils.h>
|
||||
#include <clc/utils.h>
|
||||
|
||||
#define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <utils.h>
|
||||
#include <clc/utils.h>
|
||||
|
||||
#define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x)
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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;
|
||||
|
@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
#include <clc/clc.h>
|
||||
#include <clc/clcmacro.h>
|
||||
|
||||
#include "../clcmacro.h"
|
||||
#include "math.h"
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <clc/clc.h>
|
||||
#include "../clcmacro.h"
|
||||
#include <clc/clcmacro.h>
|
||||
|
||||
/*
|
||||
*log(x) = log2(x) * (1/log2(e))
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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)
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <clc/clc.h>
|
||||
|
||||
#include "../clcmacro.h"
|
||||
#include <clc/clcmacro.h>
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF float rsqrt(float x)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -20,6 +20,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <clc/clctypes.h>
|
||||
|
||||
#define TABLE_SPACE __constant
|
||||
|
||||
#define TABLE_MANGLE(NAME) __clc_##NAME
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user