@@ -62,25 +62,6 @@ static void assertIsContainableHWIntrinsicOp(Lowering* lowering,
6262#endif // DEBUG
6363}
6464
65- // ------------------------------------------------------------------------
66- // genIsTableDrivenHWIntrinsic:
67- //
68- // Arguments:
69- // category - category of a HW intrinsic
70- //
71- // Return Value:
72- // returns true if this category can be table-driven in CodeGen
73- //
74- static bool genIsTableDrivenHWIntrinsic (NamedIntrinsic intrinsicId, HWIntrinsicCategory category)
75- {
76- // TODO - make more categories to the table-driven framework
77- // HW_Category_Helper and HW_Flag_SpecialCodeGen usually need manual codegen
78- const bool tableDrivenCategory =
79- (category != HW_Category_Special) && (category != HW_Category_Scalar) && (category != HW_Category_Helper);
80- const bool tableDrivenFlag = !HWIntrinsicInfo::HasSpecialCodegen (intrinsicId);
81- return tableDrivenCategory && tableDrivenFlag;
82- }
83-
8465// ------------------------------------------------------------------------
8566// AddEmbRoundingMode: Adds the embedded rounding mode to the insOpts
8667//
@@ -408,7 +389,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
408389 assert (HWIntrinsicInfo::RequiresCodegen (intrinsicId));
409390 assert (!HWIntrinsicInfo::NeedsNormalizeSmallTypeToInt (intrinsicId) || !varTypeIsSmall (node->GetSimdBaseType ()));
410391
411- bool isTableDriven = genIsTableDrivenHWIntrinsic (intrinsicId, category);
392+ bool isTableDriven = HWIntrinsicInfo:: genIsTableDrivenHWIntrinsic (intrinsicId, category);
412393 insOpts instOptions = INS_OPTS_NONE;
413394
414395 if (GetEmitter ()->UseEvexEncoding ())
@@ -659,6 +640,8 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
659640 {
660641 // Until we improve the handling of addressing modes in the emitter, we'll create a
661642 // temporary GT_IND to generate code with.
643+
644+ assert (instOptions == INS_OPTS_NONE);
662645 GenTreeIndir load = indirForm (node->TypeGet (), op1);
663646 emit->emitInsLoadInd (ins, simdSize, node->GetRegNum (), &load);
664647 }
@@ -703,6 +686,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
703686 // Until we improve the handling of addressing modes in the emitter, we'll create a
704687 // temporary GT_STORE_IND to generate code with.
705688
689+ assert (instOptions == INS_OPTS_NONE);
706690 GenTreeStoreInd store = storeIndirForm (node->TypeGet (), op1, op2);
707691 emit->emitInsStoreInd (ins, simdSize, &store);
708692 break ;
@@ -834,10 +818,9 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
834818 }
835819 else if (category == HW_Category_MemoryStore)
836820 {
837- assert (instOptions == INS_OPTS_NONE);
838-
839821 // The Mask instructions do not currently support containment of the address.
840822 assert (!op2->isContained ());
823+
841824 if (intrinsicId == NI_AVX_MaskStore || intrinsicId == NI_AVX2_MaskStore)
842825 {
843826 emit->emitIns_AR_R_R (ins, simdSize, op2Reg, op3Reg, op1Reg, 0 , instOptions);
@@ -1340,13 +1323,24 @@ void CodeGen::genHWIntrinsic_R_R_RM_R(GenTreeHWIntrinsic* node, instruction ins,
13401323 GenTree* op3 = node->Op (3 );
13411324 emitter* emit = GetEmitter ();
13421325
1343- regNumber op1Reg = op1-> GetRegNum () ;
1326+ regNumber op1Reg = REG_NA ;
13441327 regNumber op3Reg = op3->GetRegNum ();
13451328
13461329 assert (targetReg != REG_NA);
1347- assert (op1Reg != REG_NA);
13481330 assert (op3Reg != REG_NA);
13491331
1332+ if (op1->isContained ())
1333+ {
1334+ assert (node->GetHWIntrinsicId () == NI_AVX512_BlendVariableMask);
1335+ assert (op1->IsVectorZero ());
1336+ instOptions = AddEmbMaskingMode (instOptions, REG_K0, true );
1337+ }
1338+ else
1339+ {
1340+ op1Reg = op1->GetRegNum ();
1341+ assert (op1Reg != REG_NA);
1342+ }
1343+
13501344 if (CodeGenInterface::IsEmbeddedBroadcastEnabled (ins, op2))
13511345 {
13521346 instOptions = AddEmbBroadcastMode (instOptions);
@@ -1693,7 +1687,7 @@ void CodeGen::genNonTableDrivenHWIntrinsicsJumpTableFallback(GenTreeHWIntrinsic*
16931687
16941688 assert (HWIntrinsicInfo::IsEmbRoundingCompatible (intrinsicId));
16951689 assert (!lastOp->isContained ());
1696- assert (!genIsTableDrivenHWIntrinsic (intrinsicId, category));
1690+ assert (!HWIntrinsicInfo:: genIsTableDrivenHWIntrinsic (intrinsicId, category));
16971691
16981692 var_types baseType = node->GetSimdBaseType ();
16991693 emitAttr attr = emitActualTypeSize (Compiler::getSIMDTypeForSize (node->GetSimdSize ()));
0 commit comments