ARM: fix VCVT decoding
authorAmaury de la Vieuville <amaury.dlv@gmail.com>
Sat, 8 Jun 2013 13:29:11 +0000 (13:29 +0000)
committerAmaury de la Vieuville <amaury.dlv@gmail.com>
Sat, 8 Jun 2013 13:29:11 +0000 (13:29 +0000)
UNPRED was reported instead of UNDEF

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

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

index 824ffbf3386383969b23fd269a25302fa5c9ce0c..0b93f9105476e74aa3a226096881bf42e8ccea9e 100644 (file)
@@ -4441,7 +4441,7 @@ static DecodeStatus DecodeVCVTD(MCInst &Inst, unsigned Insn,
     return DecodeNEONModImmInstruction(Inst, Insn, Address, Decoder);
   }
 
-  if (!(imm & 0x20)) Check(S, MCDisassembler::SoftFail);
+  if (!(imm & 0x20)) return MCDisassembler::Fail;
 
   if (!Check(S, DecodeDPRRegisterClass(Inst, Vd, Address, Decoder)))
     return MCDisassembler::Fail;
@@ -4469,7 +4469,7 @@ static DecodeStatus DecodeVCVTQ(MCInst &Inst, unsigned Insn,
     return DecodeNEONModImmInstruction(Inst, Insn, Address, Decoder);
   }
 
-  if (!(imm & 0x20)) Check(S, MCDisassembler::SoftFail);
+  if (!(imm & 0x20)) return MCDisassembler::Fail;
 
   if (!Check(S, DecodeQPRRegisterClass(Inst, Vd, Address, Decoder)))
     return MCDisassembler::Fail;
diff --git a/test/MC/Disassembler/ARM/invalid-VCVT-arm.txt b/test/MC/Disassembler/ARM/invalid-VCVT-arm.txt
new file mode 100644 (file)
index 0000000..113507c
--- /dev/null
@@ -0,0 +1,8 @@
+# A8.8.307: VCVT (between floating-point and fixed-point, AdvSIMD)
+# imm6=0b0xxxxx -> UNDEFINED
+
+# RUN: echo "0x1e 0xcf 0x92 0xf3" | llvm-mc -disassemble -triple armv7 2>&1 | FileCheck %s
+
+# RUN: echo "0x3e 0xcf 0x92 0xf3" | llvm-mc -disassemble -triple armv7 2>&1 | FileCheck %s
+
+# CHECK: invalid instruction encoding