diff --git a/test_common/harness/alloc.h b/test_common/harness/alloc.h index 653dde05..3b00d7c9 100644 --- a/test_common/harness/alloc.h +++ b/test_common/harness/alloc.h @@ -29,7 +29,7 @@ #include "mingw_compat.h" #endif -static void* align_malloc(size_t size, size_t alignment) +inline void* align_malloc(size_t size, size_t alignment) { #if defined(_WIN32) && defined(_MSC_VER) return _aligned_malloc(size, alignment); @@ -53,7 +53,7 @@ static void* align_malloc(size_t size, size_t alignment) #endif } -static void align_free(void* ptr) +inline void align_free(void* ptr) { #if defined(_WIN32) && defined(_MSC_VER) _aligned_free(ptr); diff --git a/test_common/harness/fpcontrol.h b/test_common/harness/fpcontrol.h index 40826c5c..9f065044 100644 --- a/test_common/harness/fpcontrol.h +++ b/test_common/harness/fpcontrol.h @@ -39,7 +39,7 @@ typedef int FPU_mode_type; extern __thread fpu_control_t fpu_control; #endif // Set the reference hardware floating point unit to FTZ mode -static inline void ForceFTZ(FPU_mode_type *mode) +inline void ForceFTZ(FPU_mode_type *mode) { #if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \ || defined(__MINGW32__) @@ -65,7 +65,7 @@ static inline void ForceFTZ(FPU_mode_type *mode) } // Disable the denorm flush to zero -static inline void DisableFTZ(FPU_mode_type *mode) +inline void DisableFTZ(FPU_mode_type *mode) { #if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \ || defined(__MINGW32__) @@ -91,7 +91,7 @@ static inline void DisableFTZ(FPU_mode_type *mode) } // Restore the reference hardware to floating point state indicated by *mode -static inline void RestoreFPState(FPU_mode_type *mode) +inline void RestoreFPState(FPU_mode_type *mode) { #if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \ || defined(__MINGW32__) diff --git a/test_conformance/math_brute_force/function_list.h b/test_conformance/math_brute_force/function_list.h index 38f739ce..95a29459 100644 --- a/test_conformance/math_brute_force/function_list.h +++ b/test_conformance/math_brute_force/function_list.h @@ -30,7 +30,7 @@ #include "harness/mt19937.h" -typedef union fptr { +union fptr { void *p; double (*f_f)(double); double (*f_u)(cl_uint); @@ -45,9 +45,9 @@ typedef union fptr { double (*f_ffpI)(double, double, int *); double (*f_fff)(double, double, double); float (*f_fma)(float, float, float, int); -} fptr; +}; -typedef union dptr { +union dptr { void *p; long double (*f_f)(long double); long double (*f_u)(cl_ulong); @@ -59,20 +59,20 @@ typedef union dptr { long double (*f_fpI)(long double, int *); long double (*f_ffpI)(long double, long double, int *); long double (*f_fff)(long double, long double, long double); -} dptr; +}; struct Func; -typedef struct vtbl +struct vtbl { const char *type_name; int (*TestFunc)(const struct Func *, MTdata, bool); int (*DoubleTestFunc)( const struct Func *, MTdata, bool); // may be NULL if function is single precision only -} vtbl; +}; -typedef struct Func +struct Func { const char *name; // common name, to be used as an argument in the shell const char *nameInCode; // name as it appears in the __kernel, usually the @@ -88,7 +88,7 @@ typedef struct Func int ftz; int relaxed; const vtbl *vtbl_ptr; -} Func; +}; extern const Func functionList[]; diff --git a/test_conformance/math_brute_force/main.cpp b/test_conformance/math_brute_force/main.cpp index d6c2f11f..e52f2f0a 100644 --- a/test_conformance/math_brute_force/main.cpp +++ b/test_conformance/math_brute_force/main.cpp @@ -167,7 +167,6 @@ static int doTest(const char *name) } { - extern int my_ilogb(double); if (0 == strcmp("ilogb", func_data->name)) { InitILogbConstants(); diff --git a/test_conformance/math_brute_force/reference_math.cpp b/test_conformance/math_brute_force/reference_math.cpp index 3a6516ba..0b037e01 100644 --- a/test_conformance/math_brute_force/reference_math.cpp +++ b/test_conformance/math_brute_force/reference_math.cpp @@ -41,10 +41,10 @@ #pragma STDC FP_CONTRACT OFF static void __log2_ep(double *hi, double *lo, double x); -typedef union { +union uint64d_t { uint64_t i; double d; -} uint64d_t; +}; static const uint64d_t _CL_NAN = { 0x7ff8000000000000ULL }; @@ -2259,10 +2259,10 @@ long double reference_dividel(long double x, long double y) return dx / dy; } -typedef struct +struct double_double { double hi, lo; -} double_double; +}; // Split doubles_double into a series of consecutive 26-bit precise doubles and // a remainder. Note for later -- for multiplication, it might be better to @@ -3767,10 +3767,10 @@ static uint32_t two_over_pi[] = { static uint32_t pi_over_two[] = { 0x1, 0x2487ed51, 0x42d1846, 0x26263314, 0x1701b839, 0x28948127 }; -typedef union { +union d_ui64_t { uint64_t u; double d; -} d_ui64_t; +}; // radix or base of representation #define RADIX (30) @@ -3786,13 +3786,13 @@ d_ui64_t two_pow_two_mradix = { (uint64_t)(1023 - 2 * RADIX) << 52 }; // extended fixed point representation of double precision // floating point number. // x = sign * [ sum_{i = 0 to 2} ( X[i] * 2^(index - i)*RADIX ) ] -typedef struct +struct eprep_t { uint32_t X[3]; // three 32 bit integers are sufficient to represnt double in // base_30 int index; // exponent bias int sign; // sign of double -} eprep_t; +}; static eprep_t double_to_eprep(double x) { diff --git a/test_conformance/math_brute_force/utility.h b/test_conformance/math_brute_force/utility.h index ac4db9c8..b4a59edb 100644 --- a/test_conformance/math_brute_force/utility.h +++ b/test_conformance/math_brute_force/utility.h @@ -90,8 +90,7 @@ int MakeKernels(const char **c, cl_uint count, const char *name, bool relaxedMode); // used to convert a bucket of bits into a search pattern through double -static inline double DoubleFromUInt32(uint32_t bits); -static inline double DoubleFromUInt32(uint32_t bits) +inline double DoubleFromUInt32(uint32_t bits) { union { uint64_t u; @@ -117,25 +116,25 @@ void _LogBuildError(cl_program p, int line, const char *file); // premature flushing to zero. // However, to avoid conflict for 1.0, we are letting results at TYPE_MIN + // ulp_limit to be flushed to zero. -static inline int IsFloatResultSubnormal(double x, float ulps) +inline int IsFloatResultSubnormal(double x, float ulps) { x = fabs(x) - MAKE_HEX_DOUBLE(0x1.0p-149, 0x1, -149) * (double)ulps; return x < MAKE_HEX_DOUBLE(0x1.0p-126, 0x1, -126); } -static inline int IsFloatResultSubnormalAbsError(double x, float abs_err) +inline int IsFloatResultSubnormalAbsError(double x, float abs_err) { x = x - abs_err; return x < MAKE_HEX_DOUBLE(0x1.0p-126, 0x1, -126); } -static inline int IsDoubleResultSubnormal(long double x, float ulps) +inline int IsDoubleResultSubnormal(long double x, float ulps) { x = fabsl(x) - MAKE_HEX_LONG(0x1.0p-1074, 0x1, -1074) * (long double)ulps; return x < MAKE_HEX_LONG(0x1.0p-1022, 0x1, -1022); } -static inline int IsFloatInfinity(double x) +inline int IsFloatInfinity(double x) { union { cl_float d; @@ -145,7 +144,7 @@ static inline int IsFloatInfinity(double x) return ((u.u & 0x7fffffffU) == 0x7F800000U); } -static inline int IsFloatMaxFloat(double x) +inline int IsFloatMaxFloat(double x) { union { cl_float d; @@ -155,7 +154,7 @@ static inline int IsFloatMaxFloat(double x) return ((u.u & 0x7fffffffU) == 0x7F7FFFFFU); } -static inline int IsFloatNaN(double x) +inline int IsFloatNaN(double x) { union { cl_float d; @@ -165,13 +164,13 @@ static inline int IsFloatNaN(double x) return ((u.u & 0x7fffffffU) > 0x7F800000U); } -extern cl_uint RoundUpToNextPowerOfTwo(cl_uint x); +cl_uint RoundUpToNextPowerOfTwo(cl_uint x); // Windows (since long double got deprecated) sets the x87 to 53-bit precision // (that's x87 default state). This causes problems with the tests that // convert long and ulong to float and double or otherwise deal with values // that need more precision than 53-bit. So, set the x87 to 64-bit precision. -static inline void Force64BitFPUPrecision(void) +inline void Force64BitFPUPrecision(void) { #if __MINGW32__ // The usual method is to use _controlfp as follows: @@ -202,17 +201,17 @@ static inline void Force64BitFPUPrecision(void) #endif } -extern void memset_pattern4(void *dest, const void *src_pattern, size_t bytes); +void memset_pattern4(void *dest, const void *src_pattern, size_t bytes); -typedef union { +union int32f_t { int32_t i; float f; -} int32f_t; +}; -typedef union { +union int64d_t { int64_t l; double d; -} int64d_t; +}; void MulD(double *rhi, double *rlo, double u, double v); void AddD(double *rhi, double *rlo, double a, double b); @@ -229,7 +228,7 @@ void logFunctionInfo(const char *fname, unsigned int float_size, float getAllowedUlpError(const Func *f, const bool relaxed); -static inline cl_uint getTestScale(size_t typeSize) +inline cl_uint getTestScale(size_t typeSize) { if (gWimpyMode) { @@ -245,7 +244,7 @@ static inline cl_uint getTestScale(size_t typeSize) } } -static inline uint64_t getTestStep(size_t typeSize, size_t bufferSize) +inline uint64_t getTestStep(size_t typeSize, size_t bufferSize) { if (gWimpyMode) {