mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-26 00:39:03 +00:00
Fold functions for nextafter (#1176)
* Add assertion to prove isNextafter is true iff the builtin is nextafter() Signed-off-by: Marco Antognini <marco.antognini@arm.com> * Fold functions for nextafter There is no need to differentiate nextafter() from other binary builtin functions when creating the vtbl entries. Signed-off-by: Marco Antognini <marco.antognini@arm.com>
This commit is contained in:
@@ -285,9 +285,7 @@ static size_t specialValuesDoubleCount =
|
|||||||
|
|
||||||
static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *p);
|
static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *p);
|
||||||
|
|
||||||
static int TestFunc_Double_Double_Double_common(const Func *f, MTdata d,
|
int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||||
int isNextafter,
|
|
||||||
bool relaxedMode)
|
|
||||||
{
|
{
|
||||||
TestInfo test_info;
|
TestInfo test_info;
|
||||||
cl_int error;
|
cl_int error;
|
||||||
@@ -329,7 +327,8 @@ static int TestFunc_Double_Double_Double_common(const Func *f, MTdata d,
|
|||||||
|
|
||||||
test_info.isFDim = 0 == strcmp("fdim", f->nameInCode);
|
test_info.isFDim = 0 == strcmp("fdim", f->nameInCode);
|
||||||
test_info.skipNanInf = 0;
|
test_info.skipNanInf = 0;
|
||||||
test_info.isNextafter = isNextafter;
|
test_info.isNextafter = 0 == strcmp("nextafter", f->nameInCode);
|
||||||
|
|
||||||
// cl_kernels aren't thread safe, so we make one for each vector size for
|
// cl_kernels aren't thread safe, so we make one for each vector size for
|
||||||
// every thread
|
// every thread
|
||||||
for (i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++)
|
for (i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++)
|
||||||
@@ -934,14 +933,3 @@ static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data)
|
|||||||
exit:
|
exit:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode)
|
|
||||||
{
|
|
||||||
return TestFunc_Double_Double_Double_common(f, d, 0, relaxedMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int TestFunc_Double_Double_Double_nextafter(const Func *f, MTdata d,
|
|
||||||
bool relaxedMode)
|
|
||||||
{
|
|
||||||
return TestFunc_Double_Double_Double_common(f, d, 1, relaxedMode);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -273,8 +273,7 @@ typedef struct TestInfo
|
|||||||
|
|
||||||
static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *p);
|
static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *p);
|
||||||
|
|
||||||
static int TestFunc_Float_Float_Float_common(const Func *f, MTdata d,
|
int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||||
int isNextafter, bool relaxedMode)
|
|
||||||
{
|
{
|
||||||
TestInfo test_info;
|
TestInfo test_info;
|
||||||
cl_int error;
|
cl_int error;
|
||||||
@@ -318,7 +317,7 @@ static int TestFunc_Float_Float_Float_common(const Func *f, MTdata d,
|
|||||||
test_info.relaxedMode = relaxedMode;
|
test_info.relaxedMode = relaxedMode;
|
||||||
test_info.isFDim = 0 == strcmp("fdim", f->nameInCode);
|
test_info.isFDim = 0 == strcmp("fdim", f->nameInCode);
|
||||||
test_info.skipNanInf = test_info.isFDim && !gInfNanSupport;
|
test_info.skipNanInf = test_info.isFDim && !gInfNanSupport;
|
||||||
test_info.isNextafter = isNextafter;
|
test_info.isNextafter = 0 == strcmp("nextafter", f->nameInCode);
|
||||||
|
|
||||||
// cl_kernels aren't thread safe, so we make one for each vector size for
|
// cl_kernels aren't thread safe, so we make one for each vector size for
|
||||||
// every thread
|
// every thread
|
||||||
@@ -1094,14 +1093,3 @@ exit:
|
|||||||
if (overflow) free(overflow);
|
if (overflow) free(overflow);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
|
||||||
{
|
|
||||||
return TestFunc_Float_Float_Float_common(f, d, 0, relaxedMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int TestFunc_Float_Float_Float_nextafter(const Func *f, MTdata d,
|
|
||||||
bool relaxedMode)
|
|
||||||
{
|
|
||||||
return TestFunc_Float_Float_Float_common(f, d, 1, relaxedMode);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -58,7 +58,6 @@
|
|||||||
#define unaryF_u NULL
|
#define unaryF_u NULL
|
||||||
#define macro_unaryF NULL
|
#define macro_unaryF NULL
|
||||||
#define binaryF NULL
|
#define binaryF NULL
|
||||||
#define binaryF_nextafter NULL
|
|
||||||
#define binaryOperatorF NULL
|
#define binaryOperatorF NULL
|
||||||
#define binaryF_i NULL
|
#define binaryF_i NULL
|
||||||
#define macro_binaryF NULL
|
#define macro_binaryF NULL
|
||||||
@@ -134,12 +133,6 @@ static constexpr vtbl _binary = {
|
|||||||
TestFunc_Double_Double_Double,
|
TestFunc_Double_Double_Double,
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr vtbl _binary_nextafter = {
|
|
||||||
"binary_nextafter",
|
|
||||||
TestFunc_Float_Float_Float_nextafter,
|
|
||||||
TestFunc_Double_Double_Double_nextafter,
|
|
||||||
};
|
|
||||||
|
|
||||||
static constexpr vtbl _binary_operator = {
|
static constexpr vtbl _binary_operator = {
|
||||||
"binaryOperator",
|
"binaryOperator",
|
||||||
TestFunc_Float_Float_Float_Operator,
|
TestFunc_Float_Float_Float_Operator,
|
||||||
@@ -193,7 +186,6 @@ static constexpr vtbl _mad_tbl = {
|
|||||||
#define unaryF_u &_unary_u
|
#define unaryF_u &_unary_u
|
||||||
#define macro_unaryF &_macro_unary
|
#define macro_unaryF &_macro_unary
|
||||||
#define binaryF &_binary
|
#define binaryF &_binary
|
||||||
#define binaryF_nextafter &_binary_nextafter
|
|
||||||
#define binaryOperatorF &_binary_operator
|
#define binaryOperatorF &_binary_operator
|
||||||
#define binaryF_i &_binary_i
|
#define binaryF_i &_binary_i
|
||||||
#define macro_binaryF &_macro_binary
|
#define macro_binaryF &_macro_binary
|
||||||
@@ -285,7 +277,7 @@ const Func functionList[] = {
|
|||||||
ENTRY(minmag, 0.0f, 0.0f, FTZ_OFF, binaryF),
|
ENTRY(minmag, 0.0f, 0.0f, FTZ_OFF, binaryF),
|
||||||
ENTRY(modf, 0.0f, 0.0f, FTZ_OFF, unaryF_two_results),
|
ENTRY(modf, 0.0f, 0.0f, FTZ_OFF, unaryF_two_results),
|
||||||
ENTRY(nan, 0.0f, 0.0f, FTZ_OFF, unaryF_u),
|
ENTRY(nan, 0.0f, 0.0f, FTZ_OFF, unaryF_u),
|
||||||
ENTRY(nextafter, 0.0f, 0.0f, FTZ_OFF, binaryF_nextafter),
|
ENTRY(nextafter, 0.0f, 0.0f, FTZ_OFF, binaryF),
|
||||||
ENTRY_EXT(pow, 16.0f, 16.0f, 8192.0f, FTZ_OFF, binaryF,
|
ENTRY_EXT(pow, 16.0f, 16.0f, 8192.0f, FTZ_OFF, binaryF,
|
||||||
8192.0f), // in derived mode the ulp error is calculated as
|
8192.0f), // in derived mode the ulp error is calculated as
|
||||||
// exp2(y*log2(x)) and in non-derived it is the same as
|
// exp2(y*log2(x)) and in non-derived it is the same as
|
||||||
|
|||||||
Reference in New Issue
Block a user