-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix perf issues discovered in "For software performance, can you always trust inlining" blog #61408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
a433102
1673244
72fb64e
dddf349
4f4c709
80897b4
3368ff2
bd38782
8967fce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2620,29 +2620,55 @@ unsigned Compiler::gtSetMultiOpOrder(GenTreeMultiOp* multiOp) | |
| unsigned level = 0; | ||
| unsigned lvl2 = 0; | ||
|
|
||
| #if defined(FEATURE_HW_INTRINSICS) && defined(TARGET_XARCH) | ||
| if (multiOp->OperIs(GT_HWINTRINSIC) && (multiOp->GetOperandCount() == 1) && | ||
| multiOp->AsHWIntrinsic()->OperIsMemoryLoadOrStore()) | ||
| #if defined(FEATURE_HW_INTRINSICS) | ||
| if (multiOp->OperIs(GT_HWINTRINSIC)) | ||
| { | ||
| costEx = IND_COST_EX; | ||
| costSz = 2; | ||
| GenTreeHWIntrinsic* hwTree = multiOp->AsHWIntrinsic(); | ||
| #if defined(TARGET_XARCH) | ||
| if ((hwTree->GetOperandCount() == 1) && hwTree->OperIsMemoryLoadOrStore()) | ||
| { | ||
| costEx = IND_COST_EX; | ||
| costSz = 2; | ||
|
|
||
| GenTree* addr = multiOp->Op(1)->gtEffectiveVal(); | ||
| level = gtSetEvalOrder(addr); | ||
| GenTree* addr = hwTree->Op(1)->gtEffectiveVal(); | ||
| level = gtSetEvalOrder(addr); | ||
|
|
||
| // See if we can form a complex addressing mode. | ||
| if (addr->OperIs(GT_ADD) && gtMarkAddrMode(addr, &costEx, &costSz, multiOp->TypeGet())) | ||
| { | ||
| // Nothing to do, costs have been set. | ||
| // See if we can form a complex addressing mode. | ||
| if (addr->OperIs(GT_ADD) && gtMarkAddrMode(addr, &costEx, &costSz, hwTree->TypeGet())) | ||
| { | ||
| // Nothing to do, costs have been set. | ||
| } | ||
| else | ||
| { | ||
| costEx += addr->GetCostEx(); | ||
| costSz += addr->GetCostSz(); | ||
| } | ||
|
|
||
| hwTree->SetCosts(costEx, costSz); | ||
| return level; | ||
| } | ||
| else | ||
| #endif | ||
| switch (hwTree->gtHWIntrinsicId) | ||
| { | ||
| costEx += addr->GetCostEx(); | ||
| costSz += addr->GetCostSz(); | ||
| #if defined(TARGET_XARCH) | ||
| case NI_Vector128_Create: | ||
| case NI_Vector256_Create: | ||
| #elif defined(TARGET_ARM64) | ||
| case NI_Vector64_Create: | ||
| case NI_Vector128_Create: | ||
| #endif | ||
| { | ||
| if (hwTree->gtGetOp1()->OperIsConst() && (hwTree->gtGetOp2() == nullptr)) | ||
| { | ||
| // Vector.Create(cns) is cheap but not that cheap to be (1,1) | ||
| costEx = 2; | ||
|
||
| costSz = 2; | ||
| } | ||
| break; | ||
| } | ||
| default: | ||
| break; | ||
| } | ||
|
|
||
| multiOp->SetCosts(costEx, costSz); | ||
| return level; | ||
| } | ||
| #endif // defined(FEATURE_SIMD) || defined(FEATURE_HW_INTRINSICS) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.