1 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
4 ; LD1B, LD1W, LD1H, LD1D: vector base + scalar offset (index)
5 ; e.g. ld1b { z0.d }, p0/z, [x0, z0.d]
9 define <vscale x 4 x i32> @gld1b_s_scalar_offset(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %base, i64 %offset) {
10 ; CHECK-LABEL: gld1b_s_scalar_offset:
11 ; CHECK: ld1b { z0.s }, p0/z, [x0, z0.s, uxtw]
13 %load = call <vscale x 4 x i8> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4i8.nxv4i32(<vscale x 4 x i1> %pg,
14 <vscale x 4 x i32> %base,
16 %res = zext <vscale x 4 x i8> %load to <vscale x 4 x i32>
17 ret <vscale x 4 x i32> %res
20 define <vscale x 2 x i64> @gld1b_d_scalar_offset(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %base, i64 %offset) {
21 ; CHECK-LABEL: gld1b_d_scalar_offset:
22 ; CHECK: ld1b { z0.d }, p0/z, [x0, z0.d]
24 %load = call <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i8.nxv2i64(<vscale x 2 x i1> %pg,
25 <vscale x 2 x i64> %base,
27 %res = zext <vscale x 2 x i8> %load to <vscale x 2 x i64>
28 ret <vscale x 2 x i64> %res
32 define <vscale x 4 x i32> @gld1h_s_scalar_offset(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %base, i64 %offset) {
33 ; CHECK-LABEL: gld1h_s_scalar_offset:
34 ; CHECK: ld1h { z0.s }, p0/z, [x0, z0.s, uxtw]
36 %load = call <vscale x 4 x i16> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4i16.nxv4i32(<vscale x 4 x i1> %pg,
37 <vscale x 4 x i32> %base,
39 %res = zext <vscale x 4 x i16> %load to <vscale x 4 x i32>
40 ret <vscale x 4 x i32> %res
43 define <vscale x 2 x i64> @gld1h_d_scalar_offset(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %base, i64 %offset) {
44 ; CHECK-LABEL: gld1h_d_scalar_offset:
45 ; CHECK: ld1h { z0.d }, p0/z, [x0, z0.d]
47 %load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i16.nxv2i64(<vscale x 2 x i1> %pg,
48 <vscale x 2 x i64> %base,
50 %res = zext <vscale x 2 x i16> %load to <vscale x 2 x i64>
51 ret <vscale x 2 x i64> %res
55 define <vscale x 4 x i32> @gld1w_s_scalar_offset(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %base, i64 %offset) {
56 ; CHECK-LABEL: gld1w_s_scalar_offset:
57 ; CHECK: ld1w { z0.s }, p0/z, [x0, z0.s, uxtw]
59 %load = call <vscale x 4 x i32> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4i32.nxv4i32(<vscale x 4 x i1> %pg,
60 <vscale x 4 x i32> %base,
62 ret <vscale x 4 x i32> %load
65 define <vscale x 2 x i64> @gld1w_d_scalar_offset(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %base, i64 %offset) {
66 ; CHECK-LABEL: gld1w_d_scalar_offset:
67 ; CHECK: ld1w { z0.d }, p0/z, [x0, z0.d]
69 %load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i32.nxv2i64(<vscale x 2 x i1> %pg,
70 <vscale x 2 x i64> %base,
72 %res = zext <vscale x 2 x i32> %load to <vscale x 2 x i64>
73 ret <vscale x 2 x i64> %res
76 define <vscale x 4 x float> @gld1w_s_scalar_offset_float(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %base, i64 %offset) {
77 ; CHECK-LABEL: gld1w_s_scalar_offset_float:
78 ; CHECK: ld1w { z0.s }, p0/z, [x0, z0.s, uxtw]
80 %load = call <vscale x 4 x float> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4f32.nxv4i32(<vscale x 4 x i1> %pg,
81 <vscale x 4 x i32> %base,
83 ret <vscale x 4 x float> %load
87 define <vscale x 2 x i64> @gld1d_d_scalar_offset(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %base, i64 %offset) {
88 ; CHECK-LABEL: gld1d_d_scalar_offset:
89 ; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d]
91 %load = call <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i64.nxv2i64(<vscale x 2 x i1> %pg,
92 <vscale x 2 x i64> %base,
94 ret <vscale x 2 x i64> %load
97 define <vscale x 2 x double> @gld1d_d_scalar_offset_double(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %base, i64 %offset) {
98 ; CHECK-LABEL: gld1d_d_scalar_offset_double:
99 ; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d]
101 %load = call <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2f64.nxv2i64(<vscale x 2 x i1> %pg,
102 <vscale x 2 x i64> %base,
104 ret <vscale x 2 x double> %load
107 ; LD1SB, LD1SW, LD1SH: vector base + scalar offset (index)
108 ; e.g. ld1b { z0.d }, p0/z, [x0, z0.d]
112 define <vscale x 4 x i32> @gld1sb_s_scalar_offset(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %base, i64 %offset) {
113 ; CHECK-LABEL: gld1sb_s_scalar_offset:
114 ; CHECK: ld1sb { z0.s }, p0/z, [x0, z0.s, uxtw]
116 %load = call <vscale x 4 x i8> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4i8.nxv4i32(<vscale x 4 x i1> %pg,
117 <vscale x 4 x i32> %base,
119 %res = sext <vscale x 4 x i8> %load to <vscale x 4 x i32>
120 ret <vscale x 4 x i32> %res
123 define <vscale x 2 x i64> @gld1sb_d_scalar_offset(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %base, i64 %offset) {
124 ; CHECK-LABEL: gld1sb_d_scalar_offset:
125 ; CHECK: ld1sb { z0.d }, p0/z, [x0, z0.d]
127 %load = call <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i8.nxv2i64(<vscale x 2 x i1> %pg,
128 <vscale x 2 x i64> %base,
130 %res = sext <vscale x 2 x i8> %load to <vscale x 2 x i64>
131 ret <vscale x 2 x i64> %res
135 define <vscale x 4 x i32> @gld1sh_s_scalar_offset(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %base, i64 %offset) {
136 ; CHECK-LABEL: gld1sh_s_scalar_offset:
137 ; CHECK: ld1sh { z0.s }, p0/z, [x0, z0.s, uxtw]
139 %load = call <vscale x 4 x i16> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4i16.nxv4i32(<vscale x 4 x i1> %pg,
140 <vscale x 4 x i32> %base,
142 %res = sext <vscale x 4 x i16> %load to <vscale x 4 x i32>
143 ret <vscale x 4 x i32> %res
146 define <vscale x 2 x i64> @gld1sh_d_scalar_offset(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %base, i64 %offset) {
147 ; CHECK-LABEL: gld1sh_d_scalar_offset:
148 ; CHECK: ld1sh { z0.d }, p0/z, [x0, z0.d]
150 %load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i16.nxv2i64(<vscale x 2 x i1> %pg,
151 <vscale x 2 x i64> %base,
153 %res = sext <vscale x 2 x i16> %load to <vscale x 2 x i64>
154 ret <vscale x 2 x i64> %res
158 define <vscale x 2 x i64> @gld1sw_d_scalar_offset(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %base, i64 %offset) {
159 ; CHECK-LABEL: gld1sw_d_scalar_offset:
160 ; CHECK: ld1sw { z0.d }, p0/z, [x0, z0.d]
162 %load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i32.nxv2i64(<vscale x 2 x i1> %pg,
163 <vscale x 2 x i64> %base,
165 %res = sext <vscale x 2 x i32> %load to <vscale x 2 x i64>
166 ret <vscale x 2 x i64> %res
170 declare <vscale x 4 x i8> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4i8.nxv4i32(<vscale x 4 x i1>, <vscale x 4 x i32>, i64)
171 declare <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i8.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, i64)
174 declare <vscale x 4 x i16> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4i16.nxv4i32(<vscale x 4 x i1>, <vscale x 4 x i32>, i64)
175 declare <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i16.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, i64)
178 declare <vscale x 4 x i32> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4i32.nxv4i32(<vscale x 4 x i1>, <vscale x 4 x i32>, i64)
179 declare <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i32.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, i64)
181 declare <vscale x 4 x float> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv4f32.nxv4i32(<vscale x 4 x i1>, <vscale x 4 x i32>, i64)
184 declare <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i64.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, i64)
186 declare <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2f64.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, i64)