aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2013-12-01 10:45:26 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2013-12-01 10:45:26 +0000
commit88fc0183be1b1fc94375421c48f8e0ef6fa9139e (patch)
treeb8c7327ef35fafc7f0013c111a1a39f9753d6bb3 /lib/Target
parentd0cf77ad590633c0e10336e4c59b509140328042 (diff)
downloadexternal_llvm-88fc0183be1b1fc94375421c48f8e0ef6fa9139e.zip
external_llvm-88fc0183be1b1fc94375421c48f8e0ef6fa9139e.tar.gz
external_llvm-88fc0183be1b1fc94375421c48f8e0ef6fa9139e.tar.bz2
Merged from r195975 and r195976.
------------------------------------------------------------------------ r195975 | zjovanovic | 2013-11-30 19:12:28 +0000 (Sat, 30 Nov 2013) | 1 line Fixed issue with microMIPS long branch. ------------------------------------------------------------------------ r195976 | zjovanovic | 2013-11-30 19:13:15 +0000 (Sat, 30 Nov 2013) | 1 line Test case for issue with microMIPS long branch. ------------------------------------------------------------------------ To expand on those commit messages: The immediate in a MIPS branch is multiplied by the instruction size before use as an offset. For many MIPS ISA's this is 4 bytes, but for microMIPS it is 2 bytes. This commit corrects the scale factor used for microMIPS so that attempts to use large offsets result in a valid sequence of instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@196043 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-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 ea8cc80..2efe578 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;