Fix 'fpclassify: ambiguous call' compile fail in MSVC 2022 (#2426)

Similar to #2219, we see "'fpclassify': ambiguous call" error in
test_conformance\basic\test_fpmath.cpp
due to missing constexpr at
https://github.com/KhronosGroup/OpenCL-CTS/blob/9265cbb2c274/test_conformance/basic/test_fpmath.cpp#L104
This PR fixes the issue by moving utility function isnan_fp in
testHarness.h and use it.
Note this PR doesn't modify use of isnan in many tests where only
float/double values are checked.
This commit is contained in:
Wenju He
2025-08-06 00:08:04 +08:00
committed by GitHub
parent 9ca0126c54
commit e15c6eb760
12 changed files with 94 additions and 107 deletions

View File

@@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "harness/mathHelpers.h"
#include "harness/testHarness.h"
#include "harness/compat.h"
#include "harness/ThreadPool.h"
@@ -955,24 +956,6 @@ void MapResultValuesComplete(const std::unique_ptr<CalcRefValsBase> &info)
// destroyed automatically soon after we exit.
}
template <typename T> static bool isnan_fp(const T &v)
{
if (std::is_same<T, cl_half>::value)
{
uint16_t h_exp = (((cl_half)v) >> (CL_HALF_MANT_DIG - 1)) & 0x1F;
uint16_t h_mant = ((cl_half)v) & 0x3FF;
return (h_exp == 0x1F && h_mant != 0);
}
else
{
#if !defined(_WIN32)
return std::isnan(v);
#else
return _isnan(v);
#endif
}
}
template <typename InType>
void ZeroNanToIntCases(cl_uint count, void *mapped, Type outType, void *input)
{