Skip to content

Commit da3ef04

Browse files
AndyAyersMSCopilot
andcommitted
Fix remaining xarch size estimates
Correct x86 K-instruction prefix accounting and memory-source IMUL estimates exposed by checked CI runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b006801 commit da3ef04

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/coreclr/jit/emitxarch.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5244,11 +5244,13 @@ inline UNATIVE_OFFSET emitter::emitInsSizeRR(instrDesc* id)
52445244
sz += emitInsSize(id, insEncodeRMreg(id, code), includeRexPrefixSize);
52455245
}
52465246

5247+
#ifdef TARGET_AMD64
52475248
if (IsKInstruction(ins) && hasVexPrefix(code))
52485249
{
52495250
// K instructions add VEX before this helper; avoid counting the prefix once here and once in the adjustment.
52505251
sz -= emitGetVexPrefixSize(id);
52515252
}
5253+
#endif // TARGET_AMD64
52525254

52535255
if (HasRewrittenBuiltInRexPrefix(ins) && TakesRexWPrefix(id) && !TakesRex2Prefix(id))
52545256
{
@@ -5535,15 +5537,6 @@ UNATIVE_OFFSET emitter::emitInsSizeAM(instrDesc* id, code_t code)
55355537
size = 2;
55365538
}
55375539

5538-
#ifdef TARGET_AMD64
5539-
if (HasRewrittenBuiltInRexPrefix(ins) && TakesRexWPrefix(id) && !TakesRex2Prefix(id) &&
5540-
((reg != REG_NA) || (rgx != REG_NA)))
5541-
{
5542-
// The legacy 3-op IMUL opcodes carry a built-in REX byte that output rewrites from operand state.
5543-
size--;
5544-
}
5545-
#endif
5546-
55475540
size += emitGetAdjustedSize(id, code);
55485541

55495542
if (hasRexPrefix(code))

0 commit comments

Comments
 (0)