Skip to content

Commit 11e1378

Browse files
[LLVM][CodeGen][SVE] Increase vector.insert test coverage.
1 parent 327edbe commit 11e1378

File tree

1 file changed

+260
-0
lines changed

1 file changed

+260
-0
lines changed
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s | FileCheck %s
3+
4+
target triple = "aarch64-unknown-linux-gnu"
5+
6+
; half vectors
7+
8+
define <vscale x 4 x half> @insert_into_poison_nxv4f16_nxv2f16_0(<vscale x 2 x half> %a) #0 {
9+
; CHECK-LABEL: insert_into_poison_nxv4f16_nxv2f16_0:
10+
; CHECK: // %bb.0:
11+
; CHECK-NEXT: uunpkhi z1.d, z0.s
12+
; CHECK-NEXT: uzp1 z0.s, z0.s, z1.s
13+
; CHECK-NEXT: ret
14+
%res = call <vscale x 4 x half> @llvm.vector.insert.nxv4f16.nxv2f16(<vscale x 4 x half> poison, <vscale x 2 x half> %a, i64 0)
15+
ret <vscale x 4 x half> %res
16+
}
17+
18+
define <vscale x 4 x half> @insert_into_poison_nxv4f16_nxv2f16_2(<vscale x 2 x half> %a) #0 {
19+
; CHECK-LABEL: insert_into_poison_nxv4f16_nxv2f16_2:
20+
; CHECK: // %bb.0:
21+
; CHECK-NEXT: uunpklo z1.d, z0.s
22+
; CHECK-NEXT: uzp1 z0.s, z1.s, z0.s
23+
; CHECK-NEXT: ret
24+
%res = call <vscale x 4 x half> @llvm.vector.insert.nxv4f16.nxv2f16(<vscale x 4 x half> poison, <vscale x 2 x half> %a, i64 2)
25+
ret <vscale x 4 x half> %res
26+
}
27+
28+
define <vscale x 8 x half> @insert_into_poison_nxv8f16_nxv2f16_0(<vscale x 2 x half> %a) #0 {
29+
; CHECK-LABEL: insert_into_poison_nxv8f16_nxv2f16_0:
30+
; CHECK: // %bb.0:
31+
; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
32+
; CHECK-NEXT: addvl sp, sp, #-1
33+
; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 8 * VG
34+
; CHECK-NEXT: .cfi_offset w29, -16
35+
; CHECK-NEXT: ptrue p0.d
36+
; CHECK-NEXT: ptrue p1.h
37+
; CHECK-NEXT: st1h { z0.d }, p0, [sp]
38+
; CHECK-NEXT: ld1h { z0.h }, p1/z, [sp]
39+
; CHECK-NEXT: addvl sp, sp, #1
40+
; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
41+
; CHECK-NEXT: ret
42+
%res = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.nxv2f16(<vscale x 8 x half> poison, <vscale x 2 x half> %a, i64 0)
43+
ret <vscale x 8 x half> %res
44+
}
45+
46+
define <vscale x 8 x half> @insert_into_poison_nxv8f16_nxv2f16_2(<vscale x 2 x half> %a) #0 {
47+
; CHECK-LABEL: insert_into_poison_nxv8f16_nxv2f16_2:
48+
; CHECK: // %bb.0:
49+
; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
50+
; CHECK-NEXT: addvl sp, sp, #-1
51+
; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 8 * VG
52+
; CHECK-NEXT: .cfi_offset w29, -16
53+
; CHECK-NEXT: ptrue p0.d
54+
; CHECK-NEXT: ptrue p1.h
55+
; CHECK-NEXT: st1h { z0.d }, p0, [sp, #1, mul vl]
56+
; CHECK-NEXT: ld1h { z0.h }, p1/z, [sp]
57+
; CHECK-NEXT: addvl sp, sp, #1
58+
; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
59+
; CHECK-NEXT: ret
60+
%res = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.nxv2f16(<vscale x 8 x half> poison, <vscale x 2 x half> %a, i64 2)
61+
ret <vscale x 8 x half> %res
62+
}
63+
64+
define <vscale x 8 x half> @insert_into_poison_nxv8f16_nxv2f16_4(<vscale x 2 x half> %a) #0 {
65+
; CHECK-LABEL: insert_into_poison_nxv8f16_nxv2f16_4:
66+
; CHECK: // %bb.0:
67+
; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
68+
; CHECK-NEXT: addvl sp, sp, #-1
69+
; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 8 * VG
70+
; CHECK-NEXT: .cfi_offset w29, -16
71+
; CHECK-NEXT: ptrue p0.d
72+
; CHECK-NEXT: ptrue p1.h
73+
; CHECK-NEXT: st1h { z0.d }, p0, [sp, #2, mul vl]
74+
; CHECK-NEXT: ld1h { z0.h }, p1/z, [sp]
75+
; CHECK-NEXT: addvl sp, sp, #1
76+
; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
77+
; CHECK-NEXT: ret
78+
%res = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.nxv2f16(<vscale x 8 x half> poison, <vscale x 2 x half> %a, i64 4)
79+
ret <vscale x 8 x half> %res
80+
}
81+
82+
define <vscale x 8 x half> @insert_into_poison_nxv8f16_nxv2f16_6(<vscale x 2 x half> %a) #0 {
83+
; CHECK-LABEL: insert_into_poison_nxv8f16_nxv2f16_6:
84+
; CHECK: // %bb.0:
85+
; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
86+
; CHECK-NEXT: addvl sp, sp, #-1
87+
; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 8 * VG
88+
; CHECK-NEXT: .cfi_offset w29, -16
89+
; CHECK-NEXT: ptrue p0.d
90+
; CHECK-NEXT: ptrue p1.h
91+
; CHECK-NEXT: st1h { z0.d }, p0, [sp, #3, mul vl]
92+
; CHECK-NEXT: ld1h { z0.h }, p1/z, [sp]
93+
; CHECK-NEXT: addvl sp, sp, #1
94+
; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
95+
; CHECK-NEXT: ret
96+
%res = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.nxv2f16(<vscale x 8 x half> poison, <vscale x 2 x half> %a, i64 6)
97+
ret <vscale x 8 x half> %res
98+
}
99+
100+
define <vscale x 8 x half> @insert_into_poison_nxv8f16_nxv4f16_0(<vscale x 4 x half> %a) #0 {
101+
; CHECK-LABEL: insert_into_poison_nxv8f16_nxv4f16_0:
102+
; CHECK: // %bb.0:
103+
; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
104+
; CHECK-NEXT: ret
105+
%res = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.nxv4f16(<vscale x 8 x half> poison, <vscale x 4 x half> %a, i64 0)
106+
ret <vscale x 8 x half> %res
107+
}
108+
109+
define <vscale x 8 x half> @insert_into_poison_nxv8f16_nxv4f16_4(<vscale x 4 x half> %a) #0 {
110+
; CHECK-LABEL: insert_into_poison_nxv8f16_nxv4f16_4:
111+
; CHECK: // %bb.0:
112+
; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
113+
; CHECK-NEXT: ret
114+
%res = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.nxv4f16(<vscale x 8 x half> poison, <vscale x 4 x half> %a, i64 4)
115+
ret <vscale x 8 x half> %res
116+
}
117+
118+
; float vectors
119+
define <vscale x 4 x float> @insert_into_poison_nxv4f32_nxv2f32_0(<vscale x 2 x float> %a) #0 {
120+
; CHECK-LABEL: insert_into_poison_nxv4f32_nxv2f32_0:
121+
; CHECK: // %bb.0:
122+
; CHECK-NEXT: uzp1 z0.s, z0.s, z0.s
123+
; CHECK-NEXT: ret
124+
%res = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.nxv2f32(<vscale x 4 x float> poison, <vscale x 2 x float> %a, i64 0)
125+
ret <vscale x 4 x float> %res
126+
}
127+
128+
define <vscale x 4 x float> @insert_into_poison_nxv4f32_nxv2f32_2(<vscale x 2 x float> %a) #0 {
129+
; CHECK-LABEL: insert_into_poison_nxv4f32_nxv2f32_2:
130+
; CHECK: // %bb.0:
131+
; CHECK-NEXT: uzp1 z0.s, z0.s, z0.s
132+
; CHECK-NEXT: ret
133+
%res = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.nxv2f32(<vscale x 4 x float> poison, <vscale x 2 x float> %a, i64 2)
134+
ret <vscale x 4 x float> %res
135+
}
136+
137+
; bfloat vectors
138+
139+
define <vscale x 4 x bfloat> @insert_into_poison_nxv4bf16_nxv2bf16_0(<vscale x 2 x bfloat> %a) #0 {
140+
; CHECK-LABEL: insert_into_poison_nxv4bf16_nxv2bf16_0:
141+
; CHECK: // %bb.0:
142+
; CHECK-NEXT: uunpkhi z1.d, z0.s
143+
; CHECK-NEXT: uzp1 z0.s, z0.s, z1.s
144+
; CHECK-NEXT: ret
145+
%res = call <vscale x 4 x bfloat> @llvm.vector.insert.nxv4bf16.nxv2bf16(<vscale x 4 x bfloat> poison, <vscale x 2 x bfloat> %a, i64 0)
146+
ret <vscale x 4 x bfloat> %res
147+
}
148+
149+
define <vscale x 4 x bfloat> @insert_into_poison_nxv4bf16_nxv2bf16_2(<vscale x 2 x bfloat> %a) #0 {
150+
; CHECK-LABEL: insert_into_poison_nxv4bf16_nxv2bf16_2:
151+
; CHECK: // %bb.0:
152+
; CHECK-NEXT: uunpklo z1.d, z0.s
153+
; CHECK-NEXT: uzp1 z0.s, z1.s, z0.s
154+
; CHECK-NEXT: ret
155+
%res = call <vscale x 4 x bfloat> @llvm.vector.insert.nxv4bf16.nxv2bf16(<vscale x 4 x bfloat> poison, <vscale x 2 x bfloat> %a, i64 2)
156+
ret <vscale x 4 x bfloat> %res
157+
}
158+
159+
define <vscale x 8 x bfloat> @insert_into_poison_nxv8bf16_nxv2bf16_0(<vscale x 2 x bfloat> %a) #0 {
160+
; CHECK-LABEL: insert_into_poison_nxv8bf16_nxv2bf16_0:
161+
; CHECK: // %bb.0:
162+
; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
163+
; CHECK-NEXT: addvl sp, sp, #-1
164+
; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 8 * VG
165+
; CHECK-NEXT: .cfi_offset w29, -16
166+
; CHECK-NEXT: ptrue p0.d
167+
; CHECK-NEXT: ptrue p1.h
168+
; CHECK-NEXT: st1h { z0.d }, p0, [sp]
169+
; CHECK-NEXT: ld1h { z0.h }, p1/z, [sp]
170+
; CHECK-NEXT: addvl sp, sp, #1
171+
; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
172+
; CHECK-NEXT: ret
173+
%res = call <vscale x 8 x bfloat> @llvm.vector.insert.nxv8bf16.nxv2bf16(<vscale x 8 x bfloat> poison, <vscale x 2 x bfloat> %a, i64 0)
174+
ret <vscale x 8 x bfloat> %res
175+
}
176+
177+
define <vscale x 8 x bfloat> @insert_into_poison_nxv8bf16_nxv2bf16_2(<vscale x 2 x bfloat> %a) #0 {
178+
; CHECK-LABEL: insert_into_poison_nxv8bf16_nxv2bf16_2:
179+
; CHECK: // %bb.0:
180+
; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
181+
; CHECK-NEXT: addvl sp, sp, #-1
182+
; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 8 * VG
183+
; CHECK-NEXT: .cfi_offset w29, -16
184+
; CHECK-NEXT: ptrue p0.d
185+
; CHECK-NEXT: ptrue p1.h
186+
; CHECK-NEXT: st1h { z0.d }, p0, [sp, #1, mul vl]
187+
; CHECK-NEXT: ld1h { z0.h }, p1/z, [sp]
188+
; CHECK-NEXT: addvl sp, sp, #1
189+
; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
190+
; CHECK-NEXT: ret
191+
%res = call <vscale x 8 x bfloat> @llvm.vector.insert.nxv8bf16.nxv2bf16(<vscale x 8 x bfloat> poison, <vscale x 2 x bfloat> %a, i64 2)
192+
ret <vscale x 8 x bfloat> %res
193+
}
194+
195+
define <vscale x 8 x bfloat> @insert_into_poison_nxv8bf16_nxv2bf16_4(<vscale x 2 x bfloat> %a) #0 {
196+
; CHECK-LABEL: insert_into_poison_nxv8bf16_nxv2bf16_4:
197+
; CHECK: // %bb.0:
198+
; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
199+
; CHECK-NEXT: addvl sp, sp, #-1
200+
; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 8 * VG
201+
; CHECK-NEXT: .cfi_offset w29, -16
202+
; CHECK-NEXT: ptrue p0.d
203+
; CHECK-NEXT: ptrue p1.h
204+
; CHECK-NEXT: st1h { z0.d }, p0, [sp, #2, mul vl]
205+
; CHECK-NEXT: ld1h { z0.h }, p1/z, [sp]
206+
; CHECK-NEXT: addvl sp, sp, #1
207+
; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
208+
; CHECK-NEXT: ret
209+
%res = call <vscale x 8 x bfloat> @llvm.vector.insert.nxv8bf16.nxv2bf16(<vscale x 8 x bfloat> poison, <vscale x 2 x bfloat> %a, i64 4)
210+
ret <vscale x 8 x bfloat> %res
211+
}
212+
213+
define <vscale x 8 x bfloat> @insert_into_poison_nxv8bf16_nxv2bf16_6(<vscale x 2 x bfloat> %a) #0 {
214+
; CHECK-LABEL: insert_into_poison_nxv8bf16_nxv2bf16_6:
215+
; CHECK: // %bb.0:
216+
; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
217+
; CHECK-NEXT: addvl sp, sp, #-1
218+
; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 8 * VG
219+
; CHECK-NEXT: .cfi_offset w29, -16
220+
; CHECK-NEXT: ptrue p0.d
221+
; CHECK-NEXT: ptrue p1.h
222+
; CHECK-NEXT: st1h { z0.d }, p0, [sp, #3, mul vl]
223+
; CHECK-NEXT: ld1h { z0.h }, p1/z, [sp]
224+
; CHECK-NEXT: addvl sp, sp, #1
225+
; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
226+
; CHECK-NEXT: ret
227+
%res = call <vscale x 8 x bfloat> @llvm.vector.insert.nxv8bf16.nxv2bf16(<vscale x 8 x bfloat> poison, <vscale x 2 x bfloat> %a, i64 6)
228+
ret <vscale x 8 x bfloat> %res
229+
}
230+
231+
define <vscale x 8 x bfloat> @insert_into_poison_nxv8bf16_nxv4bf16_0(<vscale x 4 x bfloat> %a) #0 {
232+
; CHECK-LABEL: insert_into_poison_nxv8bf16_nxv4bf16_0:
233+
; CHECK: // %bb.0:
234+
; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
235+
; CHECK-NEXT: ret
236+
%res = call <vscale x 8 x bfloat> @llvm.vector.insert.nxv8bf16.nxv4bf16(<vscale x 8 x bfloat> poison, <vscale x 4 x bfloat> %a, i64 0)
237+
ret <vscale x 8 x bfloat> %res
238+
}
239+
240+
define <vscale x 8 x bfloat> @insert_into_poison_nxv8bf16_nxv4bf16_4(<vscale x 4 x bfloat> %a) #0 {
241+
; CHECK-LABEL: insert_into_poison_nxv8bf16_nxv4bf16_4:
242+
; CHECK: // %bb.0:
243+
; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
244+
; CHECK-NEXT: ret
245+
%res = call <vscale x 8 x bfloat> @llvm.vector.insert.nxv8bf16.nxv4bf16(<vscale x 8 x bfloat> poison, <vscale x 4 x bfloat> %a, i64 4)
246+
ret <vscale x 8 x bfloat> %res
247+
}
248+
249+
attributes #0 = { "target-features"="+sve,+bf16" }
250+
251+
declare <vscale x 4 x half> @llvm.vector.insert.nxv4f16.nxv2f16(<vscale x 4 x half>, <vscale x 2 x half>, i64)
252+
declare <vscale x 8 x half> @llvm.vector.insert.nxv8f16.nxv2f16(<vscale x 8 x half>, <vscale x 2 x half>, i64)
253+
declare <vscale x 8 x half> @llvm.vector.insert.nxv8f16.nxv4f16(<vscale x 8 x half>, <vscale x 4 x half>, i64)
254+
255+
declare <vscale x 4 x float> @llvm.vector.insert.nxv4f32.nxv2f32(<vscale x 4 x float>, <vscale x 2 x float>, i64)
256+
257+
declare <vscale x 4 x bfloat> @llvm.vector.insert.nxv4bf16.nxv2bf16(<vscale x 4 x bfloat>, <vscale x 2 x bfloat>, i64)
258+
declare <vscale x 8 x bfloat> @llvm.vector.insert.nxv8bf16.nxv2bf16(<vscale x 8 x bfloat>, <vscale x 2 x bfloat>, i64)
259+
declare <vscale x 8 x bfloat> @llvm.vector.insert.nxv8bf16.nxv4bf16(<vscale x 8 x bfloat>, <vscale x 4 x bfloat>, i64)
260+

0 commit comments

Comments
 (0)