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

Commit dab4790

Browse files
FeiPengInteltannergooding
authored andcommitted
address GT_ADDR(GT_HWIntrinsic) nodes
1 parent 1581ae2 commit dab4790

File tree

5 files changed

+27
-29
lines changed

5 files changed

+27
-29
lines changed

src/jit/compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7712,7 +7712,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
77127712
{
77137713
return isSIMDClass(pTypeInfo) || isHWSIMDClass(pTypeInfo);
77147714
}
7715-
7715+
77167716
// Get the base (element) type and size in bytes for a SIMD type. Returns TYP_UNKNOWN
77177717
// if it is not a SIMD type or is an unsupported base type.
77187718
var_types getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, unsigned* sizeBytes = nullptr);

src/jit/gentree.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,11 @@ struct GenTree
16191619
}
16201620
#endif
16211621

1622+
bool OperIsSIMDorSimdHWintrinsic() const
1623+
{
1624+
return OperIsSIMD() || OperIsSimdHWIntrinsic();
1625+
}
1626+
16221627
// This is here for cleaner GT_LONG #ifdefs.
16231628
static bool OperIsLong(genTreeOps gtOper)
16241629
{
@@ -4265,9 +4270,7 @@ inline bool GenTree::OperIsSimdHWIntrinsic() const
42654270
{
42664271
if (gtOper == GT_HWIntrinsic)
42674272
{
4268-
// We cannot use AsHWIntrinsic() as it is not declared const
4269-
const GenTreeHWIntrinsic* hwIntrinsic = reinterpret_cast<const GenTreeHWIntrinsic*>(this);
4270-
return hwIntrinsic->isSIMD();
4273+
return this->AsHWIntrinsic()->isSIMD();
42714274
}
42724275
return false;
42734276
}

src/jit/importer.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,8 @@ GenTree* Compiler::impGetStructAddr(GenTree* structVal,
13941394
assert(structVal->gtObj.gtClass == structHnd);
13951395
return (structVal->gtObj.Addr());
13961396
}
1397-
else if (oper == GT_CALL || oper == GT_RET_EXPR || oper == GT_OBJ || oper == GT_MKREFANY)
1397+
else if (oper == GT_CALL || oper == GT_RET_EXPR || oper == GT_OBJ || oper == GT_MKREFANY ||
1398+
structVal->OperIsSimdHWIntrinsic())
13981399
{
13991400
unsigned tmpNum = lvaGrabTemp(true DEBUGARG("struct address for call/obj"));
14001401

@@ -1644,15 +1645,7 @@ GenTree* Compiler::impNormStructVal(GenTree* structVal,
16441645
}
16451646

16461647
#ifdef FEATURE_SIMD
1647-
if (blockNode->OperGet() == GT_SIMD)
1648-
{
1649-
parent->gtOp.gtOp2 = impNormStructVal(blockNode, structHnd, curLevel, forceNormalization);
1650-
alreadyNormalized = true;
1651-
}
1652-
else
1653-
#endif
1654-
#ifdef FEATURE_HW_INTRINSICS
1655-
if (blockNode->OperGet() == GT_HWIntrinsic && blockNode->AsHWIntrinsic()->isSIMD())
1648+
if (blockNode->OperIsSIMDorSimdHWintrinsic())
16561649
{
16571650
parent->gtOp.gtOp2 = impNormStructVal(blockNode, structHnd, curLevel, forceNormalization);
16581651
alreadyNormalized = true;

src/jit/morph.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3741,7 +3741,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
37413741
if (addr->OperGet() == GT_ADDR)
37423742
{
37433743
GenTree* addrChild = addr->gtOp.gtOp1;
3744-
if (addrChild->OperGet() == GT_SIMD)
3744+
if (addrChild->OperIsSIMDorSimdHWintrinsic())
37453745
{
37463746
needCpyBlk = true;
37473747
}
@@ -9318,17 +9318,17 @@ GenTree* Compiler::fgMorphOneAsgBlockOp(GenTree* tree)
93189318
unsigned size;
93199319
CORINFO_CLASS_HANDLE clsHnd = NO_CLASS_HANDLE;
93209320
#ifdef FEATURE_SIMD
9321-
// importer introduces cpblk nodes with src = GT_ADDR(GT_SIMD)
9321+
// importer introduces cpblk nodes with src = GT_ADDR(GT_SIMD/GT_HWIntrinsic)
93229322
// The SIMD type in question could be Vector2f which is 8-bytes in size.
93239323
// The below check is to make sure that we don't turn that copyblk
93249324
// into a assignment, since rationalizer logic will transform the
93259325
// copyblk appropriately. Otherwise, the transformation made in this
93269326
// routine will prevent rationalizer logic and we might end up with
9327-
// GT_ADDR(GT_SIMD) node post rationalization, leading to a noway assert
9327+
// GT_ADDR(GT_SIMD/GT_HWIntrinsic) node post rationalization, leading to a noway assert
93289328
// in codegen.
93299329
// TODO-1stClassStructs: This is here to preserve old behavior.
93309330
// It should be eliminated.
9331-
if (src->OperGet() == GT_SIMD)
9331+
if (src->OperIsSIMDorSimdHWintrinsic())
93329332
{
93339333
return nullptr;
93349334
}
@@ -10235,13 +10235,13 @@ GenTree* Compiler::fgMorphBlockOperand(GenTree* tree, var_types asgType, unsigne
1023510235
if (varTypeIsSIMD(asgType))
1023610236
{
1023710237
if ((indirTree != nullptr) && (lclNode == nullptr) && (indirTree->Addr()->OperGet() == GT_ADDR) &&
10238-
(indirTree->Addr()->gtGetOp1()->gtOper == GT_SIMD))
10238+
(indirTree->Addr()->gtGetOp1()->OperIsSIMDorSimdHWintrinsic()))
1023910239
{
1024010240
assert(!isDest);
1024110241
needsIndirection = false;
1024210242
effectiveVal = indirTree->Addr()->gtGetOp1();
1024310243
}
10244-
if (effectiveVal->OperIsSIMD() || effectiveVal->OperIsSimdHWIntrinsic())
10244+
if (effectiveVal->OperIsSIMDorSimdHWintrinsic())
1024510245
{
1024610246
needsIndirection = false;
1024710247
}
@@ -11390,6 +11390,15 @@ GenTree* Compiler::getSIMDStructFromField(GenTree* tree,
1139011390
*simdSizeOut = simdNode->gtSIMDSize;
1139111391
*pBaseTypeOut = simdNode->gtSIMDBaseType;
1139211392
}
11393+
#ifdef FEATURE_HW_INTRINSICS
11394+
else if (obj->OperIsSimdHWIntrinsic())
11395+
{
11396+
ret = obj;
11397+
GenTreeHWIntrinsic* simdNode = obj->AsHWIntrinsic();
11398+
*simdSizeOut = simdNode->gtSIMDSize;
11399+
*pBaseTypeOut = simdNode->gtSIMDBaseType;
11400+
}
11401+
#endif // FEATURE_HW_INTRINSICS
1139311402
}
1139411403
}
1139511404
if (ret != nullptr)
@@ -19036,19 +19045,12 @@ Compiler::fgWalkResult Compiler::fgMarkAddrTakenLocalsPreCB(GenTree** pTree, fgW
1903619045

1903719046
case GT_ADDR:
1903819047
#ifdef FEATURE_SIMD
19039-
if (tree->gtOp.gtOp1->OperGet() == GT_SIMD)
19048+
if (tree->gtOp.gtOp1->OperIsSIMDorSimdHWintrinsic())
1904019049
{
1904119050
axcStack->Push(AXC_None);
1904219051
}
1904319052
else
1904419053
#endif // FEATURE_SIMD
19045-
#ifdef FEATURE_HW_INTRINSICS
19046-
if (tree->gtOp.gtOp1->OperIsSimdHWIntrinsic())
19047-
{
19048-
axcStack->Push(AXC_None);
19049-
}
19050-
else
19051-
#endif // FEATURE_HW_INTRINSICS
1905219054
if (axc == AXC_Ind)
1905319055
{
1905419056
axcStack->Push(AXC_None);

src/jit/rationalize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void Rationalizer::RewriteSIMDOperand(LIR::Use& use, bool keepBlk)
108108
addr->gtType = simdType;
109109
use.ReplaceWith(comp, addr);
110110
}
111-
else if ((addr->OperGet() == GT_ADDR) && (addr->gtGetOp1()->OperGet() == GT_SIMD))
111+
else if ((addr->OperGet() == GT_ADDR) && (addr->gtGetOp1()->OperIsSIMDorSimdHWintrinsic()))
112112
{
113113
// if we have GT_IND(GT_ADDR(GT_SIMD)), remove the GT_IND(GT_ADDR()), leaving just the GT_SIMD.
114114
BlockRange().Remove(tree);

0 commit comments

Comments
 (0)