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 define <vscale x 2 x i64> @masked_gather_nxv2i8(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
5 ; CHECK-LABEL: masked_gather_nxv2i8:
7 ; CHECK-NEXT: ld1b { z0.d }, p0/z, [z0.d, #1]
9 %ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i32 1
10 %vals = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %mask, <vscale x 2 x i8> undef)
11 %vals.zext = zext <vscale x 2 x i8> %vals to <vscale x 2 x i64>
12 ret <vscale x 2 x i64> %vals.zext
15 define <vscale x 2 x i64> @masked_gather_nxv2i16(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
16 ; CHECK-LABEL: masked_gather_nxv2i16:
18 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [z0.d, #2]
20 %ptrs = getelementptr i16, <vscale x 2 x ptr> %bases, i32 1
21 %vals = call <vscale x 2 x i16> @llvm.masked.gather.nxv2i16(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %mask, <vscale x 2 x i16> undef)
22 %vals.zext = zext <vscale x 2 x i16> %vals to <vscale x 2 x i64>
23 ret <vscale x 2 x i64> %vals.zext
26 define <vscale x 2 x i64> @masked_gather_nxv2i32(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
27 ; CHECK-LABEL: masked_gather_nxv2i32:
29 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [z0.d, #4]
31 %ptrs = getelementptr i32, <vscale x 2 x ptr> %bases, i32 1
32 %vals = call <vscale x 2 x i32> @llvm.masked.gather.nxv2i32(<vscale x 2 x ptr> %ptrs, i32 4, <vscale x 2 x i1> %mask, <vscale x 2 x i32> undef)
33 %vals.zext = zext <vscale x 2 x i32> %vals to <vscale x 2 x i64>
34 ret <vscale x 2 x i64> %vals.zext
37 define <vscale x 2 x i64> @masked_gather_nxv2i64(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
38 ; CHECK-LABEL: masked_gather_nxv2i64:
40 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [z0.d, #8]
42 %ptrs = getelementptr i64, <vscale x 2 x ptr> %bases, i32 1
43 %vals.zext = call <vscale x 2 x i64> @llvm.masked.gather.nxv2i64(<vscale x 2 x ptr> %ptrs, i32 8, <vscale x 2 x i1> %mask, <vscale x 2 x i64> undef)
44 ret <vscale x 2 x i64> %vals.zext
47 define <vscale x 2 x half> @masked_gather_nxv2f16(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
48 ; CHECK-LABEL: masked_gather_nxv2f16:
50 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [z0.d, #4]
52 %ptrs = getelementptr half, <vscale x 2 x ptr> %bases, i32 2
53 %vals = call <vscale x 2 x half> @llvm.masked.gather.nxv2f16(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %mask, <vscale x 2 x half> undef)
54 ret <vscale x 2 x half> %vals
57 define <vscale x 2 x bfloat> @masked_gather_nxv2bf16(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) #0 {
58 ; CHECK-LABEL: masked_gather_nxv2bf16:
60 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [z0.d, #4]
62 %ptrs = getelementptr bfloat, <vscale x 2 x ptr> %bases, i32 2
63 %vals = call <vscale x 2 x bfloat> @llvm.masked.gather.nxv2bf16(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %mask, <vscale x 2 x bfloat> undef)
64 ret <vscale x 2 x bfloat> %vals
67 define <vscale x 2 x float> @masked_gather_nxv2f32(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
68 ; CHECK-LABEL: masked_gather_nxv2f32:
70 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [z0.d, #12]
72 %ptrs = getelementptr float, <vscale x 2 x ptr> %bases, i32 3
73 %vals = call <vscale x 2 x float> @llvm.masked.gather.nxv2f32(<vscale x 2 x ptr> %ptrs, i32 4, <vscale x 2 x i1> %mask, <vscale x 2 x float> undef)
74 ret <vscale x 2 x float> %vals
77 define <vscale x 2 x double> @masked_gather_nxv2f64(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
78 ; CHECK-LABEL: masked_gather_nxv2f64:
80 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [z0.d, #32]
82 %ptrs = getelementptr double, <vscale x 2 x ptr> %bases, i32 4
83 %vals = call <vscale x 2 x double> @llvm.masked.gather.nxv2f64(<vscale x 2 x ptr> %ptrs, i32 8, <vscale x 2 x i1> %mask, <vscale x 2 x double> undef)
84 ret <vscale x 2 x double> %vals
87 define <vscale x 2 x i64> @masked_sgather_nxv2i8(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
88 ; CHECK-LABEL: masked_sgather_nxv2i8:
90 ; CHECK-NEXT: ld1sb { z0.d }, p0/z, [z0.d, #5]
92 %ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i32 5
93 %vals = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %mask, <vscale x 2 x i8> undef)
94 %vals.sext = sext <vscale x 2 x i8> %vals to <vscale x 2 x i64>
95 ret <vscale x 2 x i64> %vals.sext
98 define <vscale x 2 x i64> @masked_sgather_nxv2i16(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
99 ; CHECK-LABEL: masked_sgather_nxv2i16:
101 ; CHECK-NEXT: ld1sh { z0.d }, p0/z, [z0.d, #12]
103 %ptrs = getelementptr i16, <vscale x 2 x ptr> %bases, i32 6
104 %vals = call <vscale x 2 x i16> @llvm.masked.gather.nxv2i16(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %mask, <vscale x 2 x i16> undef)
105 %vals.sext = sext <vscale x 2 x i16> %vals to <vscale x 2 x i64>
106 ret <vscale x 2 x i64> %vals.sext
109 define <vscale x 2 x i64> @masked_sgather_nxv2i32(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
110 ; CHECK-LABEL: masked_sgather_nxv2i32:
112 ; CHECK-NEXT: ld1sw { z0.d }, p0/z, [z0.d, #28]
114 %ptrs = getelementptr i32, <vscale x 2 x ptr> %bases, i32 7
115 %vals = call <vscale x 2 x i32> @llvm.masked.gather.nxv2i32(<vscale x 2 x ptr> %ptrs, i32 4, <vscale x 2 x i1> %mask, <vscale x 2 x i32> undef)
116 %vals.sext = sext <vscale x 2 x i32> %vals to <vscale x 2 x i64>
117 ret <vscale x 2 x i64> %vals.sext
120 ; Tests where the immediate is out of range
122 define <vscale x 2 x i64> @masked_gather_nxv2i8_range(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
123 ; CHECK-LABEL: masked_gather_nxv2i8_range:
125 ; CHECK-NEXT: mov w8, #32
126 ; CHECK-NEXT: ld1b { z0.d }, p0/z, [x8, z0.d]
128 %ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i32 32
129 %vals = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %mask, <vscale x 2 x i8> undef)
130 %vals.zext = zext <vscale x 2 x i8> %vals to <vscale x 2 x i64>
131 ret <vscale x 2 x i64> %vals.zext
134 define <vscale x 2 x half> @masked_gather_nxv2f16_range(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
135 ; CHECK-LABEL: masked_gather_nxv2f16_range:
137 ; CHECK-NEXT: mov w8, #64
138 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x8, z0.d]
140 %ptrs = getelementptr half, <vscale x 2 x ptr> %bases, i32 32
141 %vals = call <vscale x 2 x half> @llvm.masked.gather.nxv2f16(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %mask, <vscale x 2 x half> undef)
142 ret <vscale x 2 x half> %vals
145 define <vscale x 2 x bfloat> @masked_gather_nxv2bf16_range(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) #0 {
146 ; CHECK-LABEL: masked_gather_nxv2bf16_range:
148 ; CHECK-NEXT: mov w8, #64
149 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x8, z0.d]
151 %ptrs = getelementptr bfloat, <vscale x 2 x ptr> %bases, i32 32
152 %vals = call <vscale x 2 x bfloat> @llvm.masked.gather.nxv2bf16(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %mask, <vscale x 2 x bfloat> undef)
153 ret <vscale x 2 x bfloat> %vals
156 define <vscale x 2 x float> @masked_gather_nxv2f32_range(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
157 ; CHECK-LABEL: masked_gather_nxv2f32_range:
159 ; CHECK-NEXT: mov w8, #128
160 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x8, z0.d]
162 %ptrs = getelementptr float, <vscale x 2 x ptr> %bases, i32 32
163 %vals = call <vscale x 2 x float> @llvm.masked.gather.nxv2f32(<vscale x 2 x ptr> %ptrs, i32 4, <vscale x 2 x i1> %mask, <vscale x 2 x float> undef)
164 ret <vscale x 2 x float> %vals
167 define <vscale x 2 x double> @masked_gather_nxv2f64_range(<vscale x 2 x ptr> %bases, <vscale x 2 x i1> %mask) {
168 ; CHECK-LABEL: masked_gather_nxv2f64_range:
170 ; CHECK-NEXT: mov w8, #256
171 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x8, z0.d]
173 %ptrs = getelementptr double, <vscale x 2 x ptr> %bases, i32 32
174 %vals = call <vscale x 2 x double> @llvm.masked.gather.nxv2f64(<vscale x 2 x ptr> %ptrs, i32 8, <vscale x 2 x i1> %mask, <vscale x 2 x double> undef)
175 ret <vscale x 2 x double> %vals
178 declare <vscale x 2 x i8> @llvm.masked.gather.nxv2i8(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x i8>)
179 declare <vscale x 2 x i16> @llvm.masked.gather.nxv2i16(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x i16>)
180 declare <vscale x 2 x i32> @llvm.masked.gather.nxv2i32(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x i32>)
181 declare <vscale x 2 x i64> @llvm.masked.gather.nxv2i64(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x i64>)
182 declare <vscale x 2 x half> @llvm.masked.gather.nxv2f16(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x half>)
183 declare <vscale x 2 x bfloat> @llvm.masked.gather.nxv2bf16(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x bfloat>)
184 declare <vscale x 2 x float> @llvm.masked.gather.nxv2f32(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x float>)
185 declare <vscale x 2 x double> @llvm.masked.gather.nxv2f64(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x double>)
186 attributes #0 = { "target-features"="+sve,+bf16" }