summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips
diff options
context:
space:
mode:
authorStrahinja Petrovic <strahinja.petrovic@rt-rk.com>2017-03-23 13:40:07 +0000
committerStrahinja Petrovic <strahinja.petrovic@rt-rk.com>2017-03-23 13:40:07 +0000
commitf9fa62e576d63bf7b1b9ecc9665f4c9ab654ce58 (patch)
tree6a61033838043c2d3459d9115623d5de231551dc /llvm/lib/Target/Mips
parent1f7e7d3d9389d0ee5d8f11f1183f15a7d8f5731e (diff)
downloadbcm5719-llvm-f9fa62e576d63bf7b1b9ecc9665f4c9ab654ce58.tar.gz
bcm5719-llvm-f9fa62e576d63bf7b1b9ecc9665f4c9ab654ce58.zip
[Mips] Emit the correct DINS variant
This patch fixes emitting of correct variant of DINS instruction. Differential Revision: https://reviews.llvm.org/D30988 llvm-svn: 298596
Diffstat (limited to 'llvm/lib/Target/Mips')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
index 8b81ffaa85c..5685f0426e9 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
@@ -111,18 +111,21 @@ static void LowerDins(MCInst& InstIn) {
assert(InstIn.getOperand(3).isImm());
int64_t size = InstIn.getOperand(3).getImm();
- if (size <= 32) {
- if (pos < 32) // DINS, do nothing
- return;
+ assert((pos + size) <= 64 &&
+ "DINS cannot have position plus size over 64");
+ if (pos < 32) {
+ if ((pos + size) > 0 && (pos + size) <= 32)
+ return; // DINS, do nothing
+ else if ((pos + size) > 32) {
+ //DINSM
+ InstIn.getOperand(3).setImm(size - 32);
+ InstIn.setOpcode(Mips::DINSM);
+ }
+ } else if ((pos + size) > 32 && (pos + size) <= 64) {
// DINSU
InstIn.getOperand(2).setImm(pos - 32);
InstIn.setOpcode(Mips::DINSU);
- return;
}
- // DINSM
- assert(pos < 32 && "DINS cannot have both size and pos > 32");
- InstIn.getOperand(3).setImm(size - 32);
- InstIn.setOpcode(Mips::DINSM);
}
// Fix a bad compact branch encoding for beqc/bnec.
OpenPOWER on IntegriCloud