From aee19bb761e4a7fc353eccde2cc3635eadc2dd2a 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/clr commit: 9c041b1984fbb40f2c4c2f1b8c4575d240cd0b95] --- .../hipamd/tests/src/deviceLib/hipTestFMA.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/projects/clr/hipamd/tests/src/deviceLib/hipTestFMA.cpp b/projects/clr/hipamd/tests/src/deviceLib/hipTestFMA.cpp index e19f3120d7..9849d0271e 100644 --- a/projects/clr/hipamd/tests/src/deviceLib/hipTestFMA.cpp +++ b/projects/clr/hipamd/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);