diff options
author | Artyom Skrobov <Artyom.Skrobov@arm.com> | 2013-10-30 18:10:09 +0000 |
---|---|---|
committer | Artyom Skrobov <Artyom.Skrobov@arm.com> | 2013-10-30 18:10:09 +0000 |
commit | 3f04b5068619ca0411521c9871f4bfc6b04f951f (patch) | |
tree | 7a83b904b5a9bf38c7a1cc3d332e37ed428f4d2b | |
parent | aa1d078e7f42b605be03ff42d9b2e09923d3590d (diff) | |
download | external_llvm-3f04b5068619ca0411521c9871f4bfc6b04f951f.zip external_llvm-3f04b5068619ca0411521c9871f4bfc6b04f951f.tar.gz external_llvm-3f04b5068619ca0411521c9871f4bfc6b04f951f.tar.bz2 |
[ARM] NEON instructions were erroneously decoded from certain invalid encodings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193705 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/Disassembler/ARMDisassembler.cpp | 40 | ||||
-rw-r--r-- | test/MC/Disassembler/ARM/thumb-neon-crypto.txt | 8 |
2 files changed, 28 insertions, 20 deletions
diff --git a/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/lib/Target/ARM/Disassembler/ARMDisassembler.cpp index 5be1b69..cbf1429 100644 --- a/lib/Target/ARM/Disassembler/ARMDisassembler.cpp +++ b/lib/Target/ARM/Disassembler/ARMDisassembler.cpp @@ -829,28 +829,28 @@ DecodeStatus ThumbDisassembler::getInstruction(MCInst &MI, uint64_t &Size, 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(); diff --git a/test/MC/Disassembler/ARM/thumb-neon-crypto.txt b/test/MC/Disassembler/ARM/thumb-neon-crypto.txt index 30b5fb6..c725c7f 100644 --- a/test/MC/Disassembler/ARM/thumb-neon-crypto.txt +++ b/test/MC/Disassembler/ARM/thumb-neon-crypto.txt @@ -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 + |