diff options
| author | Strahinja Petrovic <strahinja.petrovic@rt-rk.com> | 2017-03-23 13:40:07 +0000 |
|---|---|---|
| committer | Strahinja Petrovic <strahinja.petrovic@rt-rk.com> | 2017-03-23 13:40:07 +0000 |
| commit | f9fa62e576d63bf7b1b9ecc9665f4c9ab654ce58 (patch) | |
| tree | 6a61033838043c2d3459d9115623d5de231551dc /llvm/lib/Target/Mips | |
| parent | 1f7e7d3d9389d0ee5d8f11f1183f15a7d8f5731e (diff) | |
| download | bcm5719-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.cpp | 19 |
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. |

