Skip to content

Commit

Permalink
JIT: Fix illegal operand swapping in VectorXYZ.AndNot transformation
Browse files Browse the repository at this point in the history
The new logic introduced in dotnet#81993 would swap the LHS and RHS of the
operands without any additional checks for side effects.

Fix dotnet#91855
  • Loading branch information
jakobbotsch committed Sep 11, 2023
1 parent f18d6b6 commit 1cbee29
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11028,7 +11028,16 @@ GenTree* Compiler::fgOptimizeHWIntrinsic(GenTreeHWIntrinsic* node)
}
}

if (lhs == nullptr || rhs == nullptr)
if ((lhs == nullptr) || (rhs == nullptr))
{
break;
}

// Filter out side effecting cases for several reasons:
// 1. gtNewSimdBinOpNode may swap operand order.
// 2. The code above will swap operand order.
// 3. The code above does not handle GTF_REVERSE_OPS.
if (((lhs->gtFlags | rhs->gtFlags) & GTF_ALL_EFFECT) != 0)
{
break;
}
Expand Down

0 comments on commit 1cbee29

Please sign in to comment.