xref: /llvm-project/llvm/test/MC/RISCV/rvv/vsetvl.s (revision 876c6204f12fa2738ff8ca886e664b826847d6d4)
1# RUN: llvm-mc -triple=riscv64 -show-encoding --mattr=+v %s \
2# RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3# RUN: llvm-mc -triple=riscv64 -show-encoding --mattr=+zve32x %s 2>&1 \
4# RUN:        | FileCheck %s --check-prefix=CHECK-ZVE32X
5# RUN: not llvm-mc -triple=riscv64 -show-encoding %s 2>&1 \
6# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
7# RUN: llvm-mc -triple=riscv64 -filetype=obj --mattr=+v %s \
8# RUN:        | llvm-objdump -d --mattr=+v --no-print-imm-hex - \
9# RUN:        | FileCheck %s --check-prefix=CHECK-INST
10# RUN: llvm-mc -triple=riscv64 -filetype=obj --mattr=+v %s \
11# RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
12
13# reserved filed: vlmul[2:0]=4, vsew[2:0]=0b1xx, non-zero bits 8/9/10.
14vsetvli a2, a0, 0x224
15# CHECK-INST: vsetvli a2, a0, 548
16# CHECK-ENCODING: [0x57,0x76,0x45,0x22]
17# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
18# CHECK-UNKNOWN: 22457657 <unknown>
19
20vsetvli a2, a0, 0xd0
21# CHECK-INST: vsetvli a2, a0, e32, m1, ta, ma
22# CHECK-ENCODING: [0x57,0x76,0x05,0x0d]
23# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
24# CHECK-UNKNOWN: 0d057657 <unknown>
25
26vsetvli a2, a0, 0xd1
27# CHECK-INST: vsetvli a2, a0, e32, m2, ta, ma
28# CHECK-ENCODING: [0x57,0x76,0x15,0x0d]
29# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
30# CHECK-UNKNOWN: 0d157657 <unknown>
31
32vsetvli a2, a0, 0x50
33# CHECK-INST: vsetvli a2, a0, e32, m1, ta, mu
34# CHECK-ENCODING: [0x57,0x76,0x05,0x05]
35# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
36# CHECK-UNKNOWN: 05057657 <unknown>
37
38vsetvli a2, a0, 0x90
39# CHECK-INST: vsetvli a2, a0, e32, m1, tu, ma
40# CHECK-ENCODING: [0x57,0x76,0x05,0x09]
41# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
42# CHECK-UNKNOWN: 09057657 <unknown>
43
44vsetvli a2, a0, 144
45# CHECK-INST: vsetvli a2, a0, e32, m1, tu, ma
46# CHECK-ENCODING: [0x57,0x76,0x05,0x09]
47# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
48# CHECK-UNKNOWN: 09057657 <unknown>
49
50vsetvli a2, a0, e32, m1, ta, ma
51# CHECK-INST: vsetvli a2, a0, e32,  m1,  ta,  ma
52# CHECK-ENCODING: [0x57,0x76,0x05,0x0d]
53# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
54# CHECK-UNKNOWN: 0d057657 <unknown>
55
56vsetvli a2, a0, e32, m2, ta, ma
57# CHECK-INST: vsetvli a2, a0, e32, m2, ta, ma
58# CHECK-ENCODING: [0x57,0x76,0x15,0x0d]
59# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
60# CHECK-UNKNOWN: 0d157657 <unknown>
61
62vsetvli a2, a0, e32, m4, ta, ma
63# CHECK-INST: vsetvli a2, a0, e32, m4, ta, ma
64# CHECK-ENCODING: [0x57,0x76,0x25,0x0d]
65# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
66# CHECK-UNKNOWN: 0d257657 <unknown>
67
68vsetvli a2, a0, e32, m8, ta, ma
69# CHECK-INST: vsetvli a2, a0, e32, m8, ta, ma
70# CHECK-ENCODING: [0x57,0x76,0x35,0x0d]
71# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
72# CHECK-UNKNOWN: 0d357657 <unknown>
73
74vsetvli a2, a0, e32, mf2, ta, ma
75# CHECK-INST: vsetvli a2, a0, e32, mf2, ta, ma
76# CHECK-ZVE32X: :[[#@LINE-2]]:17: warning: use of vtype encodings with SEW > 16 and LMUL == mf2 may not be compatible with all RVV implementations{{$}}
77# CHECK-ENCODING: [0x57,0x76,0x75,0x0d]
78# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
79# CHECK-UNKNOWN: 0d757657 <unknown>
80
81vsetvli a2, a0, e32, mf4, ta, ma
82# CHECK-INST: vsetvli a2, a0, e32, mf4, ta, ma
83# CHECK-ZVE32X: :[[#@LINE-2]]:17: warning: use of vtype encodings with SEW > 8 and LMUL == mf4 may not be compatible with all RVV implementations{{$}}
84# CHECK-ENCODING: [0x57,0x76,0x65,0x0d]
85# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
86# CHECK-UNKNOWN: 0d657657 <unknown>
87
88vsetvli a2, a0, e32, mf8, ta, ma
89# CHECK-INST: vsetvli a2, a0, e32, mf8, ta, ma
90# CHECK-ZVE32X: :[[#@LINE-2]]:22: warning: use of vtype encodings with LMUL < SEWMIN/ELEN == mf4 is reserved{{$}}
91# CHECK-ENCODING: [0x57,0x76,0x55,0x0d]
92# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
93# CHECK-UNKNOWN: 0d557657 <unknown>
94
95vsetvli a2, a0, e32, m1, ta, ma
96# CHECK-INST: vsetvli a2, a0, e32, m1, ta, ma
97# CHECK-ENCODING: [0x57,0x76,0x05,0x0d]
98# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
99# CHECK-UNKNOWN: 0d057657 <unknown>
100
101vsetvli a2, a0, e32, m1, tu, ma
102# CHECK-INST: vsetvli a2, a0, e32, m1, tu, ma
103# CHECK-ENCODING: [0x57,0x76,0x05,0x09]
104# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
105# CHECK-UNKNOWN: 09057657 <unknown>
106
107vsetvli a2, a0, e32, m1, ta, mu
108# CHECK-INST: vsetvli a2, a0, e32, m1, ta, mu
109# CHECK-ENCODING: [0x57,0x76,0x05,0x05]
110# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
111# CHECK-UNKNOWN: 05057657 <unknown>
112
113vsetvli a2, a0, e32, m1, tu, mu
114# CHECK-INST: vsetvli a2, a0, e32, m1
115# CHECK-ENCODING: [0x57,0x76,0x05,0x01]
116# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
117# CHECK-UNKNOWN: 01057657 <unknown>
118
119vsetvl a2, a0, a1
120# CHECK-INST: vsetvl a2, a0, a1
121# CHECK-ENCODING: [0x57,0x76,0xb5,0x80]
122# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
123# CHECK-UNKNOWN: 80b57657 <unknown>
124
125# reserved filed: vlmul[2:0]=4, vsew[2:0]=0b1xx, non-zero bits 8/9/10.
126vsetivli a2, 0, 0x224
127# CHECK-INST: vsetivli a2, 0, 548
128# CHECK-ENCODING: [0x57,0x76,0x40,0xe2]
129# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
130# CHECK-UNKNOWN: e2407657 <unknown>
131
132vsetivli a2, 0, 0xd0
133# CHECK-INST: vsetivli a2, 0, e32, m1, ta, ma
134# CHECK-ENCODING: [0x57,0x76,0x00,0xcd]
135# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
136# CHECK-UNKNOWN: cd007657 <unknown>
137
138vsetivli a2, 15, 0xd0
139# CHECK-INST: vsetivli a2, 15, e32, m1, ta, ma
140# CHECK-ENCODING: [0x57,0xf6,0x07,0xcd]
141# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
142# CHECK-UNKNOWN: cd07f657 <unknown>
143
144vsetivli a2, 15, 208
145# CHECK-INST: vsetivli a2, 15, e32, m1, ta, ma
146# CHECK-ENCODING: [0x57,0xf6,0x07,0xcd]
147# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
148# CHECK-UNKNOWN: cd07f657 <unknown>
149
150vsetivli a2, 0, e32, m1, ta, ma
151# CHECK-INST: vsetivli a2, 0, e32, m1, ta, ma
152# CHECK-ENCODING: [0x57,0x76,0x00,0xcd]
153# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
154# CHECK-UNKNOWN: cd007657 <unknown>
155
156vsetivli a2, 15, e32, m1, ta, ma
157# CHECK-INST: vsetivli a2, 15, e32, m1, ta, ma
158# CHECK-ENCODING: [0x57,0xf6,0x07,0xcd]
159# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
160# CHECK-UNKNOWN: cd07f657 <unknown>
161
162vsetivli a2, 31, e32, m1, ta, ma
163# CHECK-INST: vsetivli a2, 31, e32, m1, ta, ma
164# CHECK-ENCODING: [0x57,0xf6,0x0f,0xcd]
165# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
166# CHECK-UNKNOWN: cd0ff657 <unknown>
167