未验证 提交 1978fc29 编写于 作者: G github-actions[bot] 提交者: GitHub

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

* Pass the right size to check if immediate will fit or not

* Revert "Pass the right size to check if immediate will fit or not"

This reverts commit d7c511abce6634d65434a149e719c6f4516d6966.

* review feedback

* fix the size to be passed to the instruction

* fix the assert

---------
Co-authored-by: NKunal Pathak <Kunal.Pathak@microsoft.com>
上级 3aec9611
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册