Add comments to the handling of opcode CPS3p to reject invalid instruction encoding,
authorJohnny Chen <johnny.chen@apple.com>
Thu, 24 Mar 2011 17:04:22 +0000 (17:04 +0000)
committerJohnny Chen <johnny.chen@apple.com>
Thu, 24 Mar 2011 17:04:22 +0000 (17:04 +0000)
a test case of invalid CPS3p encoding and one for invalid VLDMSDB due to regs out of range.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128220 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp
test/MC/Disassembler/ARM/invalid-CPS3p-arm.txt [new file with mode: 0644]
test/MC/Disassembler/ARM/invalid-VLDMSDB-arm.txt [new file with mode: 0644]

index cc2469f8c29d7dac186cb663b7d0a7cf87e93030..a9d41325de702deefa803ef50d32be9ea7772286 100644 (file)
@@ -2946,6 +2946,8 @@ static bool DisassembleMiscFrm(MCInst &MI, unsigned Opcode, uint32_t insn,
   // of optional arguments is implemented.
   if (Opcode == ARM::CPS3p) {
     // Let's reject impossible imod values by returning false.
+    // AsmPrinter cannot handle imod=0b00, plus (imod=0b00,M=1,iflags!=0) is an
+    // invalid combination, so we just check for imod=0b00 here.
     if (slice(insn, 19, 18) == 0 || slice(insn, 19, 18) == 1)
       return false;
     MI.addOperand(MCOperand::CreateImm(slice(insn, 19, 18))); // imod
diff --git a/test/MC/Disassembler/ARM/invalid-CPS3p-arm.txt b/test/MC/Disassembler/ARM/invalid-CPS3p-arm.txt
new file mode 100644 (file)
index 0000000..5202217
--- /dev/null
@@ -0,0 +1,4 @@
+# RUN: llvm-mc --disassemble %s -triple=arm-apple-darwin9 |& grep {invalid instruction encoding}
+
+# invalid (imod, M, iflags) combination
+0x93 0x1c 0x02 0xf1
diff --git a/test/MC/Disassembler/ARM/invalid-VLDMSDB-arm.txt b/test/MC/Disassembler/ARM/invalid-VLDMSDB-arm.txt
new file mode 100644 (file)
index 0000000..f57ddbc
--- /dev/null
@@ -0,0 +1,4 @@
+# RUN: llvm-mc --disassemble %s -triple=arm-apple-darwin9 |& grep {invalid instruction encoding}
+
+# core registers out of range
+0xa5 0xba 0x52 0xed