[PATCH] [ARM] SSAT/USAT with an 'asr #32' shift should result in an undefined encoding rather than unpredictable

Bradley Smith bradley.smith at arm.com
Mon Jan 19 08:13:35 PST 2015


When disassembling a SSAT/USAT with an asr #32 shift the disassembler currently returns a SoftFail, this is incorrect since such an instruction encoding is undefined without the DSP extension, (in which case it maps to a different instruction), as such the disassembler should return Fail in this case.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7056

Files:
  lib/Target/ARM/Disassembler/ARMDisassembler.cpp
  test/MC/ARM/thumb2-diagnostics.s

Index: lib/Target/ARM/Disassembler/ARMDisassembler.cpp
===================================================================
--- lib/Target/ARM/Disassembler/ARMDisassembler.cpp
+++ lib/Target/ARM/Disassembler/ARMDisassembler.cpp
@@ -4971,7 +4971,7 @@
   DecodeStatus S = MCDisassembler::Success;
 
   // Shift of "asr #32" is not allowed in Thumb2 mode.
-  if (Val == 0x20) S = MCDisassembler::SoftFail;
+  if (Val == 0x20) S = MCDisassembler::Fail;
   Inst.addOperand(MCOperand::CreateImm(Val));
   return S;
 }
Index: test/MC/ARM/thumb2-diagnostics.s
===================================================================
--- test/MC/ARM/thumb2-diagnostics.s
+++ test/MC/ARM/thumb2-diagnostics.s
@@ -87,4 +87,7 @@
 @ CHECK-ERRORS: error: invalid operand for instruction
 @ CHECK-ERRORS: error: invalid operand for instruction
 
-
+ssat r0, #1, r0, asr #32
+usat r0, #1, r0, asr #32
+@ CHECK-ERRORS: error: 'asr #32' shift amount not allowed in Thumb mode
+@ CHECK-ERRORS: error: 'asr #32' shift amount not allowed in Thumb mode

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7056.18392.patch
Type: text/x-patch
Size: 1025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150119/c7acb955/attachment.bin>


More information about the llvm-commits mailing list