xref: /llvm-project/llvm/test/CodeGen/AArch64/sve-masked-gather-64b-unscaled.ll (revision 5ddce70ef0e5a641d7fea95e31fc5e2439cb98cb)
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
4
5define <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:
7; CHECK:       // %bb.0:
8; CHECK-NEXT:    ld1b { z0.d }, p0/z, [x0, z0.d]
9; CHECK-NEXT:    ret
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
14}
15
16define <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:
18; CHECK:       // %bb.0:
19; CHECK-NEXT:    ld1h { z0.d }, p0/z, [x0, z0.d]
20; CHECK-NEXT:    ret
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
26}
27
28define <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:
30; CHECK:       // %bb.0:
31; CHECK-NEXT:    ld1w { z0.d }, p0/z, [x0, z0.d]
32; CHECK-NEXT:    ret
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
38}
39
40define <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:
42; CHECK:       // %bb.0:
43; CHECK-NEXT:    ld1d { z0.d }, p0/z, [x0, z0.d]
44; CHECK-NEXT:    ret
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
49}
50
51define <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:
53; CHECK:       // %bb.0:
54; CHECK-NEXT:    ld1h { z0.d }, p0/z, [x0, z0.d]
55; CHECK-NEXT:    ret
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
60}
61
62define <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:
64; CHECK:       // %bb.0:
65; CHECK-NEXT:    ld1h { z0.d }, p0/z, [x0, z0.d]
66; CHECK-NEXT:    ret
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
71}
72
73define <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:
75; CHECK:       // %bb.0:
76; CHECK-NEXT:    ld1w { z0.d }, p0/z, [x0, z0.d]
77; CHECK-NEXT:    ret
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
82}
83
84define <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:
86; CHECK:       // %bb.0:
87; CHECK-NEXT:    ld1d { z0.d }, p0/z, [x0, z0.d]
88; CHECK-NEXT:    ret
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
93}
94
95define <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:
97; CHECK:       // %bb.0:
98; CHECK-NEXT:    ld1sb { z0.d }, p0/z, [x0, z0.d]
99; CHECK-NEXT:    ret
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
104}
105
106define <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:
108; CHECK:       // %bb.0:
109; CHECK-NEXT:    ld1sh { z0.d }, p0/z, [x0, z0.d]
110; CHECK-NEXT:    ret
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
116}
117
118define <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:
120; CHECK:       // %bb.0:
121; CHECK-NEXT:    ld1sw { z0.d }, p0/z, [x0, z0.d]
122; CHECK-NEXT:    ret
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
128}
129
130declare <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>)
131declare <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>)
132declare <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>)
133declare <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>)
134declare <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>)
135declare <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>)
136declare <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>)
137declare <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>)
138attributes #0 = { "target-features"="+sve,+bf16" }
139