Skip to content

Commit 048ce0b

Browse files
committed
Ensure we create a valid node when DOTNET_EnableSSE2=0 is set
1 parent 89f6bfe commit 048ce0b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/coreclr/jit/hwintrinsicxarch.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,8 +1413,20 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
14131413
op2 = impSIMDPopStack();
14141414
op1 = impSIMDPopStack();
14151415

1416-
op1 = gtFoldExpr(gtNewSimdUnOpNode(GT_NOT, retType, op1, simdBaseJitType, simdSize));
1417-
retNode = gtNewSimdBinOpNode(GT_AND, retType, op1, op2, simdBaseJitType, simdSize);
1416+
if (IsBaselineSimdIsaSupported())
1417+
{
1418+
op1 = gtFoldExpr(gtNewSimdUnOpNode(GT_NOT, retType, op1, simdBaseJitType, simdSize));
1419+
retNode = gtNewSimdBinOpNode(GT_AND, retType, op1, op2, simdBaseJitType, simdSize);
1420+
}
1421+
else
1422+
{
1423+
// We need to ensure we import even if SSE2 is disabled
1424+
assert(intrinsic == NI_SSE_AndNot);
1425+
1426+
op3 = gtNewAllBitsSetConNode(retType);
1427+
op1 = gtNewSimdHWIntrinsicNode(retType, op1, op3, NI_SSE_Xor, simdBaseJitType, simdSize);
1428+
retNode = gtNewSimdHWIntrinsicNode(retType, op1, op2, NI_SSE_And, simdBaseJitType, simdSize);
1429+
}
14181430
break;
14191431
}
14201432

0 commit comments

Comments
 (0)