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_nxv2i8(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
6 ; CHECK-LABEL: masked_gather_nxv2i8:
8 ; CHECK-NEXT: ld1b { z0.d }, p0/z, [x0, z0.d]
10 %ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
11 %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)
12 %vals.zext = zext <vscale x 2 x i8> %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_nxv2i16(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
17 ; CHECK-LABEL: masked_gather_nxv2i16:
19 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, z0.d]
21 %byte_ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
22 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
23 %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)
24 %vals.zext = zext <vscale x 2 x i16> %vals to <vscale x 2 x i64>
25 ret <vscale x 2 x i64> %vals.zext
28 define <vscale x 2 x i64> @masked_gather_nxv2i32(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
29 ; CHECK-LABEL: masked_gather_nxv2i32:
31 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0, z0.d]
33 %byte_ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
34 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
35 %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)
36 %vals.zext = zext <vscale x 2 x i32> %vals to <vscale x 2 x i64>
37 ret <vscale x 2 x i64> %vals.zext
40 define <vscale x 2 x i64> @masked_gather_nxv2i64(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
41 ; CHECK-LABEL: masked_gather_nxv2i64:
43 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0, z0.d]
45 %byte_ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
46 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
47 %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)
48 ret <vscale x 2 x i64> %vals
51 define <vscale x 2 x half> @masked_gather_nxv2f16(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
52 ; CHECK-LABEL: masked_gather_nxv2f16:
54 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, z0.d]
56 %byte_ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
57 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
58 %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)
59 ret <vscale x 2 x half> %vals
62 define <vscale x 2 x bfloat> @masked_gather_nxv2bf16(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) #0 {
63 ; CHECK-LABEL: masked_gather_nxv2bf16:
65 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, z0.d]
67 %byte_ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
68 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
69 %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)
70 ret <vscale x 2 x bfloat> %vals
73 define <vscale x 2 x float> @masked_gather_nxv2f32(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
74 ; CHECK-LABEL: masked_gather_nxv2f32:
76 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0, z0.d]
78 %byte_ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
79 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
80 %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)
81 ret <vscale x 2 x float> %vals
84 define <vscale x 2 x double> @masked_gather_nxv2f64(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
85 ; CHECK-LABEL: masked_gather_nxv2f64:
87 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0, z0.d]
89 %byte_ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
90 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
91 %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)
92 ret <vscale x 2 x double> %vals
95 define <vscale x 2 x i64> @masked_sgather_nxv2i8(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
96 ; CHECK-LABEL: masked_sgather_nxv2i8:
98 ; CHECK-NEXT: ld1sb { z0.d }, p0/z, [x0, z0.d]
100 %ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
101 %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)
102 %vals.sext = sext <vscale x 2 x i8> %vals to <vscale x 2 x i64>
103 ret <vscale x 2 x i64> %vals.sext
106 define <vscale x 2 x i64> @masked_sgather_nxv2i16(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
107 ; CHECK-LABEL: masked_sgather_nxv2i16:
109 ; CHECK-NEXT: ld1sh { z0.d }, p0/z, [x0, z0.d]
111 %byte_ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
112 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
113 %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)
114 %vals.sext = sext <vscale x 2 x i16> %vals to <vscale x 2 x i64>
115 ret <vscale x 2 x i64> %vals.sext
118 define <vscale x 2 x i64> @masked_sgather_nxv2i32(ptr %base, <vscale x 2 x i64> %offsets, <vscale x 2 x i1> %mask) {
119 ; CHECK-LABEL: masked_sgather_nxv2i32:
121 ; CHECK-NEXT: ld1sw { z0.d }, p0/z, [x0, z0.d]
123 %byte_ptrs = getelementptr i8, ptr %base, <vscale x 2 x i64> %offsets
124 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
125 %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)
126 %vals.sext = sext <vscale x 2 x i32> %vals to <vscale x 2 x i64>
127 ret <vscale x 2 x i64> %vals.sext
130 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>)
131 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>)
132 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>)
133 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>)
134 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>)
135 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>)
136 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>)
137 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>)
138 attributes #0 = { "target-features"="+sve,+bf16" }