From 9db34cbdd9177bc2e62b56d23bba050f8210da0f Mon Sep 17 00:00:00 2001 From: Aaron En Ye Shi Date: Tue, 3 Nov 2020 18:42:58 +0000 Subject: [PATCH] Fix hipTestFMA to align with libcxx The HIP-Clang math headers upstream have been updated to perform type promotion on math function overloads. If any argument has integral type, it will be cast to double. Change-Id: I38d9e6240c40c4092b946851469498b2ae6500ae [ROCm/hip commit: 1f0037eefc3c37de9806de7f6409c1834c971670] --- .../hip/tests/src/deviceLib/hipTestFMA.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/projects/hip/tests/src/deviceLib/hipTestFMA.cpp b/projects/hip/tests/src/deviceLib/hipTestFMA.cpp index e19f3120d7..9849d0271e 100644 --- a/projects/hip/tests/src/deviceLib/hipTestFMA.cpp +++ b/projects/hip/tests/src/deviceLib/hipTestFMA.cpp @@ -43,19 +43,19 @@ THE SOFTWARE. double doubleResult = fma(d, d, 3.0); Check(floatResult != doubleResult); - // check promote to float. - Check(fma(f, f, 3) == floatResult); - Check(fma(f, f, (char)3) == floatResult); - Check(fma(f, f, (unsigned char)3) == floatResult); - Check(fma(f, f, (short)3) == floatResult); - Check(fma(f, f, (unsigned short)3) == floatResult); - Check(fma(f, f, (int)3) == floatResult); - Check(fma(f, f, (unsigned int)3) == floatResult); - Check(fma(f, f, (long)3) == floatResult); - Check(fma(f, f, (unsigned long)3) == floatResult); - Check(fma(f, f, true) == fma(f, f, 1.0f)); - - // check promote to double. + // To align with libcxx, if any argument has integral type, + // it is cast to double. + // Check type promotes to double. + Check(fma(f, f, 3) == doubleResult); + Check(fma(f, f, (char)3) == doubleResult); + Check(fma(f, f, (unsigned char)3) == doubleResult); + Check(fma(f, f, (short)3) == doubleResult); + Check(fma(f, f, (unsigned short)3) == doubleResult); + Check(fma(f, f, (int)3) == doubleResult); + Check(fma(f, f, (unsigned int)3) == doubleResult); + Check(fma(f, f, (long)3) == doubleResult); + Check(fma(f, f, (unsigned long)3) == doubleResult); + Check(fma(f, f, true) == fma((double)f, (double)f, 1.0)); Check(fma(d, (double)f, 3) == doubleResult); Check(fma(d, (double)f, (char)3) == doubleResult); Check(fma(d, (double)f, (unsigned char)3) == doubleResult);