1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -mattr=+zve32x \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
5 ; Make sure we don't select a 0 vl to X0 in the custom isel handlers we use
6 ; for these intrinsics.
8 declare {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vlseg2.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, i64)
9 declare {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vlseg2.mask.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i1>, i64, i64)
11 define <vscale x 16 x i16> @test_vlseg2_mask_nxv16i16(ptr %base, <vscale x 16 x i1> %mask) {
12 ; CHECK-LABEL: test_vlseg2_mask_nxv16i16:
13 ; CHECK: # %bb.0: # %entry
14 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, mu
15 ; CHECK-NEXT: vlseg2e16.v v4, (a0)
16 ; CHECK-NEXT: vmv4r.v v8, v4
17 ; CHECK-NEXT: vlseg2e16.v v4, (a0), v0.t
20 %0 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vlseg2.nxv16i16(<vscale x 16 x i16> undef,<vscale x 16 x i16> undef, ptr %base, i64 0)
21 %1 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>} %0, 0
22 %2 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vlseg2.mask.nxv16i16(<vscale x 16 x i16> %1,<vscale x 16 x i16> %1, ptr %base, <vscale x 16 x i1> %mask, i64 0, i64 1)
23 %3 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>} %2, 1
24 ret <vscale x 16 x i16> %3
27 declare {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vlsseg2.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, i64, i64)
28 declare {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vlsseg2.mask.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, i64, <vscale x 16 x i1>, i64, i64)
30 define <vscale x 16 x i16> @test_vlsseg2_mask_nxv16i16(ptr %base, i64 %offset, <vscale x 16 x i1> %mask) {
31 ; CHECK-LABEL: test_vlsseg2_mask_nxv16i16:
32 ; CHECK: # %bb.0: # %entry
33 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, mu
34 ; CHECK-NEXT: vlsseg2e16.v v4, (a0), a1
35 ; CHECK-NEXT: vmv4r.v v8, v4
36 ; CHECK-NEXT: vlsseg2e16.v v4, (a0), a1, v0.t
39 %0 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vlsseg2.nxv16i16(<vscale x 16 x i16> undef, <vscale x 16 x i16> undef, ptr %base, i64 %offset, i64 0)
40 %1 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>} %0, 0
41 %2 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vlsseg2.mask.nxv16i16(<vscale x 16 x i16> %1,<vscale x 16 x i16> %1, ptr %base, i64 %offset, <vscale x 16 x i1> %mask, i64 0, i64 1)
42 %3 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>} %2, 1
43 ret <vscale x 16 x i16> %3
45 declare {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vloxseg2.nxv16i16.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i16>, i64)
46 declare {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vloxseg2.mask.nxv16i16.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i16>, <vscale x 16 x i1>, i64, i64)
48 define <vscale x 16 x i16> @test_vloxseg2_mask_nxv16i16_nxv16i16(ptr %base, <vscale x 16 x i16> %index, <vscale x 16 x i1> %mask) {
49 ; CHECK-LABEL: test_vloxseg2_mask_nxv16i16_nxv16i16:
50 ; CHECK: # %bb.0: # %entry
51 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, mu
52 ; CHECK-NEXT: vloxseg2ei16.v v12, (a0), v8
53 ; CHECK-NEXT: vmv4r.v v16, v12
54 ; CHECK-NEXT: vloxseg2ei16.v v12, (a0), v8, v0.t
55 ; CHECK-NEXT: vmv4r.v v8, v16
58 %0 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vloxseg2.nxv16i16.nxv16i16(<vscale x 16 x i16> undef, <vscale x 16 x i16> undef, ptr %base, <vscale x 16 x i16> %index, i64 0)
59 %1 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>} %0, 0
60 %2 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vloxseg2.mask.nxv16i16.nxv16i16(<vscale x 16 x i16> %1,<vscale x 16 x i16> %1, ptr %base, <vscale x 16 x i16> %index, <vscale x 16 x i1> %mask, i64 0, i64 1)
61 %3 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>} %2, 1
62 ret <vscale x 16 x i16> %3
65 declare {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vluxseg2.nxv16i16.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i16>, i64)
66 declare {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vluxseg2.mask.nxv16i16.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i16>, <vscale x 16 x i1>, i64, i64)
68 define <vscale x 16 x i16> @test_vluxseg2_mask_nxv16i16_nxv16i16(ptr %base, <vscale x 16 x i16> %index, <vscale x 16 x i1> %mask) {
69 ; CHECK-LABEL: test_vluxseg2_mask_nxv16i16_nxv16i16:
70 ; CHECK: # %bb.0: # %entry
71 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, mu
72 ; CHECK-NEXT: vluxseg2ei16.v v12, (a0), v8
73 ; CHECK-NEXT: vmv4r.v v16, v12
74 ; CHECK-NEXT: vluxseg2ei16.v v12, (a0), v8, v0.t
75 ; CHECK-NEXT: vmv4r.v v8, v16
78 %0 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vluxseg2.nxv16i16.nxv16i16(<vscale x 16 x i16> undef, <vscale x 16 x i16> undef, ptr %base, <vscale x 16 x i16> %index, i64 0)
79 %1 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>} %0, 0
80 %2 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>} @llvm.riscv.vluxseg2.mask.nxv16i16.nxv16i16(<vscale x 16 x i16> %1,<vscale x 16 x i16> %1, ptr %base, <vscale x 16 x i16> %index, <vscale x 16 x i1> %mask, i64 0, i64 1)
81 %3 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>} %2, 1
82 ret <vscale x 16 x i16> %3
85 declare {<vscale x 16 x i16>,<vscale x 16 x i16>, i64} @llvm.riscv.vlseg2ff.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr , i64)
86 declare {<vscale x 16 x i16>,<vscale x 16 x i16>, i64} @llvm.riscv.vlseg2ff.mask.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i1>, i64, i64)
88 define <vscale x 16 x i16> @test_vlseg2ff_nxv16i16(ptr %base, ptr %outvl) {
89 ; CHECK-LABEL: test_vlseg2ff_nxv16i16:
90 ; CHECK: # %bb.0: # %entry
91 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, ma
92 ; CHECK-NEXT: vlseg2e16ff.v v4, (a0)
93 ; CHECK-NEXT: csrr a0, vl
94 ; CHECK-NEXT: sd a0, 0(a1)
97 %0 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>, i64} @llvm.riscv.vlseg2ff.nxv16i16(<vscale x 16 x i16> undef, <vscale x 16 x i16> undef, ptr %base, i64 0)
98 %1 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>, i64} %0, 1
99 %2 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>, i64} %0, 2
100 store i64 %2, ptr %outvl
101 ret <vscale x 16 x i16> %1
104 define <vscale x 16 x i16> @test_vlseg2ff_mask_nxv16i16(<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i1> %mask, ptr %outvl) {
105 ; CHECK-LABEL: test_vlseg2ff_mask_nxv16i16:
106 ; CHECK: # %bb.0: # %entry
107 ; CHECK-NEXT: vmv4r.v v4, v8
108 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, mu
109 ; CHECK-NEXT: vlseg2e16ff.v v4, (a0), v0.t
110 ; CHECK-NEXT: csrr a0, vl
111 ; CHECK-NEXT: sd a0, 0(a1)
114 %0 = tail call {<vscale x 16 x i16>,<vscale x 16 x i16>, i64} @llvm.riscv.vlseg2ff.mask.nxv16i16(<vscale x 16 x i16> %val,<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i1> %mask, i64 0, i64 1)
115 %1 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>, i64} %0, 1
116 %2 = extractvalue {<vscale x 16 x i16>,<vscale x 16 x i16>, i64} %0, 2
117 store i64 %2, ptr %outvl
118 ret <vscale x 16 x i16> %1
121 declare void @llvm.riscv.vsseg2.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr , i64)
122 declare void @llvm.riscv.vsseg2.mask.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i1>, i64)
124 define void @test_vsseg2_nxv16i16(<vscale x 16 x i16> %val, ptr %base) {
125 ; CHECK-LABEL: test_vsseg2_nxv16i16:
126 ; CHECK: # %bb.0: # %entry
127 ; CHECK-NEXT: vmv4r.v v12, v8
128 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, ma
129 ; CHECK-NEXT: vsseg2e16.v v8, (a0)
132 tail call void @llvm.riscv.vsseg2.nxv16i16(<vscale x 16 x i16> %val,<vscale x 16 x i16> %val, ptr %base, i64 0)
136 define void @test_vsseg2_mask_nxv16i16(<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i1> %mask) {
137 ; CHECK-LABEL: test_vsseg2_mask_nxv16i16:
138 ; CHECK: # %bb.0: # %entry
139 ; CHECK-NEXT: vmv4r.v v12, v8
140 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, ma
141 ; CHECK-NEXT: vsseg2e16.v v8, (a0), v0.t
144 tail call void @llvm.riscv.vsseg2.mask.nxv16i16(<vscale x 16 x i16> %val,<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i1> %mask, i64 0)
148 declare void @llvm.riscv.vssseg2.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, i64, i64)
149 declare void @llvm.riscv.vssseg2.mask.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, i64, <vscale x 16 x i1>, i64)
151 define void @test_vssseg2_nxv16i16(<vscale x 16 x i16> %val, ptr %base, i64 %offset) {
152 ; CHECK-LABEL: test_vssseg2_nxv16i16:
153 ; CHECK: # %bb.0: # %entry
154 ; CHECK-NEXT: vmv4r.v v12, v8
155 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, ma
156 ; CHECK-NEXT: vssseg2e16.v v8, (a0), a1
159 tail call void @llvm.riscv.vssseg2.nxv16i16(<vscale x 16 x i16> %val,<vscale x 16 x i16> %val, ptr %base, i64 %offset, i64 0)
163 define void @test_vssseg2_mask_nxv16i16(<vscale x 16 x i16> %val, ptr %base, i64 %offset, <vscale x 16 x i1> %mask) {
164 ; CHECK-LABEL: test_vssseg2_mask_nxv16i16:
165 ; CHECK: # %bb.0: # %entry
166 ; CHECK-NEXT: vmv4r.v v12, v8
167 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, ma
168 ; CHECK-NEXT: vssseg2e16.v v8, (a0), a1, v0.t
171 tail call void @llvm.riscv.vssseg2.mask.nxv16i16(<vscale x 16 x i16> %val,<vscale x 16 x i16> %val, ptr %base, i64 %offset, <vscale x 16 x i1> %mask, i64 0)
175 declare void @llvm.riscv.vsoxseg2.nxv16i16.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i16>, i64)
176 declare void @llvm.riscv.vsoxseg2.mask.nxv16i16.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i16>, <vscale x 16 x i1>, i64)
178 define void @test_vsoxseg2_nxv16i16_nxv16i16(<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i16> %index) {
179 ; CHECK-LABEL: test_vsoxseg2_nxv16i16_nxv16i16:
180 ; CHECK: # %bb.0: # %entry
181 ; CHECK-NEXT: vmv4r.v v16, v12
182 ; CHECK-NEXT: vmv4r.v v12, v8
183 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, ma
184 ; CHECK-NEXT: vsoxseg2ei16.v v8, (a0), v16
187 tail call void @llvm.riscv.vsoxseg2.nxv16i16.nxv16i16(<vscale x 16 x i16> %val,<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i16> %index, i64 0)
191 define void @test_vsoxseg2_mask_nxv16i16_nxv16i16(<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i16> %index, <vscale x 16 x i1> %mask) {
192 ; CHECK-LABEL: test_vsoxseg2_mask_nxv16i16_nxv16i16:
193 ; CHECK: # %bb.0: # %entry
194 ; CHECK-NEXT: vmv4r.v v16, v12
195 ; CHECK-NEXT: vmv4r.v v12, v8
196 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, ma
197 ; CHECK-NEXT: vsoxseg2ei16.v v8, (a0), v16, v0.t
200 tail call void @llvm.riscv.vsoxseg2.mask.nxv16i16.nxv16i16(<vscale x 16 x i16> %val,<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i16> %index, <vscale x 16 x i1> %mask, i64 0)
204 declare void @llvm.riscv.vsuxseg2.nxv16i16.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i16>, i64)
205 declare void @llvm.riscv.vsuxseg2.mask.nxv16i16.nxv16i16(<vscale x 16 x i16>,<vscale x 16 x i16>, ptr, <vscale x 16 x i16>, <vscale x 16 x i1>, i64)
207 define void @test_vsuxseg2_nxv16i16_nxv16i16(<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i16> %index) {
208 ; CHECK-LABEL: test_vsuxseg2_nxv16i16_nxv16i16:
209 ; CHECK: # %bb.0: # %entry
210 ; CHECK-NEXT: vmv4r.v v16, v12
211 ; CHECK-NEXT: vmv4r.v v12, v8
212 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, ma
213 ; CHECK-NEXT: vsuxseg2ei16.v v8, (a0), v16
216 tail call void @llvm.riscv.vsuxseg2.nxv16i16.nxv16i16(<vscale x 16 x i16> %val,<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i16> %index, i64 0)
220 define void @test_vsuxseg2_mask_nxv16i16_nxv16i16(<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i16> %index, <vscale x 16 x i1> %mask) {
221 ; CHECK-LABEL: test_vsuxseg2_mask_nxv16i16_nxv16i16:
222 ; CHECK: # %bb.0: # %entry
223 ; CHECK-NEXT: vmv4r.v v16, v12
224 ; CHECK-NEXT: vmv4r.v v12, v8
225 ; CHECK-NEXT: vsetivli zero, 0, e16, m4, ta, ma
226 ; CHECK-NEXT: vsuxseg2ei16.v v8, (a0), v16, v0.t
229 tail call void @llvm.riscv.vsuxseg2.mask.nxv16i16.nxv16i16(<vscale x 16 x i16> %val,<vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i16> %index, <vscale x 16 x i1> %mask, i64 0)