Skip to content

Commit

Permalink
[MC][ARM] Fix number of operands of tMOVSr
Browse files Browse the repository at this point in the history
Differential revision: https://reviews.llvm.org/D92029
  • Loading branch information
eleviant committed Nov 24, 2020
1 parent a8de412 commit a6a6d11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Expand Up @@ -10309,11 +10309,14 @@ bool ARMAsmParser::processInstruction(MCInst &Inst,
!HasWideQualifier) {
// The operands aren't the same for tMOV[S]r... (no cc_out)
MCInst TmpInst;
TmpInst.setOpcode(Inst.getOperand(4).getReg() ? ARM::tMOVSr : ARM::tMOVr);
unsigned Op = Inst.getOperand(4).getReg() ? ARM::tMOVSr : ARM::tMOVr;
TmpInst.setOpcode(Op);
TmpInst.addOperand(Inst.getOperand(0));
TmpInst.addOperand(Inst.getOperand(1));
TmpInst.addOperand(Inst.getOperand(2));
TmpInst.addOperand(Inst.getOperand(3));
if (Op == ARM::tMOVr) {
TmpInst.addOperand(Inst.getOperand(2));
TmpInst.addOperand(Inst.getOperand(3));
}
Inst = TmpInst;
return true;
}
Expand Down
6 changes: 6 additions & 0 deletions llvm/test/MC/ARM/tMOVSr.s
@@ -0,0 +1,6 @@
@ REQUIRES: asserts
@ RUN: llvm-mc --triple=thumbv8 --debug %s 2>&1 | FileCheck %s --match-full-lines

@ CHECK: Changed to: <MCInst #{{[0-9]+}} tMOVSr <MCOperand Reg:{{[0-9]+}}> <MCOperand Reg:{{[0-9]+}}>>
.text
movs r2, r3

0 comments on commit a6a6d11

Please sign in to comment.