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

Commit 0364e36

Browse files
committed
Implement more AVX/AVX2 intrinsics
1 parent 85d9900 commit 0364e36

File tree

5 files changed

+43
-17
lines changed

5 files changed

+43
-17
lines changed

src/jit/emitxarch.cpp

+20-15
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ bool emitter::IsDstDstSrcAVXInstruction(instruction ins)
224224
case INS_vinsertf128:
225225
case INS_vinserti128:
226226
case INS_vperm2i128:
227+
case INS_vperm2f128:
228+
case INS_vpermilpsvar:
229+
case INS_vpermilpdvar:
227230
case INS_vpsrlvd:
228231
case INS_vpsrlvq:
229232
case INS_vpsravd:
@@ -324,6 +327,7 @@ bool emitter::TakesVexPrefix(instruction ins)
324327
case INS_prefetcht2:
325328
case INS_sfence:
326329
case INS_vzeroupper:
330+
case INS_vzeroall:
327331
return false;
328332
default:
329333
break;
@@ -2556,7 +2560,8 @@ void emitter::emitIns(instruction ins)
25562560
ins == INS_sahf || ins == INS_stosb || ins == INS_stosd || ins == INS_stosp
25572561
#ifndef LEGACY_BACKEND
25582562
// These instructions take zero operands
2559-
|| ins == INS_vzeroupper || ins == INS_lfence || ins == INS_mfence || ins == INS_sfence
2563+
|| ins == INS_vzeroupper || ins == INS_vzeroall || ins == INS_lfence || ins == INS_mfence ||
2564+
ins == INS_sfence
25602565
#endif
25612566
);
25622567

@@ -2585,7 +2590,7 @@ void emitter::emitIns(instruction ins)
25852590

25862591
#ifndef LEGACY_BACKEND
25872592
// vzeroupper includes its 2-byte VEX prefix in its MR code.
2588-
assert((ins != INS_vzeroupper) || (sz == 3));
2593+
assert((ins != INS_vzeroupper) || (ins != INS_vzeroall) || (sz == 3));
25892594
#endif
25902595

25912596
insFormat fmt = IF_NONE;
@@ -4299,9 +4304,9 @@ void emitter::emitIns_R_R_C(
42994304
}
43004305

43014306
/*****************************************************************************
4302-
*
4303-
* Add an instruction with three register operands.
4304-
*/
4307+
*
4308+
* Add an instruction with three register operands.
4309+
*/
43054310

43064311
void emitter::emitIns_R_R_R(instruction ins, emitAttr attr, regNumber targetReg, regNumber reg1, regNumber reg2)
43074312
{
@@ -4423,16 +4428,16 @@ void emitter::emitIns_R_R_C_I(
44234428
}
44244429

44254430
/**********************************************************************************
4426-
* emitIns_R_R_R_I: Add an instruction with three register operands and an immediate.
4427-
*
4428-
* Arguments:
4429-
* ins - the instruction to add
4430-
* attr - the emitter attribute for instruction
4431-
* targetReg - the target (destination) register
4432-
* reg1 - the first source register
4433-
* reg2 - the second source register
4434-
* ival - the immediate value
4435-
*/
4431+
* emitIns_R_R_R_I: Add an instruction with three register operands and an immediate.
4432+
*
4433+
* Arguments:
4434+
* ins - the instruction to add
4435+
* attr - the emitter attribute for instruction
4436+
* targetReg - the target (destination) register
4437+
* reg1 - the first source register
4438+
* reg2 - the second source register
4439+
* ival - the immediate value
4440+
*/
44364441

44374442
void emitter::emitIns_R_R_R_I(
44384443
instruction ins, emitAttr attr, regNumber targetReg, regNumber reg1, regNumber reg2, int ival)

src/jit/hwintrinsiccodegenxarch.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
13181318
// to ensure that Bits MAXVL-1:128 are zeroed.
13191319

13201320
assert(op2 == nullptr);
1321-
regNumber op1Reg = op1->gtRegNum;
1321+
regNumber op1Reg = op1->gtRegNum;
13221322
emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD16), targetReg, op1Reg);
13231323
break;
13241324
}
@@ -1331,7 +1331,6 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
13311331

13321332
if (op1Reg != targetReg)
13331333
{
1334-
instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
13351334
emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD32), targetReg, op1Reg);
13361335
}
13371336
break;

0 commit comments

Comments
 (0)