1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve -aarch64-enable-mgather-combine=0 < %s | FileCheck %s
3 ; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve -aarch64-enable-mgather-combine=1 < %s | FileCheck %s
5 define <vscale x 2 x i64> @masked_gather_nxv2i16(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
6 ; CHECK-LABEL: masked_gather_nxv2i16:
8 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, z0.d, lsl #1]
10 %ptrs = getelementptr i16, ptr %base, <vscale x 2 x i64> %offsets
11 %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)
12 %vals.zext = zext <vscale x 2 x i16> %vals to <vscale x 2 x i64>
13 ret <vscale x 2 x i64> %vals.zext
16 define <vscale x 2 x i64> @masked_gather_nxv2i32(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
17 ; CHECK-LABEL: masked_gather_nxv2i32:
19 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0, z0.d, lsl #2]
21 %ptrs = getelementptr i32, ptr %base, <vscale x 2 x i64> %offsets
22 %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)
23 %vals.zext = zext <vscale x 2 x i32> %vals to <vscale x 2 x i64>
24 ret <vscale x 2 x i64> %vals.zext
27 define <vscale x 2 x i64> @masked_gather_nxv2i64(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
28 ; CHECK-LABEL: masked_gather_nxv2i64:
30 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0, z0.d, lsl #3]
32 %ptrs = getelementptr i64, ptr %base, <vscale x 2 x i64> %offsets
33 %vals = 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)
34 ret <vscale x 2 x i64> %vals
37 define <vscale x 2 x half> @masked_gather_nxv2f16(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
38 ; CHECK-LABEL: masked_gather_nxv2f16:
40 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, z0.d, lsl #1]
42 %ptrs = getelementptr half, ptr %base, <vscale x 2 x i64> %offsets
43 %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)
44 ret <vscale x 2 x half> %vals
47 define <vscale x 2 x bfloat> @masked_gather_nxv2bf16(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) #0 {
48 ; CHECK-LABEL: masked_gather_nxv2bf16:
50 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, z0.d, lsl #1]
52 %ptrs = getelementptr bfloat, ptr %base, <vscale x 2 x i64> %offsets
53 %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)
54 ret <vscale x 2 x bfloat> %vals
57 define <vscale x 2 x float> @masked_gather_nxv2f32(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
58 ; CHECK-LABEL: masked_gather_nxv2f32:
60 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0, z0.d, lsl #2]
62 %ptrs = getelementptr float, ptr %base, <vscale x 2 x i64> %offsets
63 %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)
64 ret <vscale x 2 x float> %vals
67 define <vscale x 2 x double> @masked_gather_nxv2f64(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
68 ; CHECK-LABEL: masked_gather_nxv2f64:
70 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0, z0.d, lsl #3]
72 %ptrs = getelementptr double, ptr %base, <vscale x 2 x i64> %offsets
73 %vals.sext = 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)
74 ret <vscale x 2 x double> %vals.sext
77 define <vscale x 2 x i64> @masked_sgather_nxv2i16(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
78 ; CHECK-LABEL: masked_sgather_nxv2i16:
80 ; CHECK-NEXT: ld1sh { z0.d }, p0/z, [x0, z0.d, lsl #1]
82 %ptrs = getelementptr i16, ptr %base, <vscale x 2 x i64> %offsets
83 %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)
84 %vals.sext = sext <vscale x 2 x i16> %vals to <vscale x 2 x i64>
85 ret <vscale x 2 x i64> %vals.sext
88 define <vscale x 2 x i64> @masked_sgather_nxv2i32(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
89 ; CHECK-LABEL: masked_sgather_nxv2i32:
91 ; CHECK-NEXT: ld1sw { z0.d }, p0/z, [x0, z0.d, lsl #2]
93 %ptrs = getelementptr i32, ptr %base, <vscale x 2 x i64> %offsets
94 %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)
95 %vals.sext = sext <vscale x 2 x i32> %vals to <vscale x 2 x i64>
96 ret <vscale x 2 x i64> %vals.sext
99 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>)
100 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>)
101 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>)
102 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>)
103 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>)
104 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>)
105 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>)
106 attributes #0 = { "target-features"="+sve,+bf16" }