[PATCH] D66939: [ARM][MVE] Decoding of uqrshl and sqrshl accepts unpredictable encodings

Mark Murray via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 05:42:56 PDT 2019


MarkMurrayARM created this revision.
Herald added subscribers: llvm-commits, dmgreen, kristof.beyls, javed.absar.
Herald added a project: LLVM.

Specify the Unpredictable bits, and return softfails when appropriate.

Change-Id: I6831ed815f8e0e386925f1129bc45ffd7ec334b9


Repository:
  rL LLVM

https://reviews.llvm.org/D66939

Files:
  lib/Target/ARM/ARMInstrMVE.td
  lib/Target/ARM/Disassembler/ARMDisassembler.cpp
  test/MC/Disassembler/ARM/mve-scalar-shift-unpredictable.txt


Index: test/MC/Disassembler/ARM/mve-scalar-shift-unpredictable.txt
===================================================================
--- /dev/null
+++ test/MC/Disassembler/ARM/mve-scalar-shift-unpredictable.txt
@@ -0,0 +1,34 @@
+# RUN: llvm-mc -disassemble -triple=thumbv8.1m.main-none-eabi -mattr=+mve -show-encoding %s 2> %t | FileCheck --check-prefix=CHECK %s
+# RUN: FileCheck --check-prefix=STDERR < %t %s
+
+[0x5e 0xea 0x6d 0xcf]
+# CHECK: sqrshr  lr, r12  @ encoding: [0x5e,0xea,0x2d,0xcf]
+# STDERR: [[@LINE-2]]:2: warning: potentially undefined instruction encoding
+
+[0x5e 0xea 0xad 0xcf]
+# CHECK: sqrshr  lr, r12  @ encoding: [0x5e,0xea,0x2d,0xcf]
+# STDERR: [[@LINE-2]]:2: warning: potentially undefined instruction encoding
+
+[0x5e 0xea 0xed 0xcf]
+# CHECK: sqrshr  lr, r12  @ encoding: [0x5e,0xea,0x2d,0xcf]
+# STDERR: [[@LINE-2]]:2: warning: potentially undefined instruction encoding
+
+[0x5e 0xea 0x2d 0xce]
+# CHECK: sqrshr  lr, r12  @ encoding: [0x5e,0xea,0x2d,0xcf]
+# STDERR: [[@LINE-2]]:2: warning: potentially undefined instruction encoding
+
+[0x5e 0xea 0x4d 0xcf]
+# CHECK: uqrshl  lr, r12  @ encoding: [0x5e,0xea,0x0d,0xcf]
+# STDERR: [[@LINE-2]]:2: warning: potentially undefined instruction encoding
+
+[0x5b 0xea 0x8d 0xcf]
+# CHECK: uqrshl  r11, r12  @ encoding: [0x5b,0xea,0x0d,0xcf]
+# STDERR: [[@LINE-2]]:2: warning: potentially undefined instruction encoding
+
+[0x5e 0xea 0xcd 0xcf]
+# CHECK: uqrshl  lr, r12  @ encoding: [0x5e,0xea,0x0d,0xcf]
+# STDERR: [[@LINE-2]]:2: warning: potentially undefined instruction encoding
+
+[0x5b 0xea 0x0d 0xce]
+# CHECK: uqrshl  r11, r12  @ encoding: [0x5b,0xea,0x0d,0xcf]
+# STDERR: [[@LINE-2]]:2: warning: potentially undefined instruction encoding
Index: lib/Target/ARM/Disassembler/ARMDisassembler.cpp
===================================================================
--- lib/Target/ARM/Disassembler/ARMDisassembler.cpp
+++ lib/Target/ARM/Disassembler/ARMDisassembler.cpp
@@ -6484,6 +6484,12 @@
     if (!Check(S, DecoderGPRRegisterClass(Inst, Rm, Address, Decoder)))
       return MCDisassembler::Fail;
 
+    if (fieldFromInstruction (Insn, 6, 3) != 4)
+      return MCDisassembler::SoftFail;
+
+    if (Rda == Rm)
+      return MCDisassembler::SoftFail;
+
     return S;
   }
 
Index: lib/Target/ARM/ARMInstrMVE.td
===================================================================
--- lib/Target/ARM/ARMInstrMVE.td
+++ lib/Target/ARM/ARMInstrMVE.td
@@ -373,6 +373,8 @@
   let Inst{7-6} = 0b00;
   let Inst{5-4} = op5_4{1-0};
   let Inst{3-0} = 0b1101;
+
+  let Unpredictable{8-6} = 0b111;
 }
 
 def MVE_SQRSHR : MVE_ScalarShiftSRegReg<"sqrshr", 0b10>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66939.217849.patch
Type: text/x-patch
Size: 2639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190829/000a65a7/attachment.bin>


More information about the llvm-commits mailing list