diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 727bd26369c..e3f9e0dc609 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -5481,6 +5481,22 @@ validateInstruction(MCInst &Inst, "writeback register not allowed in register list"); break; } + case ARM::sysLDMIA_UPD: + case ARM::sysLDMDA_UPD: + case ARM::sysLDMDB_UPD: + case ARM::sysLDMIB_UPD: + if (!listContainsReg(Inst, 3, ARM::PC)) + return Error(Operands[4]->getStartLoc(), + "writeback register only allowed on system LDM " + "if PC in register-list"); + break; + case ARM::sysSTMIA_UPD: + case ARM::sysSTMDA_UPD: + case ARM::sysSTMDB_UPD: + case ARM::sysSTMIB_UPD: + return Error(Operands[2]->getStartLoc(), + "system STM cannot have writeback register"); + break; case ARM::tMUL: { // The second source operand must be the same register as the destination // operand. diff --git a/test/MC/ARM/diagnostics.s b/test/MC/ARM/diagnostics.s index 11c8306b1d7..3c26f6d645c 100644 --- a/test/MC/ARM/diagnostics.s +++ b/test/MC/ARM/diagnostics.s @@ -460,3 +460,8 @@ @ CHECK-ERRORS: error: instruction requires: FPARMv8 @ CHECK-ERRORS: error: instruction requires: FPARMv8 @ CHECK-ERRORS: error: instruction requires: FPARMv8 + + stm sp!, {r0, pc}^ + ldm sp!, {r0}^ +@ CHECK-ERRORS: error: system STM cannot have writeback register +@ CHECK-ERRORS: error: writeback register only allowed on system LDM if PC in register-list