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

Commit 29f7235

Browse files
committed
Port simple sse2 intrinsics implementation to table driven codegen
1 parent b9601ee commit 29f7235

34 files changed

+382
-2795
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ bld/
2626
[Bb]in/
2727
[Oo]bj/
2828
msbuild.log
29-
docs/
3029

3130
# add back architecture directories ignored in 'Build results'
3231
!tests/x86

src/jit/compiler.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,11 +2060,9 @@ class Compiler
20602060
var_types baseType,
20612061
unsigned size);
20622062
GenTreeHWIntrinsic* gtNewSimdHWIntrinsicNode(
2063-
var_types type, GenTree* op1, NamedIntrinsic hwIntrinsicID, var_types baseType, unsigned size, var_types srcType = TYP_UNDEF);
2063+
var_types type, GenTree* op1, NamedIntrinsic hwIntrinsicID, var_types baseType, unsigned size);
20642064
GenTreeHWIntrinsic* gtNewSimdHWIntrinsicNode(
2065-
var_types type, GenTree* op1, ssize_t iVal, NamedIntrinsic hwIntrinsicID, var_types baseType, unsigned size, var_types srcType = TYP_UNDEF);
2066-
GenTreeHWIntrinsic* gtNewSimdHWIntrinsicNode(
2067-
var_types type, GenTree* op1, GenTree* op2, NamedIntrinsic hwIntrinsicID, var_types baseType, unsigned size, var_types srcType = TYP_UNDEF);
2065+
var_types type, GenTree* op1, GenTree* op2, NamedIntrinsic hwIntrinsicID, var_types baseType, unsigned size);
20682066
GenTreeHWIntrinsic* gtNewSimdHWIntrinsicNode(var_types type,
20692067
GenTree* op1,
20702068
GenTree* op2,
@@ -2079,8 +2077,7 @@ class Compiler
20792077
GenTree* op4,
20802078
NamedIntrinsic hwIntrinsicID,
20812079
var_types baseType,
2082-
unsigned size,
2083-
var_types srcType = TYP_UNDEF);
2080+
unsigned size);
20842081
GenTreeHWIntrinsic* gtNewScalarHWIntrinsicNode(var_types type, GenTree* op1, NamedIntrinsic hwIntrinsicID);
20852082
GenTreeHWIntrinsic* gtNewScalarHWIntrinsicNode(var_types type,
20862083
GenTree* op1,
@@ -7964,7 +7961,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
79647961
#endif
79657962
}
79667963

7967-
// Whether SSE3, SSE3, SSE4.1 and SSE4.2 is available
7964+
// Whether SSE3, SSSE3, SSE4.1 and SSE4.2 is available
79687965
bool CanUseSSE4() const
79697966
{
79707967
#ifdef _TARGET_XARCH_

src/jit/emitxarch.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ bool emitter::IsDstDstSrcAVXInstruction(instruction ins)
162162
case INS_pmuludq:
163163
case INS_por:
164164
case INS_psadbw:
165-
case INS_pshufhw:
166-
case INS_pshuflw:
167165
case INS_psubb:
168166
case INS_psubd:
169167
case INS_psubq:
@@ -3518,7 +3516,7 @@ void emitter::emitIns_R(instruction ins, emitAttr attr, regNumber reg)
35183516
if (size == EA_1BYTE)
35193517
sz = 2; // Use the long form as the small one has no 'w' bit
35203518
else
3521-
sz = 1; // Use short form
3519+
sz = 1; // Use short form
35223520

35233521
#endif // !_TARGET_AMD64_
35243522

@@ -4837,7 +4835,7 @@ void emitter::emitIns_AR_R(instruction ins, emitAttr attr, regNumber ireg, regNu
48374835
#if FEATURE_STACK_FP_X87
48384836
fmt = emitInsModeFormat(ins, IF_ARD, IF_TRD_ARD, IF_AWR_TRD);
48394837
#else // !FEATURE_STACK_FP_X87
4840-
fmt = emitInsModeFormat(ins, IF_ARD);
4838+
fmt = emitInsModeFormat(ins, IF_ARD);
48414839
#endif // !FEATURE_STACK_FP_X87
48424840
}
48434841
else
@@ -5312,7 +5310,6 @@ void emitter::emitIns_SIMD_R_R_C(
53125310
}
53135311
}
53145312

