[llvm] 9c82944 - [VE] Add vector control instructions

Kazushi Marukawa via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 03:24:43 PDT 2020


Author: Kazushi (Jam) Marukawa
Date: 2020-10-29T19:24:31+09:00
New Revision: 9c82944b2dc5dcb5e9100a76647fcc1aaa6333b9

URL: https://github.com/llvm/llvm-project/commit/9c82944b2dc5dcb5e9100a76647fcc1aaa6333b9
DIFF: https://github.com/llvm/llvm-project/commit/9c82944b2dc5dcb5e9100a76647fcc1aaa6333b9.diff

LOG: [VE] Add vector control instructions

Add LVL/SVL/SMVL/LVIX isntructions.  Add regression tests too.

Reviewed By: simoll

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

Added: 
    llvm/test/MC/VE/LVIX.s
    llvm/test/MC/VE/LVL.s
    llvm/test/MC/VE/SMVL.s
    llvm/test/MC/VE/SVL.s

Modified: 
    llvm/lib/Target/VE/VEInstrVec.td

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/VE/VEInstrVec.td b/llvm/lib/Target/VE/VEInstrVec.td
index 77de72dc5cd8..ffff1826b594 100644
--- a/llvm/lib/Target/VE/VEInstrVec.td
+++ b/llvm/lib/Target/VE/VEInstrVec.td
@@ -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
index 000000000000..61594cf69c93
--- /dev/null
+++ b/llvm/test/MC/VE/LVIX.s
@@ -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
index 000000000000..50eec02d5ad3
--- /dev/null
+++ b/llvm/test/MC/VE/LVL.s
@@ -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
index 000000000000..c1fb3628db81
--- /dev/null
+++ b/llvm/test/MC/VE/SMVL.s
@@ -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
index 000000000000..a825dcb1dec2
--- /dev/null
+++ b/llvm/test/MC/VE/SVL.s
@@ -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


        


More information about the llvm-commits mailing list