The autogened decoder was confusing the ARM STRBT for ARM USAT, because the .td
authorJohnny Chen <johnny.chen@apple.com>
Thu, 12 Aug 2010 01:40:54 +0000 (01:40 +0000)
committerJohnny Chen <johnny.chen@apple.com>
Thu, 12 Aug 2010 01:40:54 +0000 (01:40 +0000)
entry for ARM STRBT is actually a super-instruction for A8.6.199 STRBT A1 & A2.
Recover by looking for ARM:USAT encoding pattern before delegating to the auto-
gened decoder.

Added a "usat" test case to arm-tests.txt.

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

lib/Target/ARM/Disassembler/ARMDisassembler.cpp
lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp
test/MC/Disassembler/arm-tests.txt

index f9eecb8acb2738dd5b57e9bc1dfa2ba5fe7f0241..14acf80debf646291c5a51aa44b0151acf1d73e1 100644 (file)
@@ -26,6 +26,8 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 
+//#define DEBUG(X) do { X; } while (0)
+
 /// ARMGenDecoderTables.inc - ARMDecoderTables.inc is tblgen'ed from
 /// ARMDecoderEmitter.cpp TableGen backend.  It contains:
 ///
@@ -87,6 +89,11 @@ static unsigned decodeARMInstruction(uint32_t &insn) {
       return ARM::BFI;
   }
 
+  // Ditto for STRBT, which is a super-instruction for A8.6.199 Encoding A1 & A2.
+  // As a result, the decoder fails to deocode USAT properly.
+  if (slice(insn, 27, 21) == 0x37 && slice(insn, 5, 4) == 1)
+    return ARM::USAT;
+
   // Ditto for ADDSrs, which is a super-instruction for A8.6.7 & A8.6.8.
   // As a result, the decoder fails to decode UMULL properly.
   if (slice(insn, 27, 21) == 0x04 && slice(insn, 7, 4) == 9) {
index 39d7c5206447bf78ebe1fba320ce1152d8f94482..cb15cff734bb25dd8cf7a0698b5020bf2369d85e 100644 (file)
@@ -20,6 +20,8 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 
+//#define DEBUG(X) do { X; } while (0)
+
 /// ARMGenInstrInfo.inc - ARMGenInstrInfo.inc contains the static const
 /// TargetInstrDesc ARMInsts[] definition and the TargetOperandInfo[]'s
 /// describing the operand info for each ARMInsts[i].
index bd31d86cdca7aba7ce933859ddbd61a24682a043..bb5875d2f3412a317c6892948b72903d537aff6e 100644 (file)
@@ -97,3 +97,5 @@
 # CHECK:       ubfx    r0, r0, #16, #1
 0x50 0x08 0xe0 0xe7
 
+# CHECK:       usat    r8, #0, r10, asr #32
+0x5a 0x80 0xe0 0xe6