Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0] Arm64: Pass the small size accurately to emitIns_valid_imm_for_ldst_offset #92041

Merged
merged 5 commits into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,38 @@ bool CodeGen::genInstrWithConstant(instruction ins,
break;

case INS_strb:
assert(size == EA_1BYTE);
immFitsInIns = emitter::emitIns_valid_imm_for_ldst_offset(imm, EA_1BYTE);
break;

case INS_strh:
assert(size == EA_2BYTE);
immFitsInIns = emitter::emitIns_valid_imm_for_ldst_offset(imm, EA_2BYTE);
break;

case INS_str:
// reg1 is a source register for store instructions
assert(tmpReg != reg1); // regTmp can not match any source register
immFitsInIns = emitter::emitIns_valid_imm_for_ldst_offset(imm, size);
break;

case INS_ldrb:
case INS_ldrsb:
immFitsInIns = emitter::emitIns_valid_imm_for_ldst_offset(imm, EA_1BYTE);
break;

case INS_ldrh:
case INS_ldrsh:
immFitsInIns = emitter::emitIns_valid_imm_for_ldst_offset(imm, EA_2BYTE);
break;

case INS_ldrsw:
case INS_ldrb:
case INS_ldrh:
assert(size == EA_4BYTE);
immFitsInIns = emitter::emitIns_valid_imm_for_ldst_offset(imm, EA_4BYTE);
break;

case INS_ldr:
assert((size == EA_4BYTE) || (size == EA_8BYTE) || (size == EA_16BYTE));
immFitsInIns = emitter::emitIns_valid_imm_for_ldst_offset(imm, size);
break;

Expand Down