From e40f3a38766b93e05d9e2760bc084085a3c3d642 Mon Sep 17 00:00:00 2001 From: Egor Chesakov Date: Wed, 22 Aug 2018 19:13:09 -0700 Subject: [PATCH] Split between non-reloc and reloc in IF_T2_N1 in src/jit/emitarm.cpp --- src/jit/emitarm.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/jit/emitarm.cpp b/src/jit/emitarm.cpp index b1b263b..280b07f 100644 --- a/src/jit/emitarm.cpp +++ b/src/jit/emitarm.cpp @@ -5382,27 +5382,31 @@ BYTE* emitter::emitOutputLJ(insGroup* ig, BYTE* dst, instrDesc* i) } else if (fmt == IF_T2_N1) { + assert(ins == INS_movt || ins == INS_movw); code |= insEncodeRegT2_D(id->idReg1()); - unsigned imm = distVal; - if (ins == INS_movw) - { - imm &= 0xffff; - } - else - { - imm = (imm >> 16) & 0xffff; - } ((instrDescJmp*)id)->idjTemp.idjAddr = (dstOffs > srcOffs) ? dst : NULL; - code |= insEncodeImmT2_Mov(imm); - dst += emitOutput_Thumb2Instr(dst, code); - - if (id->idIsCnsReloc() || id->idIsDspReloc()) + if (id->idIsReloc()) { - assert(ins == INS_movt || ins == INS_movw); + dst += emitOutput_Thumb2Instr(dst, code); if ((ins == INS_movt) && emitComp->info.compMatchedVM) emitHandlePCRelativeMov32((void*)(dst - 8), (void*)distVal); } + else + { + assert(sizeof(size_t) == sizeof(target_size_t)); + target_size_t imm = (target_size_t)distVal; + if (ins == INS_movw) + { + imm &= 0xffff; + } + else + { + imm = (imm >> 16) & 0xffff; + } + code |= insEncodeImmT2_Mov(imm); + dst += emitOutput_Thumb2Instr(dst, code); + } } else { -- 2.7.4