[PATCH] D46794: [mips] Add support for isBranchOffsetInRange and use it for MipsLongBranch

Aleksandar Beserminji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 14 08:39:45 PDT 2018


abeserminji added inline comments.


================
Comment at: lib/Target/Mips/MipsLongBranch.cpp:588
-      int ShVal = STI.inMicroMipsMode() ? 2 : 4;
-      int64_t Offset = computeOffset(I->Br) / ShVal;
 
----------------
sdardis wrote:
> abeserminji wrote:
> > If this part is removed, then the below estimation for the NaCl will be estimated several times more.
> Yes, but we're checking a wider / different range.
> 
> The old logic is testing if the encoded offset (i.e. we have right shifted the value) would fit in a 16 bit offset in the instruction.
> 
> The new logic is testing if the offset in bytes is in range of the branch instructions without the right shift.
> 
> |Offset:|           32| 32|
> |After shift step:|  8| NA|
> |NaCl adjustment:|  16| 64|
> |Test:|      isInt<16>| isInt<18>|
> 
Oh yes, it's true. I didn't connect these things immediately. 
Tnx for the explanation.


Repository:
  rL LLVM

https://reviews.llvm.org/D46794





More information about the llvm-commits mailing list