Skip to content

Commit bc6e58d

Browse files
committed
review feedback
1 parent 5eadcf9 commit bc6e58d

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

src/coreclr/jit/gentree.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18008,11 +18008,7 @@ bool GenTree::canBeContained() const
1800818008
}
1800918009
else if (OperIsHWIntrinsic() && !isContainableHWIntrinsic())
1801018010
{
18011-
#ifdef TARGET_XARCH
18012-
return isEvexEmbeddedMaskingCompatibleHWIntrinsic();
18013-
#elif TARGET_ARM64
18014-
return HWIntrinsicInfo::IsEmbeddedMaskedOperation(AsHWIntrinsic()->GetHWIntrinsicId());
18015-
#endif
18011+
return isEmbeddedMaskingCompatibleHWIntrinsic();
1801618012
}
1801718013

1801818014
return true;
@@ -19909,24 +19905,25 @@ bool GenTree::isEvexCompatibleHWIntrinsic() const
1990919905
}
1991019906

1991119907
//------------------------------------------------------------------------
19912-
// isEvexEmbeddedMaskingCompatibleHWIntrinsic: Checks if the intrinsic is compatible
19908+
// isEmbeddedMaskingCompatibleHWIntrinsic : Checks if the intrinsic is compatible
1991319909
// with the EVEX embedded masking form for its intended lowering instruction.
1991419910
//
1991519911
// Return Value:
1991619912
// true if the intrisic node lowering instruction has an EVEX embedded masking
1991719913
//
19918-
bool GenTree::isEvexEmbeddedMaskingCompatibleHWIntrinsic() const
19914+
bool GenTree::isEmbeddedMaskingCompatibleHWIntrinsic() const
1991919915
{
19920-
#if defined(TARGET_XARCH)
1992119916
if (OperIsHWIntrinsic())
1992219917
{
19918+
#if defined(TARGET_XARCH)
1992319919
// TODO-AVX512F-CQ: Expand this to the full set of APIs and make it table driven
1992419920
// using IsEmbMaskingCompatible. For now, however, limit it to some explicit ids
1992519921
// for prototyping purposes.
1992619922
return (AsHWIntrinsic()->GetHWIntrinsicId() == NI_AVX512F_Add);
19923+
#elif defined(TARGET_ARM64)
19924+
return HWIntrinsicInfo::IsEmbeddedMaskedOperation(AsHWIntrinsic()->GetHWIntrinsicId());
19925+
#endif
1992719926
}
19928-
#endif // TARGET_XARCH
19929-
1993019927
return false;
1993119928
}
1993219929

src/coreclr/jit/gentree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ struct GenTree
14651465
bool isContainableHWIntrinsic() const;
14661466
bool isRMWHWIntrinsic(Compiler* comp);
14671467
bool isEvexCompatibleHWIntrinsic() const;
1468-
bool isEvexEmbeddedMaskingCompatibleHWIntrinsic() const;
1468+
bool isEmbeddedMaskingCompatibleHWIntrinsic() const;
14691469
#else
14701470
bool isCommutativeHWIntrinsic() const
14711471
{
@@ -1487,7 +1487,7 @@ struct GenTree
14871487
return false;
14881488
}
14891489

1490-
bool isEvexEmbeddedMaskingCompatibleHWIntrinsic() const
1490+
bool isEmbeddedMaskingCompatibleHWIntrinsic() const
14911491
{
14921492
return false;
14931493
}

src/coreclr/jit/hwintrinsiccodegenarm64.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
438438
switch (intrinOp2.numOperands)
439439
{
440440
case 1:
441+
assert(!instrIsRMW);
441442
GetEmitter()->emitIns_R_R_R(insOp2, emitSize, targetReg, maskReg, instrOp1Reg, opt);
442443
break;
443444

@@ -449,11 +450,14 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
449450
assert(targetReg != instrOp1Reg);
450451
assert(targetReg != instrOp2Reg);
451452

452-
if (!intrin.op3->IsVectorZero())
453+
if (!intrin.op3->IsVectorZero() && (instrOp1Reg != falseReg))
453454
{
454455
// If the `falseValue` of conditional-select is non-zero, then we start with that in the
455456
// destination followed by `movprfx` (see below) of the relevant bits of the first operand
456457
// of `insOp2` based upon the value of predicate `cond`.
458+
459+
// Also, if `instrOp1Reg == falseReg`, we will move the `instrOp1Reg` using `movprfx` and
460+
// so, no need to move it separately here.
457461
GetEmitter()->emitIns_Mov(INS_mov, emitTypeSize(node), targetReg, falseReg,
458462
/* canSkip */ true);
459463
}

src/coreclr/jit/lowerxarch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10137,7 +10137,7 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node)
1013710137
// contained and not a memory operand and know to invoke the special handling
1013810138
// so that the embedded masking can work as expected.
1013910139

10140-
if (op2->isEvexEmbeddedMaskingCompatibleHWIntrinsic())
10140+
if (op2->isEmbeddedMaskingCompatibleHWIntrinsic())
1014110141
{
1014210142
uint32_t maskSize = genTypeSize(simdBaseType);
1014310143
uint32_t operSize = genTypeSize(op2->AsHWIntrinsic()->GetSimdBaseType());

0 commit comments

Comments
 (0)