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

Commit 3f1705c

Browse files
committed
Add emitIns_AR_R_I for vextracti/f128
1 parent c4544d4 commit 3f1705c

5 files changed

+72
-3
lines changed

src/jit/emitfmtsxarch.h

+4
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ IF_DEF(MRD_CNS, IS_GM_RD, DSP_CNS) // read [mem], const
139139
IF_DEF(MWR_CNS, IS_GM_WR, DSP_CNS) // write [mem], const
140140
IF_DEF(MRW_CNS, IS_GM_RW, DSP_CNS) // r/w [mem], const
141141

142+
IF_DEF(MWR_RRD_CNS, IS_GM_WR|IS_R1_RD, DSP_CNS) // write [mem] , read reg, const
143+
142144
IF_DEF(MRW_SHF, IS_GM_RW, DSP_CNS) // shift [mem], const
143145

144146
//----------------------------------------------------------------------------
@@ -194,6 +196,8 @@ IF_DEF(ARD_CNS, IS_AM_RD, AMD_CNS) // read [adr], const
194196
IF_DEF(AWR_CNS, IS_AM_WR, AMD_CNS) // write [adr], const
195197
IF_DEF(ARW_CNS, IS_AM_RW, AMD_CNS) // r/w [adr], const
196198

199+
IF_DEF(AWR_RRD_CNS, IS_AM_WR, AMD_CNS) // write [adr], reg, const
200+
197201
IF_DEF(ARW_SHF, IS_AM_RW, AMD_CNS) // shift [adr], const
198202

199203

src/jit/emitxarch.cpp

+64
Original file line numberDiff line numberDiff line change
@@ -2730,6 +2730,9 @@ emitter::insFormat emitter::emitMapFmtAtoM(insFormat fmt)
27302730
case IF_ARW_CNS:
27312731
return IF_MRW_CNS;
27322732

2733+
case IF_AWR_RRD_CNS:
2734+
return IF_MWR_RRD_CNS;
2735+
27332736
case IF_ARW_SHF:
27342737
return IF_MRW_SHF;
27352738

@@ -5067,6 +5070,31 @@ void emitter::emitIns_AR_R(instruction ins, emitAttr attr, regNumber ireg, regNu
50675070
emitAdjustStackDepthPushPop(ins);
50685071
}
50695072

5073+
#ifndef LEGACY_BACKEND
5074+
void emitter::emitIns_AR_R_I(instruction ins, emitAttr attr, regNumber base, int disp, regNumber ireg, int ival)
5075+
{
5076+
assert(ins == INS_vextracti128 || ins == INS_vextractf128);
5077+
assert(base != REG_NA);
5078+
assert(ireg != REG_NA);
5079+
UNATIVE_OFFSET sz;
5080+
instrDesc* id = emitNewInstrAmdCns(attr, disp, ival);
5081+
5082+
id->idIns(ins);
5083+
id->idInsFmt(IF_AWR_RRD_CNS);
5084+
id->idAddr()->iiaAddrMode.amBaseReg = base;
5085+
id->idAddr()->iiaAddrMode.amIndxReg = REG_NA;
5086+
id->idReg1(ireg);
5087+
5088+
assert(emitGetInsAmdAny(id) == disp); // make sure "disp" is stored properly
5089+
5090+
sz = 6;
5091+
id->idCodeSize(sz);
5092+
5093+
dispIns(id);
5094+
emitCurIGsize += sz;
5095+
}
5096+
#endif
5097+
50705098
void emitter::emitIns_AI_R(instruction ins, emitAttr attr, regNumber ireg, ssize_t disp)
50715099
{
50725100
UNATIVE_OFFSET sz;
@@ -7790,6 +7818,32 @@ void emitter::emitDispIns(
77907818
break;
77917819
}
77927820

7821+
case IF_AWR_RRD_CNS:
7822+
case IF_MWR_RRD_CNS:
7823+
{
7824+
assert(ins == INS_vextracti128 || ins == INS_vextractf128);
7825+
sstr = codeGen->genSizeStr(EA_ATTR(16));
7826+
printf(sstr);
7827+
emitDispAddrMode(id);
7828+
printf(", %s", emitRegName(id->idReg1(), attr));
7829+
7830+
emitGetInsAmdCns(id, &cnsVal);
7831+
7832+
val = cnsVal.cnsVal;
7833+
printf(", ");
7834+
7835+
if (cnsVal.cnsReloc)
7836+
{
7837+
emitDispReloc(val);
7838+
}
7839+
else
7840+
{
7841+
goto PRINT_CONSTANT;
7842+
}
7843+
7844+
break;
7845+
}
7846+
77937847
case IF_RWR_RRD_ARD:
77947848
printf("%s, %s, %s", emitRegName(id->idReg1(), attr), emitRegName(id->idReg2(), attr), sstr);
77957849
emitDispAddrMode(id);
@@ -12218,6 +12272,16 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp)
1221812272
sz = emitSizeOfInsDsc(id);
1221912273
break;
1222012274

