[ARC] Add norm/normh instructions with disassembly tests
authorMark Schimmel <marksl@synopsys.com>
Fri, 30 Jul 2021 00:51:47 +0000 (17:51 -0700)
committerMark Schimmel <marksl@synopsys.com>
Fri, 30 Jul 2021 00:54:52 +0000 (17:54 -0700)
Add disassembler support for the NORM and NORMH instructions. These instructions
only exist when the ARC processor is configured with the "norm" extension.

fferential Revision: https://reviews.llvm.org/D107118

llvm/lib/Target/ARC/ARCInstrInfo.td
llvm/test/MC/Disassembler/ARC/misc.txt

index c016cd4..16c3e50 100644 (file)
@@ -45,7 +45,6 @@ def SDT_ARCCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32>,
 def SDT_ARCCallSeqEnd   : SDCallSeqEnd<[ SDTCisVT<0, i32>,
                                          SDTCisVT<1, i32> ]>;
 
-
 // Global Address.
 def ARCGAWrapper : SDNode<"ARCISD::GAWRAPPER", SDT_ARCmov, []>;
 
@@ -80,6 +79,12 @@ def callseq_end   : SDNode<"ISD::CALLSEQ_END",   SDT_ARCCallSeqEnd,
                            [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
 
 //===----------------------------------------------------------------------===//
+// Instruction predicates
+//===----------------------------------------------------------------------===//
+
+def HasNorm  :       Predicate<"Subtarget->hasNorm()">;
+
+//===----------------------------------------------------------------------===//
 // Instruction Pattern Stuff
 //===----------------------------------------------------------------------===//
 
@@ -303,6 +308,11 @@ defm SEXH : ArcUnaryGEN4Inst<0b000110, "sexh">;
 // Extension unary instruction definitions.
 defm FLS : ArcUnaryEXT5Inst<0b010011, "fls">;
 
+let Predicates=[HasNorm] in {
+  defm NORM  : ArcUnaryEXT5Inst<0b000001,"norm">;
+  defm NORMH : ArcUnaryEXT5Inst<0b001000,"normh">;
+}
+
 // General Unary Instruction fragments.
 def : Pat<(sext_inreg i32:$a, i8), (SEXB_rr i32:$a)>;
 def : Pat<(sext_inreg i32:$a, i16), (SEXH_rr i32:$a)>;
index 2abe46a..45ba9b0 100644 (file)
 
 # CHECK: fls.f %r0, %r0
 0x2f 0x28 0x13 0x80
+
+# CHECK: norm %r22, %blink
+0x2f 0x2e 0xc1 0x27
+
+# CHECK: normh %r7, %r18
+0x2f 0x2f 0x88 0x04