Split between non-reloc and reloc in IF_T2_N1 in src/jit/emitarm.cpp
authorEgor Chesakov <Egor.Chesakov@microsoft.com>
Thu, 23 Aug 2018 02:13:09 +0000 (19:13 -0700)
committerEgor Chesakov <Egor.Chesakov@microsoft.com>
Thu, 23 Aug 2018 18:27:31 +0000 (11:27 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/e40f3a38766b93e05d9e2760bc084085a3c3d642

src/coreclr/src/jit/emitarm.cpp

index b1b263b..280b07f 100644 (file)
@@ -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
         {