Skip to content

Commit 0c55782

Browse files
committed
Use GTF_REVERSE_OPS instead of impSpillSideEffect
1 parent 6e3c0cd commit 0c55782

File tree

6 files changed

+48
-73
lines changed

6 files changed

+48
-73
lines changed

src/coreclr/jit/hwintrinsicarm64.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,20 +1576,11 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
15761576

15771577
if (sig->numArgs == 3)
15781578
{
1579-
impSpillSideEffect(true, verCurrentState.esStackDepth -
1580-
3 DEBUGARG("Spilling op1 side effects for HWIntrinsic"));
1581-
1582-
impSpillSideEffect(true, verCurrentState.esStackDepth -
1583-
2 DEBUGARG("Spilling op2 side effects for HWIntrinsic"));
1584-
15851579
op3 = impPopStack().val;
15861580
}
15871581
else
15881582
{
15891583
assert(sig->numArgs == 2);
1590-
1591-
impSpillSideEffect(true, verCurrentState.esStackDepth -
1592-
2 DEBUGARG("Spilling op1 side effects for HWIntrinsic"));
15931584
}
15941585

15951586
op2 = impPopStack().val;
@@ -1610,6 +1601,8 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
16101601
op1 = impSIMDPopStack(simdType);
16111602

16121603
retNode = gtNewSimdStoreNode(op2, op1, simdBaseJitType, simdSize, /* isSimdAsHWIntrinsic */ false);
1604+
retNode->SetReverseOp();
1605+
16131606
break;
16141607
}
16151608

@@ -1629,9 +1622,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
16291622

16301623
var_types simdType = getSIMDTypeForSize(simdSize);
16311624

1632-
impSpillSideEffect(true,
1633-
verCurrentState.esStackDepth - 2 DEBUGARG("Spilling op1 side effects for HWIntrinsic"));
1634-
16351625
op2 = impPopStack().val;
16361626

16371627
if (op2->OperIs(GT_CAST) && op2->gtGetOp1()->TypeIs(TYP_BYREF))
@@ -1643,6 +1633,8 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
16431633
op1 = impSIMDPopStack(simdType);
16441634

16451635
retNode = gtNewSimdStoreAlignedNode(op2, op1, simdBaseJitType, simdSize, /* isSimdAsHWIntrinsic */ false);
1636+
retNode->SetReverseOp();
1637+
16461638
break;
16471639
}
16481640

@@ -1662,9 +1654,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
16621654

16631655
var_types simdType = getSIMDTypeForSize(simdSize);
16641656

1665-
impSpillSideEffect(true,
1666-
verCurrentState.esStackDepth - 2 DEBUGARG("Spilling op1 side effects for HWIntrinsic"));
1667-
16681657
op2 = impPopStack().val;
16691658

16701659
if (op2->OperIs(GT_CAST) && op2->gtGetOp1()->TypeIs(TYP_BYREF))
@@ -1677,6 +1666,8 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
16771666

16781667
retNode = gtNewSimdStoreNonTemporalNode(op2, op1, simdBaseJitType, simdSize,
16791668
/* isSimdAsHWIntrinsic */ false);
1669+
retNode->SetReverseOp();
1670+
16801671
break;
16811672
}
16821673

src/coreclr/jit/hwintrinsicxarch.cpp

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,20 +2065,11 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
20652065

20662066
if (sig->numArgs == 3)
20672067
{
2068-
impSpillSideEffect(true, verCurrentState.esStackDepth -
2069-
3 DEBUGARG("Spilling op1 side effects for HWIntrinsic"));
2070-
2071-
impSpillSideEffect(true, verCurrentState.esStackDepth -
2072-
2 DEBUGARG("Spilling op2 side effects for HWIntrinsic"));
2073-
20742068
op3 = impPopStack().val;
20752069
}
20762070
else
20772071
{
20782072
assert(sig->numArgs == 2);
2079-
2080-
impSpillSideEffect(true, verCurrentState.esStackDepth -
2081-
2 DEBUGARG("Spilling op1 side effects for HWIntrinsic"));
20822073
}
20832074

20842075
op2 = impPopStack().val;
@@ -2099,20 +2090,19 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
20992090
op1 = impSIMDPopStack(simdType);
21002091

