@@ -2849,6 +2849,12 @@ void emitter::emitInsLoadInd(instruction ins, emitAttr attr, regNumber dstReg, G
2849
2849
id->idReg1 (dstReg);
2850
2850
emitHandleMemOp (mem, id, IF_RWR_ARD, ins);
2851
2851
UNATIVE_OFFSET sz = emitInsSizeAM (id, insCodeRM (ins));
2852
+ if (Is4ByteSSEInstruction (ins))
2853
+ {
2854
+ // The 4-Byte SSE instructions require an additional byte.
2855
+ sz += 1 ;
2856
+ }
2857
+
2852
2858
id->idCodeSize (sz);
2853
2859
dispIns (id);
2854
2860
emitCurIGsize += sz;
@@ -4037,6 +4043,12 @@ void emitter::emitIns_R_A(instruction ins, emitAttr attr, regNumber reg1, GenTre
4037
4043
emitHandleMemOp (indir, id, IF_RRW_ARD, ins);
4038
4044
4039
4045
UNATIVE_OFFSET sz = emitInsSizeAM (id, insCodeRM (ins));
4046
+ if (Is4ByteSSEInstruction (ins))
4047
+ {
4048
+ // The 4-Byte SSE instructions require an additional byte.
4049
+ sz += 1 ;
4050
+ }
4051
+
4040
4052
id->idCodeSize (sz);
4041
4053
4042
4054
dispIns (id);
@@ -4088,8 +4100,8 @@ void emitter::emitIns_R_AR_I(instruction ins, emitAttr attr, regNumber reg1, reg
4088
4100
4089
4101
if (Is4ByteSSEInstruction (ins))
4090
4102
{
4091
- // The 4-Byte SSE instructions require two additional bytes
4092
- sz += 2 ;
4103
+ // The 4-Byte SSE instructions require an additional byte.
4104
+ sz += 1 ;
4093
4105
}
4094
4106
4095
4107
id->idCodeSize (sz);
@@ -5165,8 +5177,8 @@ void emitter::emitIns_R_AR(instruction ins, emitAttr attr, regNumber ireg, regNu
5165
5177
5166
5178
if (Is4ByteSSEInstruction (ins))
5167
5179
{
5168
- // The 4-Byte SSE instructions require two additional bytes
5169
- sz += 2 ;
5180
+ // The 4-Byte SSE instructions require an additional byte.
5181
+ sz += 1 ;
5170
5182
}
5171
5183
5172
5184
id->idCodeSize (sz);
@@ -5640,7 +5652,7 @@ void emitter::emitIns_AX_R(instruction ins, emitAttr attr, regNumber ireg, regNu
5640
5652
5641
5653
#ifdef FEATURE_HW_INTRINSICS
5642
5654
// ------------------------------------------------------------------------
5643
- // emitIns_SIMD_R_R_I: emits the code for a SIMD instruction that takes a register operand, an immediate operand
5655
+ // emitIns_SIMD_R_R_I: emits the code for an instruction that takes a register operand, an immediate operand
5644
5656
// and that returns a value in register
5645
5657
//
5646
5658
// Arguments:
@@ -5650,6 +5662,13 @@ void emitter::emitIns_AX_R(instruction ins, emitAttr attr, regNumber ireg, regNu
5650
5662
// op1Reg -- The register of the first operand
5651
5663
// ival -- The immediate value
5652
5664
//
5665
+ // Notes:
5666
+ // This will handle the required register copy if 'op1Reg' and 'targetReg' are not the same, and
5667
+ // the 3-operand format is not available.
5668
+ // This is not really SIMD-specific, but is currently only used in that context, as that's
5669
+ // where we frequently need to handle the case of generating 3-operand or 2-operand forms
5670
+ // depending on what target ISA is supported.
5671
+ //
5653
5672
void emitter::emitIns_SIMD_R_R_I (instruction ins, emitAttr attr, regNumber targetReg, regNumber op1Reg, int ival)
5654
5673
{
5655
5674
if (UseVEXEncoding () || IsDstSrcImmAvxInstruction (ins))
@@ -5704,20 +5723,22 @@ void emitter::emitIns_SIMD_R_R_A(
5704
5723
// targetReg -- The target register
5705
5724
// op1Reg -- The register of the first operand
5706
5725
// base -- The base register used for the memory address
5726
+ // offset -- The memory offset
5707
5727
//
5708
- void emitter::emitIns_SIMD_R_R_AR (instruction ins, emitAttr attr, regNumber targetReg, regNumber op1Reg, regNumber base)
5728
+ void emitter::emitIns_SIMD_R_R_AR (
5729
+ instruction ins, emitAttr attr, regNumber targetReg, regNumber op1Reg, regNumber base, int offset)
5709
5730
{
5710
5731
if (UseVEXEncoding ())
5711
5732
{
5712
- emitIns_R_R_AR (ins, attr, targetReg, op1Reg, base, 0 );
5733
+ emitIns_R_R_AR (ins, attr, targetReg, op1Reg, base, offset );
5713
5734
}
5714
5735
else
5715
5736
{
5716
5737
if (op1Reg != targetReg)
5717
5738
{
5718
5739
emitIns_R_R (INS_movaps, attr, targetReg, op1Reg);
5719
5740
}
5720
- emitIns_R_AR (ins, attr, targetReg, base, 0 );
5741
+ emitIns_R_AR (ins, attr, targetReg, base, offset );
5721
5742
}
5722
5743
}
5723
5744
0 commit comments