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 <16 x i8> @reverse_v16i8(<16 x i8> %a) #0 {
12 ; CHECK-LABEL: reverse_v16i8:
14 ; CHECK-NEXT: rev64 v0.16b, v0.16b
15 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
18 %res = call <16 x i8> @llvm.vector.reverse.v16i8(<16 x i8> %a)
22 define <8 x i16> @reverse_v8i16(<8 x i16> %a) #0 {
23 ; CHECK-LABEL: reverse_v8i16:
25 ; CHECK-NEXT: rev64 v0.8h, v0.8h
26 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
29 %res = call <8 x i16> @llvm.vector.reverse.v8i16(<8 x i16> %a)
33 define <2 x i16> @reverse_v2i16(<2 x i16> %a) #0 {
34 ; CHECK-LABEL: reverse_v2i16:
36 ; CHECK-NEXT: rev64 v0.2s, v0.2s
38 %res = call <2 x i16> @llvm.vector.reverse.v2i16(<2 x i16> %a)
42 define <2 x i32> @reverse_v2i32(<2 x i32> %a) #0 {
43 ; CHECK-LABEL: reverse_v2i32:
45 ; CHECK-NEXT: rev64 v0.2s, v0.2s
47 %res = call <2 x i32> @llvm.vector.reverse.v2i32(<2 x i32> %a)
51 define <4 x i32> @reverse_v4i32(<4 x i32> %a) #0 {
52 ; CHECK-LABEL: reverse_v4i32:
54 ; CHECK-NEXT: rev64 v0.4s, v0.4s
55 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
58 %res = call <4 x i32> @llvm.vector.reverse.v4i32(<4 x i32> %a)
62 define <2 x i64> @reverse_v2i64(<2 x i64> %a) #0 {
63 ; CHECK-LABEL: reverse_v2i64:
65 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
68 %res = call <2 x i64> @llvm.vector.reverse.v2i64(<2 x i64> %a)
72 define <8 x half> @reverse_v8f16(<8 x half> %a) #0 {
73 ; CHECK-LABEL: reverse_v8f16:
75 ; CHECK-NEXT: rev64 v0.8h, v0.8h
76 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
79 %res = call <8 x half> @llvm.vector.reverse.v8f16(<8 x half> %a)
83 define <2 x float> @reverse_v2f32(<2 x float> %a) #0 {
84 ; CHECK-LABEL: reverse_v2f32:
86 ; CHECK-NEXT: rev64 v0.2s, v0.2s
88 %res = call <2 x float> @llvm.vector.reverse.v2f32(<2 x float> %a)
92 define <4 x float> @reverse_v4f32(<4 x float> %a) #0 {
93 ; CHECK-LABEL: reverse_v4f32:
95 ; CHECK-NEXT: rev64 v0.4s, v0.4s
96 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
99 %res = call <4 x float> @llvm.vector.reverse.v4f32(<4 x float> %a)
103 define <2 x double> @reverse_v2f64(<2 x double> %a) #0 {
104 ; CHECK-LABEL: reverse_v2f64:
106 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
109 %res = call <2 x double> @llvm.vector.reverse.v2f64(<2 x double> %a)
110 ret <2 x double> %res
113 ; Verify promote type legalisation works as expected.
114 define <2 x i8> @reverse_v2i8(<2 x i8> %a) #0 {
115 ; CHECK-LABEL: reverse_v2i8:
117 ; CHECK-NEXT: rev64 v0.2s, v0.2s
120 %res = call <2 x i8> @llvm.vector.reverse.v2i8(<2 x i8> %a)
124 ; Verify splitvec type legalisation works as expected.
125 define <8 x i32> @reverse_v8i32(<8 x i32> %a) #0 {
126 ; CHECK-SELDAG-LABEL: reverse_v8i32:
127 ; CHECK-SELDAG: // %bb.0:
128 ; CHECK-SELDAG-NEXT: rev64 v1.4s, v1.4s
129 ; CHECK-SELDAG-NEXT: rev64 v2.4s, v0.4s
130 ; CHECK-SELDAG-NEXT: ext v0.16b, v1.16b, v1.16b, #8
131 ; CHECK-SELDAG-NEXT: ext v1.16b, v2.16b, v2.16b, #8
132 ; CHECK-SELDAG-NEXT: ret
134 ; CHECK-FASTISEL-LABEL: reverse_v8i32:
135 ; CHECK-FASTISEL: // %bb.0:
136 ; CHECK-FASTISEL-NEXT: sub sp, sp, #16
137 ; CHECK-FASTISEL-NEXT: str q1, [sp] // 16-byte Folded Spill
138 ; CHECK-FASTISEL-NEXT: mov v1.16b, v0.16b
139 ; CHECK-FASTISEL-NEXT: ldr q0, [sp] // 16-byte Folded Reload
140 ; CHECK-FASTISEL-NEXT: rev64 v0.4s, v0.4s
141 ; CHECK-FASTISEL-NEXT: ext v0.16b, v0.16b, v0.16b, #8
142 ; CHECK-FASTISEL-NEXT: rev64 v1.4s, v1.4s
143 ; CHECK-FASTISEL-NEXT: ext v1.16b, v1.16b, v1.16b, #8
144 ; CHECK-FASTISEL-NEXT: add sp, sp, #16
145 ; CHECK-FASTISEL-NEXT: ret
147 %res = call <8 x i32> @llvm.vector.reverse.v8i32(<8 x i32> %a)
151 ; Verify splitvec type legalisation works as expected.
152 define <16 x float> @reverse_v16f32(<16 x float> %a) #0 {
153 ; CHECK-SELDAG-LABEL: reverse_v16f32:
154 ; CHECK-SELDAG: // %bb.0:
155 ; CHECK-SELDAG-NEXT: rev64 v3.4s, v3.4s
156 ; CHECK-SELDAG-NEXT: rev64 v2.4s, v2.4s
157 ; CHECK-SELDAG-NEXT: rev64 v4.4s, v1.4s
158 ; CHECK-SELDAG-NEXT: rev64 v5.4s, v0.4s
159 ; CHECK-SELDAG-NEXT: ext v0.16b, v3.16b, v3.16b, #8
160 ; CHECK-SELDAG-NEXT: ext v1.16b, v2.16b, v2.16b, #8
161 ; CHECK-SELDAG-NEXT: ext v2.16b, v4.16b, v4.16b, #8
162 ; CHECK-SELDAG-NEXT: ext v3.16b, v5.16b, v5.16b, #8
163 ; CHECK-SELDAG-NEXT: ret
165 ; CHECK-FASTISEL-LABEL: reverse_v16f32:
166 ; CHECK-FASTISEL: // %bb.0:
167 ; CHECK-FASTISEL-NEXT: sub sp, sp, #32
168 ; CHECK-FASTISEL-NEXT: str q3, [sp, #16] // 16-byte Folded Spill
169 ; CHECK-FASTISEL-NEXT: str q2, [sp] // 16-byte Folded Spill
170 ; CHECK-FASTISEL-NEXT: mov v2.16b, v1.16b
171 ; CHECK-FASTISEL-NEXT: ldr q1, [sp] // 16-byte Folded Reload
172 ; CHECK-FASTISEL-NEXT: mov v3.16b, v0.16b
173 ; CHECK-FASTISEL-NEXT: ldr q0, [sp, #16] // 16-byte Folded Reload
174 ; CHECK-FASTISEL-NEXT: rev64 v0.4s, v0.4s
175 ; CHECK-FASTISEL-NEXT: ext v0.16b, v0.16b, v0.16b, #8
176 ; CHECK-FASTISEL-NEXT: rev64 v1.4s, v1.4s
177 ; CHECK-FASTISEL-NEXT: ext v1.16b, v1.16b, v1.16b, #8
178 ; CHECK-FASTISEL-NEXT: rev64 v2.4s, v2.4s
179 ; CHECK-FASTISEL-NEXT: ext v2.16b, v2.16b, v2.16b, #8
180 ; CHECK-FASTISEL-NEXT: rev64 v3.4s, v3.4s
181 ; CHECK-FASTISEL-NEXT: ext v3.16b, v3.16b, v3.16b, #8
182 ; CHECK-FASTISEL-NEXT: add sp, sp, #32
183 ; CHECK-FASTISEL-NEXT: ret
185 %res = call <16 x float> @llvm.vector.reverse.v16f32(<16 x float> %a)
186 ret <16 x float> %res
190 declare <2 x i8> @llvm.vector.reverse.v2i8(<2 x i8>)
191 declare <16 x i8> @llvm.vector.reverse.v16i8(<16 x i8>)
192 declare <8 x i16> @llvm.vector.reverse.v8i16(<8 x i16>)
193 declare <2 x i16> @llvm.vector.reverse.v2i16(<2 x i16>)
194 declare <2 x i32> @llvm.vector.reverse.v2i32(<2 x i32>)
195 declare <4 x i32> @llvm.vector.reverse.v4i32(<4 x i32>)
196 declare <8 x i32> @llvm.vector.reverse.v8i32(<8 x i32>)
197 declare <2 x i64> @llvm.vector.reverse.v2i64(<2 x i64>)
198 declare <8 x half> @llvm.vector.reverse.v8f16(<8 x half>)
199 declare <2 x float> @llvm.vector.reverse.v2f32(<2 x float>)
200 declare <4 x float> @llvm.vector.reverse.v4f32(<4 x float>)
201 declare <16 x float> @llvm.vector.reverse.v16f32(<16 x float>)
202 declare <2 x double> @llvm.vector.reverse.v2f64(<2 x double>)
204 attributes #0 = { nounwind "target-features"="+neon" }