21012092
retNode = gtNewSimdStoreNode(op2, op1, simdBaseJitType, simdSize, /* isSimdAsHWIntrinsic */ false);
2093+
retNode->SetReverseOp();
2094+
21022095
break;
21032096
}
21042097

21052098
case NI_Vector128_StoreAligned:
21062099
case NI_Vector256_StoreAligned:
21072100
{
21082101
assert(sig->numArgs == 2);
2109-
assert(retType == TYP_VOID);
21102102

2103+
assert(retType == TYP_VOID);
21112104
var_types simdType = getSIMDTypeForSize(simdSize);
21122105

2113-
impSpillSideEffect(true,
2114-
verCurrentState.esStackDepth - 2 DEBUGARG("Spilling op1 side effects for HWIntrinsic"));
2115-
21162106
op2 = impPopStack().val;
21172107

21182108
if (op2->OperIs(GT_CAST) && op2->gtGetOp1()->TypeIs(TYP_BYREF))
@@ -2124,20 +2114,19 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
21242114
op1 = impSIMDPopStack(simdType);
21252115

21262116
retNode = gtNewSimdStoreAlignedNode(op2, op1, simdBaseJitType, simdSize, /* isSimdAsHWIntrinsic */ false);
2117+
retNode->SetReverseOp();
2118+
21272119
break;
21282120
}
21292121

21302122
case NI_Vector128_StoreAlignedNonTemporal:
21312123
case NI_Vector256_StoreAlignedNonTemporal:
21322124
{
21332125
assert(sig->numArgs == 2);
2134-
assert(retType == TYP_VOID);
21352126

2127+
assert(retType == TYP_VOID);
21362128
var_types simdType = getSIMDTypeForSize(simdSize);
21372129

2138-
impSpillSideEffect(true,
2139-
verCurrentState.esStackDepth - 2 DEBUGARG("Spilling op1 side effects for HWIntrinsic"));
2140-
21412130
op2 = impPopStack().val;
21422131

21432132
if (op2->OperIs(GT_CAST) && op2->gtGetOp1()->TypeIs(TYP_BYREF))
@@ -2150,6 +2139,7 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
21502139

21512140
retNode = gtNewSimdStoreNonTemporalNode(op2, op1, simdBaseJitType, simdSize,
21522141
/* isSimdAsHWIntrinsic */ false);
2142+
retNode->SetReverseOp();
21532143
break;
21542144
}
21552145

src/coreclr/jit/simdashwintrinsic.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,11 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic,
14461446
op2 = op2->gtGetOp1();
14471447
}
14481448

1449-
return gtNewSimdStoreNode(op2, op1, simdBaseJitType, simdSize, /* isSimdAsHWIntrinsic */ true);
1449+
GenTree* retNode = gtNewSimdStoreNode(op2, op1, simdBaseJitType, simdSize,
1450+
/* isSimdAsHWIntrinsic */ true);
1451+
retNode->SetReverseOp();
1452+
1453+
return retNode;
14501454
}
14511455

14521456
case NI_VectorT128_StoreAligned:
@@ -1462,8 +1466,11 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic,
14621466
op2 = op2->gtGetOp1();
14631467
}
14641468

1465-
return gtNewSimdStoreAlignedNode(op2, op1, simdBaseJitType, simdSize,
1466-
/* isSimdAsHWIntrinsic */ true);
1469+
GenTree* retNode = gtNewSimdStoreAlignedNode(op2, op1, simdBaseJitType, simdSize,
1470+
/* isSimdAsHWIntrinsic */ true);
1471+
retNode->SetReverseOp();
1472+
1473+
return retNode;
14671474
}
14681475

14691476
case NI_VectorT128_StoreAlignedNonTemporal:
@@ -1479,8 +1486,11 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic,
14791486
op2 = op2->gtGetOp1();
14801487
}
14811488

1482-
return gtNewSimdStoreNonTemporalNode(op2, op1, simdBaseJitType, simdSize,
1483-
/* isSimdAsHWIntrinsic */ true);
1489+
GenTree* retNode = gtNewSimdStoreNonTemporalNode(op2, op1, simdBaseJitType, simdSize,
1490+
/* isSimdAsHWIntrinsic */ true);
1491+
retNode->SetReverseOp();
1492+
1493+
return retNode;
14841494
}
14851495