12275+
case IF_AWR_RRD_CNS:
12276+
case IF_MWR_RRD_CNS:
12277+
assert(ins == INS_vextracti128 || ins == INS_vextractf128);
12278+
assert(UseVEXEncoding());
12279+
emitGetInsAmdCns(id, &cnsVal);
12280+
code = insCodeMR(ins);
12281+
dst = emitOutputAM(dst, id, code, &cnsVal);
12282+
sz = emitSizeOfInsDsc(id);
12283+
break;
12284+
1222112285
case IF_RRD_ARD:
1222212286
case IF_RWR_ARD:
1222312287
case IF_RRW_ARD:

src/jit/emitxarch.h

+1
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ void emitIns_R_R_A_I(
416416
instruction ins, emitAttr attr, regNumber reg1, regNumber reg2, GenTreeIndir* indir, int ival, insFormat fmt);
417417
void emitIns_R_R_AR_I(
418418
instruction ins, emitAttr attr, regNumber reg1, regNumber reg2, regNumber base, int offs, int ival);
419+
void emitIns_AR_R_I(instruction ins, emitAttr attr, regNumber base, int disp, regNumber ireg, int ival);
419420
#endif // !LEGACY_BACKEND
420421

421422
void emitIns_R_R_C_I(

src/jit/hwintrinsiccodegenxarch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
14731473
{
14741474
if (intrinsicID == NI_AVX_ExtractVector128 || intrinsicID == NI_AVX2_ExtractVector128)
14751475
{
1476-
emit->emitIns_R_AR_I(ins, attr, op2Reg, op1Reg, 0, (int)i);
1476+
emit->emitIns_AR_R_I(ins, attr, op1Reg, 0, op2Reg, (int)i);
14771477
}
14781478
else if (op2->TypeGet() == TYP_I_IMPL)
14791479
{

src/jit/instrsxarch.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ INST3( vpbroadcastb, "pbroadcastb" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SS
474474
INST3( vpbroadcastw, "pbroadcastw" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x79)) // Broadcast int16 value from reg/memory to entire ymm register
475475
INST3( vpbroadcastd, "pbroadcastd" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x58)) // Broadcast int32 value from reg/memory to entire ymm register
476476
INST3( vpbroadcastq, "pbroadcastq" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x59)) // Broadcast int64 value from reg/memory to entire ymm register
477-
INST3( vextractf128, "extractf128" , 0, IUM_WR, 0, 0, SSE3A(0x19), BAD_CODE, SSE3A(0x19)) // Extract 128-bit packed floating point values
478-
INST3( vextracti128, "extracti128" , 0, IUM_WR, 0, 0, SSE3A(0x39), BAD_CODE, SSE3A(0x39)) // Extract 128-bit packed integer values
477+
INST3( vextractf128, "extractf128" , 0, IUM_WR, 0, 0, SSE3A(0x19), BAD_CODE, BAD_CODE) // Extract 128-bit packed floating point values
478+
INST3( vextracti128, "extracti128" , 0, IUM_WR, 0, 0, SSE3A(0x39), BAD_CODE, BAD_CODE) // Extract 128-bit packed integer values
479479
INST3( vinsertf128, "insertf128" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE3A(0x18)) // Insert 128-bit packed floating point values
480480
INST3( vinserti128, "inserti128" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE3A(0x38)) // Insert 128-bit packed integer values
481481
INST3( vzeroupper, "zeroupper" , 0, IUM_WR, 0, 0, 0xC577F8, BAD_CODE, BAD_CODE) // Zero upper 128-bits of all YMM regs (includes 2-byte fixed VEX prefix)

0 commit comments

Comments
 (0)