1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
4 ; These tests are here to ensure we don't get a selection error caused
5 ; by performPostLD1Combine, which should bail out if the return
6 ; type is not 128 or 64 bit vector.
8 define <vscale x 4 x i32> @test_post_ld1_insert(ptr %a, ptr %ptr, i64 %inc) {
9 ; CHECK-LABEL: test_post_ld1_insert:
11 ; CHECK-NEXT: ldr w8, [x0]
12 ; CHECK-NEXT: fmov s0, w8
13 ; CHECK-NEXT: add x8, x0, x2, lsl #2
14 ; CHECK-NEXT: str x8, [x1]
16 %load = load i32, ptr %a
17 %ins = insertelement <vscale x 4 x i32> undef, i32 %load, i32 0
18 %gep = getelementptr i32, ptr %a, i64 %inc
19 store ptr %gep, ptr %ptr
20 ret <vscale x 4 x i32> %ins
23 define <vscale x 2 x double> @test_post_ld1_dup(ptr %a, ptr %ptr, i64 %inc) {
24 ; CHECK-LABEL: test_post_ld1_dup:
26 ; CHECK-NEXT: ptrue p0.d
27 ; CHECK-NEXT: add x8, x0, x2, lsl #3
28 ; CHECK-NEXT: ld1rd { z0.d }, p0/z, [x0]
29 ; CHECK-NEXT: str x8, [x1]
31 %load = load double, ptr %a
32 %dup = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double %load)
33 %gep = getelementptr double, ptr %a, i64 %inc
34 store ptr %gep, ptr %ptr
35 ret <vscale x 2 x double> %dup
38 define <4 x i64> @test_post_ld1_int_fixed(ptr %data, i64 %idx, ptr %addr) #1 {
39 ; CHECK-LABEL: test_post_ld1_int_fixed:
41 ; CHECK-NEXT: ptrue p0.d
42 ; CHECK-NEXT: mov w9, #2 // =0x2
43 ; CHECK-NEXT: index z0.d, #0, #1
44 ; CHECK-NEXT: ptrue p1.d, vl1
45 ; CHECK-NEXT: mov z1.d, x9
46 ; CHECK-NEXT: ld1d { z2.d }, p0/z, [x2]
47 ; CHECK-NEXT: cmpeq p2.d, p0/z, z0.d, z1.d
48 ; CHECK-NEXT: ldr x9, [x0]
49 ; CHECK-NEXT: ldr x10, [x0, x1, lsl #3]
50 ; CHECK-NEXT: mov z0.d, z2.d
51 ; CHECK-NEXT: mov z2.d, p2/m, x10
52 ; CHECK-NEXT: mov z0.d, p1/m, x9
53 ; CHECK-NEXT: add z0.d, z0.d, z2.d
54 ; CHECK-NEXT: st1d { z0.d }, p0, [x8]
56 %A = load <4 x i64>, ptr %addr
57 %ld1 = load i64, ptr %data
58 %vec1 = insertelement <4 x i64> %A, i64 %ld1, i32 0
59 %gep = getelementptr i64, ptr %data, i64 %idx
60 %ld2 = load i64, ptr %gep
61 %vec2 = insertelement <4 x i64> %A, i64 %ld2, i32 2
62 %res = add <4 x i64> %vec1, %vec2
66 define <4 x double> @test_post_ld1_double_fixed(ptr %data, i64 %idx, ptr %addr) #1 {
67 ; CHECK-LABEL: test_post_ld1_double_fixed:
69 ; CHECK-NEXT: ptrue p0.d
70 ; CHECK-NEXT: mov w9, #2 // =0x2
71 ; CHECK-NEXT: index z0.d, #0, #1
72 ; CHECK-NEXT: mov z1.d, x9
73 ; CHECK-NEXT: ptrue p1.d, vl1
74 ; CHECK-NEXT: ld1d { z2.d }, p0/z, [x2]
75 ; CHECK-NEXT: cmpeq p2.d, p0/z, z0.d, z1.d
76 ; CHECK-NEXT: ldr d0, [x0]
77 ; CHECK-NEXT: ldr d1, [x0, x1, lsl #3]
78 ; CHECK-NEXT: sel z0.d, p1, z0.d, z2.d
79 ; CHECK-NEXT: mov z2.d, p2/m, d1
80 ; CHECK-NEXT: fadd z0.d, z0.d, z2.d
81 ; CHECK-NEXT: st1d { z0.d }, p0, [x8]
83 %A = load <4 x double>, ptr %addr
84 %ld1 = load double, ptr %data
85 %vec1 = insertelement <4 x double> %A, double %ld1, i32 0
86 %gep = getelementptr double, ptr %data, i64 %idx
87 %ld2 = load double, ptr %gep
88 %vec2 = insertelement <4 x double> %A, double %ld2, i32 2
89 %res = fadd <4 x double> %vec1, %vec2
92 attributes #1 = { vscale_range(2,2) "target-features"="+neon,+sve" }
94 declare <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double)