Skip to content

Commit f1f9934

Browse files
Normalize immediates in arm32 add/sub (#116711)
1 parent d46c447 commit f1f9934

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/coreclr/jit/codegenarm.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ bool CodeGen::genInstrWithConstant(
6161
{
6262
case INS_add:
6363
case INS_sub:
64+
if (imm < 0)
65+
{
66+
imm = -imm;
67+
ins = (ins == INS_add) ? INS_sub : INS_add;
68+
}
6469
immFitsInIns = validImmForInstr(ins, (target_ssize_t)imm, flags);
6570
break;
6671

0 commit comments

Comments
 (0)