Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit fc89ab8

Browse files
committed
Adding basic containment analysis support for hardware intrinsics.
1 parent f8153ea commit fc89ab8

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

src/jit/lower.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@ GenTree* Lowering::LowerNode(GenTree* node)
262262
break;
263263
#endif //
264264

265+
#ifdef FEATURE_HW_INTRINSICS
266+
case GT_HWIntrinsic:
267+
LowerHWIntrinsic(node->AsHWIntrinsic());
268+
break;
269+
#endif // FEATURE_HW_INTRINSICS
270+
265271
case GT_LCL_VAR:
266272
WidenSIMD12IfNecessary(node->AsLclVarCommon());
267273
break;
@@ -5857,6 +5863,11 @@ void Lowering::ContainCheckNode(GenTree* node)
58575863
ContainCheckSIMD(node->AsSIMD());
58585864
break;
58595865
#endif // FEATURE_SIMD
5866+
#ifdef FEATURE_HW_INTRINSICS
5867+
case GT_HWIntrinsic:
5868+
ContainCheckHWIntrinsic(node->AsHWIntrinsic());
5869+
break;
5870+
#endif // FEATURE_HW_INTRINSICS
58605871
default:
58615872
break;
58625873
}

src/jit/lower.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ class Lowering : public Phase
120120
#ifdef FEATURE_SIMD
121121
void ContainCheckSIMD(GenTreeSIMD* simdNode);
122122
#endif // FEATURE_SIMD
123+
#ifdef FEATURE_HW_INTRINSICS
124+
void ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node);
125+
#endif // FEATURE_HW_INTRINSICS
123126

124127
#ifdef DEBUG
125128
static void CheckCallArg(GenTree* arg);
@@ -306,6 +309,9 @@ class Lowering : public Phase
306309
#ifdef FEATURE_SIMD
307310
void LowerSIMD(GenTreeSIMD* simdNode);
308311
#endif // FEATURE_SIMD
312+
#ifdef FEATURE_HW_INTRINSICS
313+
void LowerHWIntrinsic(GenTreeHWIntrinsic* node);
314+
#endif // FEATURE_HW_INTRINSICS
309315

310316
// Utility functions
311317
void MorphBlkIntoHelperCall(GenTreePtr pTree, GenTreePtr treeStmt);

src/jit/lowerxarch.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,19 @@ void Lowering::LowerSIMD(GenTreeSIMD* simdNode)
867867
}
868868
#endif // FEATURE_SIMD
869869

870+
#ifdef FEATURE_HW_INTRINSICS
871+
//----------------------------------------------------------------------------------------------
872+
// Lowering::LowerHWIntrinsic: Perform containment analysis for a hardware intrinsic node.
873+
//
874+
// Arguments:
875+
// node - The hardware intrinsic node.
876+
//
877+
void Lowering::LowerHWIntrinsic(GenTreeHWIntrinsic* node)
878+
{
879+
ContainCheckHWIntrinsic(node);
880+
}
881+
#endif // FEATURE_HW_INTRINSICS
882+
870883
//----------------------------------------------------------------------------------------------
871884
// Lowering::IsRMWIndirCandidate:
872885
// Returns true if the given operand is a candidate indirection for a read-modify-write
@@ -2278,6 +2291,28 @@ void Lowering::ContainCheckSIMD(GenTreeSIMD* simdNode)
22782291
}
22792292
#endif // FEATURE_SIMD
22802293

2294+
#ifdef FEATURE_HW_INTRINSICS
2295+
//----------------------------------------------------------------------------------------------
2296+
// ContainCheckHWIntrinsic: Perform containment analysis for a hardware intrinsic node.
2297+
//
2298+
// Arguments:
2299+
// node - The hardware intrinsic node.
2300+
//
2301+
void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node)
2302+
{
2303+
NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
2304+
GenTree* op1 = node->gtOp.gtOp1;
2305+
GenTree* op2 = node->gtOp.gtOp2;
2306+
2307+
switch (node->gtHWIntrinsicId)
2308+
{
2309+
default:
2310+
assert((intrinsicID > NI_HW_INTRINSIC_START) && (intrinsicID < NI_HW_INTRINSIC_END));
2311+
break;
2312+
}
2313+
}
2314+
#endif // FEATURE_HW_INTRINSICS
2315+
22812316
//------------------------------------------------------------------------
22822317
// ContainCheckFloatBinary: determine whether the sources of a floating point binary node should be contained.
22832318
//

0 commit comments

Comments
 (0)