Skip to content

Commit e75ba7f

Browse files
committed
Try to reduce the cost for compressed displacement support
1 parent 26c77e6 commit e75ba7f

File tree

8 files changed

+439
-414
lines changed

8 files changed

+439
-414
lines changed

src/coreclr/jit/codegenxarch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9531,7 +9531,7 @@ void CodeGen::genAmd64EmitterUnitTestsAvx10v2()
95319531

95329532
theEmitter->emitIns_R_R(INS_vcvttps2ibs, EA_16BYTE, REG_XMM0, REG_XMM1);
95339533
theEmitter->emitIns_R_R(INS_vcvttps2ibs, EA_32BYTE, REG_XMM0, REG_XMM1);
9534-
theEmitter->emitIns_R_R(INS_vcvttps2ibs, EA_32BYTE, REG_XMM0, REG_XMM1, INS_OPTS_EVEX_eb_er_rd);
9534+
theEmitter->emitIns_R_R(INS_vcvttps2ibs, EA_32BYTE, REG_XMM0, REG_XMM1, INS_OPTS_EVEX_er_rd);
95359535
theEmitter->emitIns_R_R(INS_vcvttps2ibs, EA_64BYTE, REG_XMM0, REG_XMM1);
95369536

95379537
theEmitter->emitIns_R_R(INS_vcvttps2iubs, EA_16BYTE, REG_XMM0, REG_XMM1);

src/coreclr/jit/emit.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -844,9 +844,7 @@ class emitter
844844
unsigned _idCustom5 : 1;
845845
unsigned _idCustom6 : 1;
846846

847-
#define _idEvexbContext \
848-
(_idCustom6 << 1) | _idCustom5 /* Evex.b: embedded broadcast, embedded rounding, embedded SAE \
849-
*/
847+
#define _idEvexbContext (_idCustom6 << 1) | _idCustom5 /* Evex.b: embedded broadcast, rounding, SAE */
850848
#define _idEvexNdContext _idCustom5 /* bits used for the APX-EVEX.nd context for promoted legacy instructions */
851849
#define _idEvexNfContext _idCustom6 /* bits used for the APX-EVEX.nf context for promoted legacy/vex instructions */
852850

@@ -1734,10 +1732,21 @@ class emitter
17341732
return idGetEvexbContext() != 0;
17351733
}
17361734

1735+
void idSetEvexBroadcastBit()
1736+
{
1737+
assert(!idIsEvexbContextSet());
1738+
_idCustom5 = 1;
1739+
}
1740+
1741+
void idSetEvexCompressedDisplacementBit()
1742+
{
1743+
assert(_idCustom6 == 0);
1744+
_idCustom6 = 1;
1745+
}
1746+
17371747
void idSetEvexbContext(insOpts instOptions)
17381748
{
17391749
assert(!idIsEvexbContextSet());
1740-
assert(idGetEvexbContext() == 0);
17411750
unsigned value = static_cast<unsigned>(instOptions & INS_OPTS_EVEX_b_MASK);
17421751

17431752
_idCustom5 = ((value >> 0) & 1);
@@ -4164,7 +4173,7 @@ emitAttr emitter::emitGetMemOpSize(instrDesc* id, bool ignoreEmbeddedBroadcast)
41644173
else if (tupleType == INS_TT_FULL)
41654174
{
41664175
// Embedded broadcast supported, so either loading scalar or full vector
4167-
if (id->idIsEvexbContextSet() && !ignoreEmbeddedBroadcast)
4176+
if (!ignoreEmbeddedBroadcast && HasEmbeddedBroadcast(id))
41684177
{
41694178
memSize = GetInputSizeInBytes(id);
41704179
}
@@ -4183,7 +4192,7 @@ emitAttr emitter::emitGetMemOpSize(instrDesc* id, bool ignoreEmbeddedBroadcast)
41834192
{
41844193
memSize = 16;
41854194
}
4186-
else if (id->idIsEvexbContextSet() && !ignoreEmbeddedBroadcast)
4195+
else if (!ignoreEmbeddedBroadcast && HasEmbeddedBroadcast(id))
41874196
{
41884197
memSize = GetInputSizeInBytes(id);
41894198
}
@@ -4195,7 +4204,7 @@ emitAttr emitter::emitGetMemOpSize(instrDesc* id, bool ignoreEmbeddedBroadcast)
41954204
else if (tupleType == INS_TT_HALF)
41964205
{
41974206
// Embedded broadcast supported, so either loading scalar or half vector
4198-
if (id->idIsEvexbContextSet() && !ignoreEmbeddedBroadcast)
4207+
if (!ignoreEmbeddedBroadcast && HasEmbeddedBroadcast(id))
41994208
{
42004209
memSize = GetInputSizeInBytes(id);
42014210
}

0 commit comments

Comments
 (0)