Skip to content

Commit

Permalink
[mono][tests] Fix FullAOT DivToMul test (#78816)
Browse files Browse the repository at this point in the history
* Changed how NaN values are compared due to their multiple bit representations

Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>

* Fixed typo

Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>

Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
Co-authored-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
  • Loading branch information
LeVladIonescu and Vlad - Alexandru Ionescu authored Nov 25, 2022
1 parent 4832236 commit b336710
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/tests/JIT/opt/InstructionCombining/DivToMul.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1408,9 +1408,6 @@
<Issue>Crashes during LLVM AOT compilation.</Issue>
</ExcludeList>

<ExcludeList Include="$(XunitTestBinBase)/JIT/opt/InstructionCombining/DivToMul/**">
<Issue>Doesn't pass after LLVM AOT compilation.</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/JIT/Directed/StructABI/StructABI/**">
<Issue>Doesn't pass after LLVM AOT compilation.</Issue>
</ExcludeList>
Expand Down

0 comments on commit b336710

Please sign in to comment.