Fixed issue with microMIPS long branch.
authorZoran Jovanovic <zoran.jovanovic@imgtec.com>
Sat, 30 Nov 2013 19:12:28 +0000 (19:12 +0000)
committerZoran Jovanovic <zoran.jovanovic@imgtec.com>
Sat, 30 Nov 2013 19:12:28 +0000 (19:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195975 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsLongBranch.cpp

index ea8cc802835e462e8bc6b845d34afb3c1bdff5a4..2efe57847add8f8db348b9b503247c58cf40aae5 100644 (file)
@@ -437,8 +437,10 @@ bool MipsLongBranch::runOnMachineFunction(MachineFunction &F) {
       if (!I->Br || I->HasLongBranch)
         continue;
 
+      int ShVal = TM.getSubtarget<MipsSubtarget>().inMicroMipsMode() ? 2 : 4;
+
       // Check if offset fits into 16-bit immediate field of branches.
-      if (!ForceLongBranch && isInt<16>(computeOffset(I->Br) / 4))
+      if (!ForceLongBranch && isInt<16>(computeOffset(I->Br) / ShVal))
         continue;
 
       I->HasLongBranch = true;