summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsLongBranch.cpp
diff options
context:
space:
mode:
authorZoran Jovanovic <zoran.jovanovic@imgtec.com>2013-11-29 21:41:24 +0000
committerZoran Jovanovic <zoran.jovanovic@imgtec.com>2013-11-29 21:41:24 +0000
commitee7f913c98ab4fedc58e8f7e4b03c35acfc6ead1 (patch)
tree7f0b6296ee6980e30087affb9502a55677465fbf /lib/Target/Mips/MipsLongBranch.cpp
parenteb5a560e0026ddaa33b26675d1d70148a3c0ad82 (diff)
downloadllvm-ee7f913c98ab4fedc58e8f7e4b03c35acfc6ead1.tar.gz
llvm-ee7f913c98ab4fedc58e8f7e4b03c35acfc6ead1.tar.bz2
llvm-ee7f913c98ab4fedc58e8f7e4b03c35acfc6ead1.tar.xz
Fixed issue with microMIPS long branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsLongBranch.cpp')
-rw-r--r--lib/Target/Mips/MipsLongBranch.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Target/Mips/MipsLongBranch.cpp b/lib/Target/Mips/MipsLongBranch.cpp
index ea8cc80283..2efe57847a 100644
--- a/lib/Target/Mips/MipsLongBranch.cpp
+++ b/lib/Target/Mips/MipsLongBranch.cpp
@@ -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;