5315-
53165313
void emitter::emitIns_SIMD_R_R_R(instruction ins, emitAttr attr, regNumber reg, regNumber reg1, regNumber reg2)
53175314
{
53185315
if (UseVEXEncoding())

src/jit/gentree.cpp

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ void GenTree::InitNodeSize()
304304
GenTree::s_gtNodeSizes[GT_INDEX_ADDR] = TREE_NODE_SZ_LARGE;
305305
GenTree::s_gtNodeSizes[GT_ARR_BOUNDS_CHECK] = TREE_NODE_SZ_LARGE;
306306
#ifdef FEATURE_SIMD
307-
GenTree::s_gtNodeSizes[GT_SIMD_CHK] = TREE_NODE_SZ_LARGE;
308-
GenTree::s_gtNodeSizes[GT_SIMD] = TREE_NODE_SZ_LARGE;
307+
GenTree::s_gtNodeSizes[GT_SIMD_CHK] = TREE_NODE_SZ_LARGE;
309308
#endif // FEATURE_SIMD
310309
GenTree::s_gtNodeSizes[GT_ARR_ELEM] = TREE_NODE_SZ_LARGE;
311310
GenTree::s_gtNodeSizes[GT_ARR_INDEX] = TREE_NODE_SZ_LARGE;
@@ -322,9 +321,6 @@ void GenTree::InitNodeSize()
322321
GenTree::s_gtNodeSizes[GT_STORE_DYN_BLK] = TREE_NODE_SZ_LARGE;
323322
GenTree::s_gtNodeSizes[GT_INTRINSIC] = TREE_NODE_SZ_LARGE;
324323
GenTree::s_gtNodeSizes[GT_ALLOCOBJ] = TREE_NODE_SZ_LARGE;
325-
#ifdef FEATURE_HW_INTRINSICS
326-
GenTree::s_gtNodeSizes[GT_HWIntrinsic] = TREE_NODE_SZ_LARGE;
327-
#endif
328324
#if USE_HELPERS_FOR_INT_DIV
329325
GenTree::s_gtNodeSizes[GT_DIV] = TREE_NODE_SZ_LARGE;
330326
GenTree::s_gtNodeSizes[GT_UDIV] = TREE_NODE_SZ_LARGE;
@@ -406,8 +402,12 @@ void GenTree::InitNodeSize()
406402
#endif // FEATURE_PUT_STRUCT_ARG_STK
407403

408404
#ifdef FEATURE_SIMD
409-
static_assert_no_msg(sizeof(GenTreeSIMD) <= TREE_NODE_SZ_LARGE); // *** large node
405+
static_assert_no_msg(sizeof(GenTreeSIMD) <= TREE_NODE_SZ_SMALL);
410406
#endif // FEATURE_SIMD
407+
408+
#ifdef FEATURE_HW_INTRINSICS
409+
static_assert_no_msg(sizeof(GenTreeHWIntrinsic) <= TREE_NODE_SZ_SMALL);
410+
#endif // FEATURE_HW_INTRINSICS
411411
// clang-format on
412412
}
413413

@@ -8821,6 +8821,20 @@ unsigned GenTree::NumChildren()
88218821
}
88228822
return childCount;
88238823
}
8824+
#ifdef FEATURE_HW_INTRINSICS
8825+
// GT_HWIntrinsic require special handling in case of SetZeroVectorNNN functions which do not take arg
8826+
if (OperGet() == GT_HWIntrinsic)
8827+
{
8828+
switch (gtOp.AsHWIntrinsic()->gtHWIntrinsicId)
8829+
{
8830+
case NI_SSE_SetZeroVector128:
8831+
case NI_SSE2_SetZeroVector128:
8832+
return 0;
8833+
default:
8834+
break;
8835+
}
8836+
}
8837+
#endif
88248838
// Special case for assignment of dynamic block.
88258839
// This is here to duplicate the former case where the size may be evaluated prior to the
88268840
// source and destination addresses. In order to do this, we treat the size as a child of the
@@ -17940,8 +17954,7 @@ GenTreeHWIntrinsic* Compiler::gtNewSimdHWIntrinsicNode(var_types type,
1794017954
GenTree* op3,
1794117955
NamedIntrinsic hwIntrinsicID,
1794217956
var_types baseType,
17943-
unsigned size,
17944-
var_types srcType)
17957+
unsigned size)
1794517958
{
1794617959
SetOpLclRelatedToSIMDIntrinsic(op1);
1794717960
SetOpLclRelatedToSIMDIntrinsic(op2);

src/jit/gentree.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4227,12 +4227,7 @@ struct GenTreeSIMD : public GenTreeJitIntrinsic
42274227
#ifdef FEATURE_HW_INTRINSICS
42284228
struct GenTreeHWIntrinsic : public GenTreeJitIntrinsic
42294229
{
4230-
42314230
NamedIntrinsic gtHWIntrinsicId;
4232-
var_types gtSrcOneType;
4233-
var_types gtSrcTwoType;
4234-
4235-
public:
42364231

42374232
GenTreeHWIntrinsic(var_types type, NamedIntrinsic hwIntrinsicID, var_types baseType, unsigned size)
42384233
: GenTreeJitIntrinsic(GT_HWIntrinsic, type, nullptr, nullptr, baseType, size), gtHWIntrinsicId(hwIntrinsicID)

0 commit comments

Comments
 (0)