[mips] Handle branch expansion corner cases
authorAleksandar Beserminji <abeserminji@wavecomp.com>
Tue, 7 Aug 2018 10:45:45 +0000 (10:45 +0000)
committerAleksandar Beserminji <abeserminji@wavecomp.com>
Tue, 7 Aug 2018 10:45:45 +0000 (10:45 +0000)
commit949a17c016e76173a4df30a307c5787da37e839f
tree071b2920e643741f7274ca946e8f8e77ed09c4af
parentc2e9926549db476207a2231dd5b6ecb69339e2c9
[mips] Handle branch expansion corner cases

When potential jump instruction and target are in the same segment, use
jump instruction with immediate field.

In cases where offset does not fit immediate value of a bc/j instructions,
offset is stored into register, and then jump register instruction is used.

Differential Revision: https://reviews.llvm.org/D48019

llvm-svn: 339126
llvm/lib/Target/Mips/MipsBranchExpansion.cpp
llvm/lib/Target/Mips/MipsInstrInfo.cpp
llvm/test/CodeGen/Mips/longbranch/long-branch-expansion-1.ll [new file with mode: 0644]
llvm/test/CodeGen/Mips/longbranch/long-branch-expansion-2.ll [new file with mode: 0644]
llvm/test/CodeGen/Mips/longbranch/long-branch-expansion-3.ll [new file with mode: 0644]