fix vextracti128 code-size
authorFei Peng <fei.peng@intel.com>
Fri, 23 Mar 2018 23:15:47 +0000 (16:15 -0700)
committerFei Peng <fei.peng@intel.com>
Tue, 27 Mar 2018 18:44:23 +0000 (11:44 -0700)
src/jit/emitxarch.cpp

index 094776b..cb79bf3 100644 (file)
@@ -5076,8 +5076,7 @@ void emitter::emitIns_AR_R_I(instruction ins, emitAttr attr, regNumber base, int
     assert(ins == INS_vextracti128 || ins == INS_vextractf128);
     assert(base != REG_NA);
     assert(ireg != REG_NA);
-    UNATIVE_OFFSET sz;
-    instrDesc*     id = emitNewInstrAmdCns(attr, disp, ival);
+    instrDesc* id = emitNewInstrAmdCns(attr, disp, ival);
 
     id->idIns(ins);
     id->idInsFmt(IF_AWR_RRD_CNS);
@@ -5087,8 +5086,8 @@ void emitter::emitIns_AR_R_I(instruction ins, emitAttr attr, regNumber base, int
 
     assert(emitGetInsAmdAny(id) == disp); // make sure "disp" is stored properly
 
-    // the code size of "vextracti/f128 [mem], ymm, imm8" is 6 byte
-    sz = 6;
+    // Plus one for the 1-byte immediate (ival)
+    UNATIVE_OFFSET sz = emitInsSizeAM(id, insCodeMR(ins)) + emitGetVexPrefixAdjustedSize(ins, attr, insCodeMR(ins)) + 1;
     id->idCodeSize(sz);
 
     dispIns(id);