mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-22 07:09:03 +00:00
* Allow CL_HALF_FLOAT denorm flushing for write tests (#452) * On mismatch, add relaxation when denormal half result is expected * Refactor to use common validation function * Clean up some diagnostics * Fix review comments - use cl_half - remove extraneous casts - replace literals with sizeof() * Document rollover trick for IsHalfSubnormal
This commit is contained in:
@@ -117,6 +117,11 @@ static inline int IsDoubleSubnormal( double x )
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int IsHalfSubnormal( cl_half x )
|
||||
{
|
||||
return ( ( x & 0x7fffU ) - 1U ) < 0x03ffU;
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -640,7 +640,14 @@ protected:
|
||||
|
||||
extern int DetectFloatToHalfRoundingMode( cl_command_queue ); // Returns CL_SUCCESS on success
|
||||
|
||||
int inline is_half_nan( cl_ushort half ){ return (half & 0x7fff) > 0x7c00; }
|
||||
// sign bit: don't care, exponent: maximum value, significand: non-zero
|
||||
static int inline is_half_nan( cl_ushort half ){ return ( half & 0x7fff ) > 0x7c00; }
|
||||
|
||||
// sign bit: don't care, exponent: zero, significand: non-zero
|
||||
static int inline is_half_denorm( cl_ushort half ){ return IsHalfSubnormal( half ); }
|
||||
|
||||
// sign bit: don't care, exponent: zero, significand: zero
|
||||
static int inline is_half_zero( cl_ushort half ){ return ( half & 0x7fff ) == 0; }
|
||||
|
||||
cl_ushort convert_float_to_half( cl_float f );
|
||||
cl_float convert_half_to_float( cl_ushort h );
|
||||
|
||||
Reference in New Issue
Block a user