From b3367104b2d654015a932f07b43df48d509d06ba Mon Sep 17 00:00:00 2001 From: Vlad-Alexandru Ionescu <114913836+LeVladIonescu@users.noreply.github.com> Date: Fri, 25 Nov 2022 10:54:32 +0100 Subject: [PATCH] [mono][tests] Fix FullAOT DivToMul test (#78816) * Changed how NaN values are compared due to their multiple bit representations Signed-off-by: Vlad - Alexandru Ionescu * Fixed typo Signed-off-by: Vlad - Alexandru Ionescu Signed-off-by: Vlad - Alexandru Ionescu Co-authored-by: Vlad - Alexandru Ionescu --- src/tests/JIT/opt/InstructionCombining/DivToMul.cs | 14 ++++++++++++++ src/tests/issues.targets | 3 --- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/tests/JIT/opt/InstructionCombining/DivToMul.cs b/src/tests/JIT/opt/InstructionCombining/DivToMul.cs index dc559aa4041e7..0c7c3efe442ec 100644 --- a/src/tests/JIT/opt/InstructionCombining/DivToMul.cs +++ b/src/tests/JIT/opt/InstructionCombining/DivToMul.cs @@ -160,6 +160,13 @@ private static void TestNotPowOfTwo_Double(double x) [MethodImpl(MethodImplOptions.NoInlining)] private static void AssertEquals(float expected, float actual) { + if (Single.IsNaN(expected) && Single.IsNaN(actual)) + { + // There can be multiple configurations for NaN values + // verifying that these values are NaNs should be enough + return; + } + int expectedi = BitConverter.SingleToInt32Bits(expected); int actuali = BitConverter.SingleToInt32Bits(actual); if (expectedi != actuali) @@ -172,6 +179,13 @@ private static void AssertEquals(float expected, float actual) [MethodImpl(MethodImplOptions.NoInlining)] private static void AssertEquals(double expected, double actual) { + if (Double.IsNaN(expected) && Double.IsNaN(actual)) + { + // There can be multiple configurations for NaN values + // verifying that these values are NaNs should be enough + return; + } + long expectedi = BitConverter.DoubleToInt64Bits(expected); long actuali = BitConverter.DoubleToInt64Bits(actual); if (expectedi != actuali) diff --git a/src/tests/issues.targets b/src/tests/issues.targets index ba1df1b8b6b70..537f6c3dc59ce 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -1408,9 +1408,6 @@ Crashes during LLVM AOT compilation. - - Doesn't pass after LLVM AOT compilation. - Doesn't pass after LLVM AOT compilation.