Skip to content

Commit 9c82944

Browse files
committed
[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
1 parent 749f13e commit 9c82944

File tree

5 files changed

+88
-0
lines changed

5 files changed

+88
-0
lines changed

llvm/lib/Target/VE/VEInstrVec.td

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,3 +1427,27 @@ defm LZVM : RVMSm<"lzvm", 0xa5, VM>;
14271427

14281428
// Section 8.17.12 - TOVM (Trailing One of VM)
14291429
defm TOVM : RVMSm<"tovm", 0xa6, VM>;
1430+
1431+
//-----------------------------------------------------------------------------
1432+
// Section 8.18 - Vector Control Instructions
1433+
//-----------------------------------------------------------------------------
1434+
1435+
// Section 8.18.1 - LVL (Load VL)
1436+
let sx = 0, cz = 0, sz = 0, hasSideEffects = 0, Defs = [VL] in {
1437+
def LVLr : RR<0xbf, (outs), (ins I64:$sy), "lvl $sy">;
1438+
let cy = 0 in def LVLi : RR<0xbf, (outs), (ins simm7:$sy), "lvl $sy">;
1439+
}
1440+
1441+
// Section 8.18.2 - SVL (Save VL)
1442+
let cy = 0, sy = 0, cz = 0, sz = 0, hasSideEffects = 0, Uses = [VL] in
1443+
def SVL : RR<0x2f, (outs I64:$sx), (ins), "svl $sx">;
1444+
1445+
// Section 8.18.3 - SMVL (Save Maximum Vector Length)
1446+
let cy = 0, sy = 0, cz = 0, sz = 0, hasSideEffects = 0 in
1447+
def SMVL : RR<0x2e, (outs I64:$sx), (ins), "smvl $sx">;
1448+
1449+
// Section 8.18.4 - LVIX (Load Vector Data Index)
1450+
let sx = 0, cz = 0, sz = 0, hasSideEffects = 0, Defs = [VIX] in {
1451+
def LVIXr : RR<0xaf, (outs), (ins I64:$sy), "lvix $sy">;
1452+
let cy = 0 in def LVIXi : RR<0xaf, (outs), (ins uimm6:$sy), "lvix $sy">;
1453+
}

llvm/test/MC/VE/LVIX.s

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# RUN: llvm-mc -triple=ve --show-encoding < %s \
2+
# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3+
# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
4+
# RUN: | FileCheck %s --check-prefixes=CHECK-INST
5+
6+
# CHECK-INST: lvix %s11
7+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x8b,0x00,0xaf]
8+
lvix %s11
9+
10+
# CHECK-INST: lvix 63
11+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x3f,0x00,0xaf]
12+
lvix 63
13+
14+
# CHECK-INST: lvix %s63
15+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0xbf,0x00,0xaf]
16+
lvix %s63

llvm/test/MC/VE/LVL.s

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# RUN: llvm-mc -triple=ve --show-encoding < %s \
2+
# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3+
# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
4+
# RUN: | FileCheck %s --check-prefixes=CHECK-INST
5+
6+
# CHECK-INST: lvl %s11
7+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x8b,0x00,0xbf]
8+
lvl %s11
9+
10+
# CHECK-INST: lvl 63
11+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x3f,0x00,0xbf]
12+
lvl 63
13+
14+
# CHECK-INST: lvl -64
15+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x40,0x00,0xbf]
16+
lvl -64

llvm/test/MC/VE/SMVL.s

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# RUN: llvm-mc -triple=ve --show-encoding < %s \
2+
# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3+
# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
4+
# RUN: | FileCheck %s --check-prefixes=CHECK-INST
5+
6+
# CHECK-INST: smvl %s11
7+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x2e]
8+
smvl %s11
9+
10+
# CHECK-INST: smvl %s0
11+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2e]
12+
smvl %s0
13+
14+
# CHECK-INST: smvl %s63
15+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x2e]
16+
smvl %s63

llvm/test/MC/VE/SVL.s

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# RUN: llvm-mc -triple=ve --show-encoding < %s \
2+
# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3+
# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
4+
# RUN: | FileCheck %s --check-prefixes=CHECK-INST
5+
6+
# CHECK-INST: svl %s11
7+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x2f]
8+
svl %s11
9+
10+
# CHECK-INST: svl %s0
11+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2f]
12+
svl %s0
13+
14+
# CHECK-INST: svl %s63
15+
# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x2f]
16+
svl %s63

0 commit comments

Comments
 (0)