[VE] Add vector control instructions
authorKazushi (Jam) Marukawa <marukawa@nec.com>
Wed, 28 Oct 2020 11:11:40 +0000 (20:11 +0900)
committerKazushi (Jam) Marukawa <marukawa@nec.com>
Thu, 29 Oct 2020 10:24:31 +0000 (19:24 +0900)
Add LVL/SVL/SMVL/LVIX isntructions.  Add regression tests too.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90355

llvm/lib/Target/VE/VEInstrVec.td
llvm/test/MC/VE/LVIX.s [new file with mode: 0644]
llvm/test/MC/VE/LVL.s [new file with mode: 0644]
llvm/test/MC/VE/SMVL.s [new file with mode: 0644]
llvm/test/MC/VE/SVL.s [new file with mode: 0644]

index 77de72d..ffff182 100644 (file)
@@ -1427,3 +1427,27 @@ defm LZVM : RVMSm<"lzvm", 0xa5, VM>;
 
 // Section 8.17.12 - TOVM (Trailing One of VM)
 defm TOVM : RVMSm<"tovm", 0xa6, VM>;
+
+//-----------------------------------------------------------------------------
+// Section 8.18 - Vector Control Instructions
+//-----------------------------------------------------------------------------
+
+// Section 8.18.1 - LVL (Load VL)
+let sx = 0, cz = 0, sz = 0, hasSideEffects = 0, Defs = [VL] in {
+  def LVLr : RR<0xbf, (outs), (ins I64:$sy), "lvl $sy">;
+  let cy = 0 in def LVLi : RR<0xbf, (outs), (ins simm7:$sy), "lvl $sy">;
+}
+
+// Section 8.18.2 - SVL (Save VL)
+let cy = 0, sy = 0, cz = 0, sz = 0, hasSideEffects = 0, Uses = [VL] in
+def SVL : RR<0x2f, (outs I64:$sx), (ins), "svl $sx">;
+
+// Section 8.18.3 - SMVL (Save Maximum Vector Length)
+let cy = 0, sy = 0, cz = 0, sz = 0, hasSideEffects = 0 in
+def SMVL : RR<0x2e, (outs I64:$sx), (ins), "smvl $sx">;
+
+// Section 8.18.4 - LVIX (Load Vector Data Index)
+let sx = 0, cz = 0, sz = 0, hasSideEffects = 0, Defs = [VIX] in {
+  def LVIXr : RR<0xaf, (outs), (ins I64:$sy), "lvix $sy">;
+  let cy = 0 in def LVIXi : RR<0xaf, (outs), (ins uimm6:$sy), "lvix $sy">;
+}
diff --git a/llvm/test/MC/VE/LVIX.s b/llvm/test/MC/VE/LVIX.s
new file mode 100644 (file)
index 0000000..61594cf
--- /dev/null
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: lvix %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x8b,0x00,0xaf]
+lvix %s11
+
+# CHECK-INST: lvix 63
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x3f,0x00,0xaf]
+lvix 63
+
+# CHECK-INST: lvix %s63
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0xbf,0x00,0xaf]
+lvix %s63
diff --git a/llvm/test/MC/VE/LVL.s b/llvm/test/MC/VE/LVL.s
new file mode 100644 (file)
index 0000000..50eec02
--- /dev/null
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: lvl %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x8b,0x00,0xbf]
+lvl %s11
+
+# CHECK-INST: lvl 63
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x3f,0x00,0xbf]
+lvl 63
+
+# CHECK-INST: lvl -64
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x40,0x00,0xbf]
+lvl -64
diff --git a/llvm/test/MC/VE/SMVL.s b/llvm/test/MC/VE/SMVL.s
new file mode 100644 (file)
index 0000000..c1fb362
--- /dev/null
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: smvl %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x2e]
+smvl %s11
+
+# CHECK-INST: smvl %s0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2e]
+smvl %s0
+
+# CHECK-INST: smvl %s63
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x2e]
+smvl %s63
diff --git a/llvm/test/MC/VE/SVL.s b/llvm/test/MC/VE/SVL.s
new file mode 100644 (file)
index 0000000..a825dcb
--- /dev/null
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: svl %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x2f]
+svl %s11
+
+# CHECK-INST: svl %s0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2f]
+svl %s0
+
+# CHECK-INST: svl %s63
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x2f]
+svl %s63