14861496
case NI_Vector2_op_Subtraction:
@@ -1515,13 +1525,6 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic,
15151525
3 DEBUGARG("Spilling op1 side effects for SimdAsHWIntrinsic"));
15161526
}
15171527

1518-
if (SimdAsHWIntrinsicInfo::SpillSideEffectsOp2(intrinsic))
1519-
{
1520-
assert(newobjThis == nullptr);
1521-
impSpillSideEffect(true, verCurrentState.esStackDepth -
1522-
2 DEBUGARG("Spilling op2 side effects for SimdAsHWIntrinsic"));
1523-
}
1524-
15251528
CORINFO_ARG_LIST_HANDLE arg2 = isInstanceMethod ? argList : info.compCompHnd->getArgNext(argList);
15261529
CORINFO_ARG_LIST_HANDLE arg3 = info.compCompHnd->getArgNext(arg2);
15271530

@@ -1576,7 +1579,11 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic,
15761579
op3 = gtNewOperNode(GT_MUL, op3->TypeGet(), op3, tmp);
15771580
op2 = gtNewOperNode(GT_ADD, op2->TypeGet(), op2, op3);
15781581

1579-
return gtNewSimdStoreNode(op2, op1, simdBaseJitType, simdSize, /* isSimdAsHWIntrinsic */ true);
1582+
GenTree* retNode = gtNewSimdStoreNode(op2, op1, simdBaseJitType, simdSize,
1583+
/* isSimdAsHWIntrinsic */ true);
1584+
retNode->SetReverseOp();
1585+
1586+
return retNode;
15801587
}
15811588

15821589
case NI_Vector2_Create:
@@ -1692,8 +1699,6 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic,
16921699
4 DEBUGARG("Spilling op1 side effects for SimdAsHWIntrinsic"));
16931700
}
16941701

1695-
assert(!SimdAsHWIntrinsicInfo::SpillSideEffectsOp2(intrinsic));
1696-
16971702
CORINFO_ARG_LIST_HANDLE arg2 = argList;
16981703
CORINFO_ARG_LIST_HANDLE arg3 = info.compCompHnd->getArgNext(arg2);
16991704
CORINFO_ARG_LIST_HANDLE arg4 = info.compCompHnd->getArgNext(arg3);
@@ -1814,8 +1819,6 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic,
18141819
5 DEBUGARG("Spilling op1 side effects for SimdAsHWIntrinsic"));
18151820
}
18161821

1817-
assert(!SimdAsHWIntrinsicInfo::SpillSideEffectsOp2(intrinsic));
1818-
18191822
CORINFO_ARG_LIST_HANDLE arg2 = argList;
18201823
CORINFO_ARG_LIST_HANDLE arg3 = info.compCompHnd->getArgNext(arg2);
18211824
CORINFO_ARG_LIST_HANDLE arg4 = info.compCompHnd->getArgNext(arg3);

src/coreclr/jit/simdashwintrinsic.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ enum class SimdAsHWIntrinsicFlag : unsigned int
3434

3535
// Indicates that side effects need to be spilled for op1
3636
SpillSideEffectsOp1 = 0x20,
37-
38-
// Indicates that side effects need to be spilled for op2
39-
SpillSideEffectsOp2 = 0x40,
4037
};
4138

4239
inline SimdAsHWIntrinsicFlag operator~(SimdAsHWIntrinsicFlag value)
@@ -148,12 +145,6 @@ struct SimdAsHWIntrinsicInfo
148145
SimdAsHWIntrinsicFlag flags = lookupFlags(id);
149146
return (flags & SimdAsHWIntrinsicFlag::SpillSideEffectsOp1) == SimdAsHWIntrinsicFlag::SpillSideEffectsOp1;
150147
}
151-
152-
static bool SpillSideEffectsOp2(NamedIntrinsic id)
153-
{
154-
SimdAsHWIntrinsicFlag flags = lookupFlags(id);
155-
return (flags & SimdAsHWIntrinsicFlag::SpillSideEffectsOp2) == SimdAsHWIntrinsicFlag::SpillSideEffectsOp2;
156-
}
157148
};
158149

159150
#endif // _SIMD_AS_HWINTRINSIC_H_

0 commit comments

Comments
 (0)