diff --git a/test_conformance/math_brute_force/binary_half.cpp b/test_conformance/math_brute_force/binary_half.cpp index 180034ba..70057db5 100644 --- a/test_conformance/math_brute_force/binary_half.cpp +++ b/test_conformance/math_brute_force/binary_half.cpp @@ -266,6 +266,7 @@ cl_int TestHalf(cl_uint job_id, cl_uint thread_id, void *data) return CL_SUCCESS; } + cl_half_rounding_mode halfRoundingMode = CL_HALF_RTE; FPU_mode_type oldMode; oldRoundMode = kRoundToNearestEven; if (isFDim) @@ -275,7 +276,11 @@ cl_int TestHalf(cl_uint job_id, cl_uint thread_id, void *data) if (ftz) ForceFTZ(&oldMode); // Set the rounding mode to match the device - if (gIsInRTZMode) oldRoundMode = set_round(kRoundTowardZero, kfloat); + if (gIsInRTZMode) + { + oldRoundMode = set_round(kRoundTowardZero, kfloat); + halfRoundingMode = CL_HALF_RTZ; + } } if (!strcmp(name, "copysign")) copysign_test = 1; @@ -293,9 +298,9 @@ cl_int TestHalf(cl_uint job_id, cl_uint thread_id, void *data) s2[j] = cl_half_to_float(p2[j]); if (isNextafter) r[j] = cl_half_from_float(reference_nextafterh(s[j], s2[j]), - CL_HALF_RTE); + halfRoundingMode); else - r[j] = cl_half_from_float(ref_func(s[j], s2[j]), CL_HALF_RTE); + r[j] = cl_half_from_float(ref_func(s[j], s2[j]), halfRoundingMode); } if (isFDim && ftz) RestoreFPState(&oldMode);