[llvm] r193705 - [ARM] NEON instructions were erroneously decoded from certain invalid encodings

Artyom Skrobov Artyom.Skrobov at arm.com
Wed Oct 30 11:10:09 PDT 2013


Author: askrobov
Date: Wed Oct 30 13:10:09 2013
New Revision: 193705

URL: http://llvm.org/viewvc/llvm-project?rev=193705&view=rev
Log:
[ARM] NEON instructions were erroneously decoded from certain invalid encodings

Modified:
    llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
    llvm/trunk/test/MC/Disassembler/ARM/thumb-neon-crypto.txt

Modified: llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp?rev=193705&r1=193704&r2=193705&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp Wed Oct 30 13:10:09 2013
@@ -829,28 +829,28 @@ DecodeStatus ThumbDisassembler::getInstr
       Check(result, AddThumbPredicate(MI));
       return result;
     }
-  }
 
-  MI.clear();
-  uint32_t NEONCryptoInsn = insn32;
-  NEONCryptoInsn &= 0xF0FFFFFF; // Clear bits 27-24
-  NEONCryptoInsn |= (NEONCryptoInsn & 0x10000000) >> 4; // Move bit 28 to bit 24
-  NEONCryptoInsn |= 0x12000000; // Set bits 28 and 25
-  result = decodeInstruction(DecoderTablev8Crypto32, MI, NEONCryptoInsn,
-                             Address, this, STI);
-  if (result != MCDisassembler::Fail) {
-    Size = 4;
-    return result;
-  }
+    MI.clear();
+    uint32_t NEONCryptoInsn = insn32;
+    NEONCryptoInsn &= 0xF0FFFFFF; // Clear bits 27-24
+    NEONCryptoInsn |= (NEONCryptoInsn & 0x10000000) >> 4; // Move bit 28 to bit 24
+    NEONCryptoInsn |= 0x12000000; // Set bits 28 and 25
+    result = decodeInstruction(DecoderTablev8Crypto32, MI, NEONCryptoInsn,
+                               Address, this, STI);
+    if (result != MCDisassembler::Fail) {
+      Size = 4;
+      return result;
+    }
 
-  MI.clear();
-  uint32_t NEONv8Insn = insn32;
-  NEONv8Insn &= 0xF3FFFFFF; // Clear bits 27-26
-  result = decodeInstruction(DecoderTablev8NEON32, MI, NEONv8Insn, Address,
-                             this, STI);
-  if (result != MCDisassembler::Fail) {
-    Size = 4;
-    return result;
+    MI.clear();
+    uint32_t NEONv8Insn = insn32;
+    NEONv8Insn &= 0xF3FFFFFF; // Clear bits 27-26
+    result = decodeInstruction(DecoderTablev8NEON32, MI, NEONv8Insn, Address,
+                               this, STI);
+    if (result != MCDisassembler::Fail) {
+      Size = 4;
+      return result;
+    }
   }
 
   MI.clear();

Modified: llvm/trunk/test/MC/Disassembler/ARM/thumb-neon-crypto.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM/thumb-neon-crypto.txt?rev=193705&r1=193704&r2=193705&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/ARM/thumb-neon-crypto.txt (original)
+++ llvm/trunk/test/MC/Disassembler/ARM/thumb-neon-crypto.txt Wed Oct 30 13:10:09 2013
@@ -33,3 +33,11 @@
 
 0xe0 0xef 0xa1 0x0e
 # CHECK: vmull.p64  q8, d16, d17
+
+# This used to be incorrectly decoded into an sha256h.32 [0x00,0xff,0x40,0x0c]
+# The other similar encodings are stc2 [0x00,0xfd,0x40,0x0c] and cdp2 [0x00,0xfe,0x40,0x0c]
+0x00 0xfc 0x40 0x0c
+# CHECK-NOT: sha256h.32
+# CHECK-NOT: stc2
+# CHECK-NOT: cdp2
+





More information about the llvm-commits mailing list