Reformat test harness code (#940)

* Reformat common help text

Signed-off-by: Stuart Brady <stuart.brady@arm.com>

* Reformat test harness code

This goes part of the way to fixing issue #625.

Signed-off-by: Stuart Brady <stuart.brady@arm.com>
This commit is contained in:
Stuart Brady
2020-10-30 14:13:52 +00:00
committed by GitHub
parent 55976fad35
commit af7d914514
38 changed files with 7676 additions and 6692 deletions

View File

@@ -1,6 +1,6 @@
//
// Copyright (c) 2017 The Khronos Group Inc.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -29,7 +29,7 @@
enum ExplicitTypes
{
kBool = 0,
kBool = 0,
kChar,
kUChar,
kUnsignedChar,
@@ -48,7 +48,7 @@ enum ExplicitTypes
kNumExplicitTypes
};
typedef enum ExplicitTypes ExplicitType;
typedef enum ExplicitTypes ExplicitType;
enum RoundingTypes
{
@@ -63,62 +63,72 @@ enum RoundingTypes
kDefaultRoundingType = kRoundToNearest
};
typedef enum RoundingTypes RoundingType;
typedef enum RoundingTypes RoundingType;
extern void print_type_to_string(ExplicitType type, void *data, char* string);
extern size_t get_explicit_type_size( ExplicitType type );
extern const char * get_explicit_type_name( ExplicitType type );
extern void convert_explicit_value( void *inRaw, void *outRaw, ExplicitType inType, bool saturate, RoundingType roundType, ExplicitType outType );
extern void print_type_to_string(ExplicitType type, void *data, char *string);
extern size_t get_explicit_type_size(ExplicitType type);
extern const char *get_explicit_type_name(ExplicitType type);
extern void convert_explicit_value(void *inRaw, void *outRaw,
ExplicitType inType, bool saturate,
RoundingType roundType,
ExplicitType outType);
extern void generate_random_data( ExplicitType type, size_t count, MTdata d, void *outData );
extern void * create_random_data( ExplicitType type, MTdata d, size_t count );
extern void generate_random_data(ExplicitType type, size_t count, MTdata d,
void *outData);
extern void *create_random_data(ExplicitType type, MTdata d, size_t count);
extern cl_long read_upscale_signed( void *inRaw, ExplicitType inType );
extern cl_ulong read_upscale_unsigned( void *inRaw, ExplicitType inType );
extern float read_as_float( void *inRaw, ExplicitType inType );
extern cl_long read_upscale_signed(void *inRaw, ExplicitType inType);
extern cl_ulong read_upscale_unsigned(void *inRaw, ExplicitType inType);
extern float read_as_float(void *inRaw, ExplicitType inType);
extern float get_random_float(float low, float high, MTdata d);
extern double get_random_double(double low, double high, MTdata d);
extern float any_float( MTdata d );
extern double any_double( MTdata d );
extern float get_random_float(float low, float high, MTdata d);
extern double get_random_double(double low, double high, MTdata d);
extern float any_float(MTdata d);
extern double any_double(MTdata d);
extern int random_in_range( int minV, int maxV, MTdata d );
extern int random_in_range(int minV, int maxV, MTdata d);
size_t get_random_size_t(size_t low, size_t high, MTdata d);
// Note: though this takes a double, this is for use with single precision tests
static inline int IsFloatSubnormal( float x )
static inline int IsFloatSubnormal(float x)
{
#if 2 == FLT_RADIX
// Do this in integer to avoid problems with FTZ behavior
union{ float d; uint32_t u;}u;
union {
float d;
uint32_t u;
} u;
u.d = fabsf(x);
return (u.u-1) < 0x007fffffU;
return (u.u - 1) < 0x007fffffU;
#else
// rely on floating point hardware for non-radix2 non-IEEE-754 hardware -- will fail if you flush subnormals to zero
return fabs(x) < (double) FLT_MIN && x != 0.0;
// rely on floating point hardware for non-radix2 non-IEEE-754 hardware --
// will fail if you flush subnormals to zero
return fabs(x) < (double)FLT_MIN && x != 0.0;
#endif
}
static inline int IsDoubleSubnormal( double x )
static inline int IsDoubleSubnormal(double x)
{
#if 2 == FLT_RADIX
// Do this in integer to avoid problems with FTZ behavior
union{ double d; uint64_t u;}u;
u.d = fabs( x);
return (u.u-1) < 0x000fffffffffffffULL;
union {
double d;
uint64_t u;
} u;
u.d = fabs(x);
return (u.u - 1) < 0x000fffffffffffffULL;
#else
// rely on floating point hardware for non-radix2 non-IEEE-754 hardware -- will fail if you flush subnormals to zero
return fabs(x) < (double) DBL_MIN && x != 0.0;
// rely on floating point hardware for non-radix2 non-IEEE-754 hardware --
// will fail if you flush subnormals to zero
return fabs(x) < (double)DBL_MIN && x != 0.0;
#endif
}
static inline int IsHalfSubnormal( cl_half x )
static inline int IsHalfSubnormal(cl_half x)
{
// this relies on interger overflow to exclude 0 as a subnormal
return ( ( x & 0x7fffU ) - 1U ) < 0x03ffU;
return ((x & 0x7fffU) - 1U) < 0x03ffU;
}
#endif // _conversions_h