1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-SELDAG %s
3 ; RUN: llc -verify-machineinstrs -O0 < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FASTISEL %s
5 target triple = "aarch64-unknown-linux-gnu"
11 define <vscale x 2 x i1> @reverse_nxv2i1(<vscale x 2 x i1> %a) #0 {
12 ; CHECK-LABEL: reverse_nxv2i1:
14 ; CHECK-NEXT: rev p0.d, p0.d
17 %res = call <vscale x 2 x i1> @llvm.experimental.vector.reverse.nxv2i1(<vscale x 2 x i1> %a)
18 ret <vscale x 2 x i1> %res
21 define <vscale x 4 x i1> @reverse_nxv4i1(<vscale x 4 x i1> %a) #0 {
22 ; CHECK-LABEL: reverse_nxv4i1:
24 ; CHECK-NEXT: rev p0.s, p0.s
27 %res = call <vscale x 4 x i1> @llvm.experimental.vector.reverse.nxv4i1(<vscale x 4 x i1> %a)
28 ret <vscale x 4 x i1> %res
31 define <vscale x 8 x i1> @reverse_nxv8i1(<vscale x 8 x i1> %a) #0 {
32 ; CHECK-LABEL: reverse_nxv8i1:
34 ; CHECK-NEXT: rev p0.h, p0.h
37 %res = call <vscale x 8 x i1> @llvm.experimental.vector.reverse.nxv8i1(<vscale x 8 x i1> %a)
38 ret <vscale x 8 x i1> %res
41 define <vscale x 16 x i1> @reverse_nxv16i1(<vscale x 16 x i1> %a) #0 {
42 ; CHECK-LABEL: reverse_nxv16i1:
44 ; CHECK-NEXT: rev p0.b, p0.b
47 %res = call <vscale x 16 x i1> @llvm.experimental.vector.reverse.nxv16i1(<vscale x 16 x i1> %a)
48 ret <vscale x 16 x i1> %res
51 ; Verify splitvec type legalisation works as expected.
52 define <vscale x 32 x i1> @reverse_nxv32i1(<vscale x 32 x i1> %a) #0 {
53 ; CHECK-LABEL: reverse_nxv32i1:
54 ; CHECK-SELDAG: // %bb.0:
55 ; CHECK-SELDAG-NEXT: rev p2.b, p1.b
56 ; CHECK-SELDAG-NEXT: rev p1.b, p0.b
57 ; CHECK-SELDAG-NEXT: mov p0.b, p2.b
58 ; CHECK-SELDAG-NEXT: ret
59 ; CHECK-FASTISEL: // %bb.0:
60 ; CHECK-FASTISEL-NEXT: str x29, [sp, #-16]
61 ; CHECK-FASTISEL-NEXT: addvl sp, sp, #-1
62 ; CHECK-FASTISEL-NEXT: str p1, [sp, #7, mul vl]
63 ; CHECK-FASTISEL-NEXT: mov p1.b, p0.b
64 ; CHECK-FASTISEL-NEXT: ldr p0, [sp, #7, mul vl]
65 ; CHECK-FASTISEL-NEXT: rev p0.b, p0.b
66 ; CHECK-FASTISEL-NEXT: rev p1.b, p1.b
67 ; CHECK-FASTISEL-NEXT: addvl sp, sp, #1
68 ; CHECK-FASTISEL-NEXT: ldr x29, [sp], #16
69 ; CHECK-FASTISEL-NEXT: ret
71 %res = call <vscale x 32 x i1> @llvm.experimental.vector.reverse.nxv32i1(<vscale x 32 x i1> %a)
72 ret <vscale x 32 x i1> %res
76 ; VECTOR_REVERSE - ZPR
79 define <vscale x 16 x i8> @reverse_nxv16i8(<vscale x 16 x i8> %a) #0 {
80 ; CHECK-LABEL: reverse_nxv16i8:
82 ; CHECK-NEXT: rev z0.b, z0.b
85 %res = call <vscale x 16 x i8> @llvm.experimental.vector.reverse.nxv16i8(<vscale x 16 x i8> %a)
86 ret <vscale x 16 x i8> %res
89 define <vscale x 8 x i16> @reverse_nxv8i16(<vscale x 8 x i16> %a) #0 {
90 ; CHECK-LABEL: reverse_nxv8i16:
92 ; CHECK-NEXT: rev z0.h, z0.h
95 %res = call <vscale x 8 x i16> @llvm.experimental.vector.reverse.nxv8i16(<vscale x 8 x i16> %a)
96 ret <vscale x 8 x i16> %res
99 define <vscale x 4 x i32> @reverse_nxv4i32(<vscale x 4 x i32> %a) #0 {
100 ; CHECK-LABEL: reverse_nxv4i32:
102 ; CHECK-NEXT: rev z0.s, z0.s
105 %res = call <vscale x 4 x i32> @llvm.experimental.vector.reverse.nxv4i32(<vscale x 4 x i32> %a)
106 ret <vscale x 4 x i32> %res
109 define <vscale x 2 x i64> @reverse_nxv2i64(<vscale x 2 x i64> %a) #0 {
110 ; CHECK-LABEL: reverse_nxv2i64:
112 ; CHECK-NEXT: rev z0.d, z0.d
115 %res = call <vscale x 2 x i64> @llvm.experimental.vector.reverse.nxv2i64(<vscale x 2 x i64> %a)
116 ret <vscale x 2 x i64> %res
119 define <vscale x 8 x half> @reverse_nxv8f16(<vscale x 8 x half> %a) #0 {
120 ; CHECK-LABEL: reverse_nxv8f16:
122 ; CHECK-NEXT: rev z0.h, z0.h
125 %res = call <vscale x 8 x half> @llvm.experimental.vector.reverse.nxv8f16(<vscale x 8 x half> %a)
126 ret <vscale x 8 x half> %res
129 define <vscale x 4 x float> @reverse_nxv4f32(<vscale x 4 x float> %a) #0 {
130 ; CHECK-LABEL: reverse_nxv4f32:
132 ; CHECK-NEXT: rev z0.s, z0.s
135 %res = call <vscale x 4 x float> @llvm.experimental.vector.reverse.nxv4f32(<vscale x 4 x float> %a) ret <vscale x 4 x float> %res
138 define <vscale x 2 x double> @reverse_nxv2f64(<vscale x 2 x double> %a) #0 {
139 ; CHECK-LABEL: reverse_nxv2f64:
141 ; CHECK-NEXT: rev z0.d, z0.d
144 %res = call <vscale x 2 x double> @llvm.experimental.vector.reverse.nxv2f64(<vscale x 2 x double> %a)
145 ret <vscale x 2 x double> %res
148 ; Verify promote type legalisation works as expected.
149 define <vscale x 2 x i8> @reverse_nxv2i8(<vscale x 2 x i8> %a) #0 {
150 ; CHECK-LABEL: reverse_nxv2i8:
152 ; CHECK-NEXT: rev z0.d, z0.d
155 %res = call <vscale x 2 x i8> @llvm.experimental.vector.reverse.nxv2i8(<vscale x 2 x i8> %a)
156 ret <vscale x 2 x i8> %res
159 ; Verify splitvec type legalisation works as expected.
160 define <vscale x 8 x i32> @reverse_nxv8i32(<vscale x 8 x i32> %a) #0 {
161 ; CHECK-LABEL: reverse_nxv8i32:
162 ; CHECK-SELDAG: // %bb.0:
163 ; CHECK-SELDAG-NEXT: rev z2.s, z1.s
164 ; CHECK-SELDAG-NEXT: rev z1.s, z0.s
165 ; CHECK-SELDAG-NEXT: mov z0.d, z2.d
166 ; CHECK-SELDAG-NEXT: ret
167 ; CHECK-FASTISEL: // %bb.0:
168 ; CHECK-FASTISEL-NEXT: str x29, [sp, #-16]
169 ; CHECK-FASTISEL-NEXT: addvl sp, sp, #-1
170 ; CHECK-FASTISEL-NEXT: str z1, [sp]
171 ; CHECK-FASTISEL-NEXT: mov z1.d, z0.d
172 ; CHECK-FASTISEL-NEXT: ldr z0, [sp]
173 ; CHECK-FASTISEL-NEXT: rev z0.s, z0.s
174 ; CHECK-FASTISEL-NEXT: rev z1.s, z1.s
175 ; CHECK-FASTISEL-NEXT: addvl sp, sp, #1
176 ; CHECK-FASTISEL-NEXT: ldr x29, [sp], #16
177 ; CHECK-FASTISEL-NEXT: ret
179 %res = call <vscale x 8 x i32> @llvm.experimental.vector.reverse.nxv8i32(<vscale x 8 x i32> %a)
180 ret <vscale x 8 x i32> %res
183 ; Verify splitvec type legalisation works as expected.
184 define <vscale x 16 x float> @reverse_nxv16f32(<vscale x 16 x float> %a) #0 {
185 ; CHECK-LABEL: reverse_nxv16f32:
186 ; CHECK-SELDAG: // %bb.0:
187 ; CHECK-SELDAG-NEXT: rev z5.s, z3.s
188 ; CHECK-SELDAG-NEXT: rev z4.s, z2.s
189 ; CHECK-SELDAG-NEXT: rev z2.s, z1.s
190 ; CHECK-SELDAG-NEXT: rev z3.s, z0.s
191 ; CHECK-SELDAG-NEXT: mov z0.d, z5.d
192 ; CHECK-SELDAG-NEXT: mov z1.d, z4.d
193 ; CHECK-SELDAG-NEXT: ret
194 ; CHECK-FASTISEL: // %bb.0:
195 ; CHECK-FASTISEL-NEXT: str x29, [sp, #-16]
196 ; CHECK-FASTISEL-NEXT: addvl sp, sp, #-2
197 ; CHECK-FASTISEL-NEXT: str z3, [sp, #1, mul vl]
198 ; CHECK-FASTISEL-NEXT: str z2, [sp]
199 ; CHECK-FASTISEL-NEXT: mov z2.d, z1.d
200 ; CHECK-FASTISEL-NEXT: ldr z1, [sp]
201 ; CHECK-FASTISEL-NEXT: mov z3.d, z0.d
202 ; CHECK-FASTISEL-NEXT: ldr z0, [sp, #1, mul vl]
203 ; CHECK-FASTISEL-NEXT: rev z0.s, z0.s
204 ; CHECK-FASTISEL-NEXT: rev z1.s, z1.s
205 ; CHECK-FASTISEL-NEXT: rev z2.s, z2.s
206 ; CHECK-FASTISEL-NEXT: rev z3.s, z3.s
207 ; CHECK-FASTISEL-NEXT: addvl sp, sp, #2
208 ; CHECK-FASTISEL-NEXT: ldr x29, [sp], #16
209 ; CHECK-FASTISEL-NEXT: ret
211 %res = call <vscale x 16 x float> @llvm.experimental.vector.reverse.nxv16f32(<vscale x 16 x float> %a)
212 ret <vscale x 16 x float> %res
216 declare <vscale x 2 x i1> @llvm.experimental.vector.reverse.nxv2i1(<vscale x 2 x i1>)
217 declare <vscale x 4 x i1> @llvm.experimental.vector.reverse.nxv4i1(<vscale x 4 x i1>)
218 declare <vscale x 8 x i1> @llvm.experimental.vector.reverse.nxv8i1(<vscale x 8 x i1>)
219 declare <vscale x 16 x i1> @llvm.experimental.vector.reverse.nxv16i1(<vscale x 16 x i1>)
220 declare <vscale x 32 x i1> @llvm.experimental.vector.reverse.nxv32i1(<vscale x 32 x i1>)
221 declare <vscale x 2 x i8> @llvm.experimental.vector.reverse.nxv2i8(<vscale x 2 x i8>)
222 declare <vscale x 16 x i8> @llvm.experimental.vector.reverse.nxv16i8(<vscale x 16 x i8>)
223 declare <vscale x 8 x i16> @llvm.experimental.vector.reverse.nxv8i16(<vscale x 8 x i16>)
224 declare <vscale x 4 x i32> @llvm.experimental.vector.reverse.nxv4i32(<vscale x 4 x i32>)
225 declare <vscale x 8 x i32> @llvm.experimental.vector.reverse.nxv8i32(<vscale x 8 x i32>)
226 declare <vscale x 2 x i64> @llvm.experimental.vector.reverse.nxv2i64(<vscale x 2 x i64>)
227 declare <vscale x 8 x half> @llvm.experimental.vector.reverse.nxv8f16(<vscale x 8 x half>)
228 declare <vscale x 4 x float> @llvm.experimental.vector.reverse.nxv4f32(<vscale x 4 x float>)
229 declare <vscale x 16 x float> @llvm.experimental.vector.reverse.nxv16f32(<vscale x 16 x float>)
230 declare <vscale x 2 x double> @llvm.experimental.vector.reverse.nxv2f64(<vscale x 2 x double>)
233 attributes #0 = { nounwind "target-features"="+sve" }