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, i64 %offset, <vscale x 2 x i1> %mask) {
5 ; CHECK-LABEL: masked_gather_nxv2i8:
7 ; CHECK-NEXT: ld1b { z0.d }, p0/z, [x0, z0.d]
9 %ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
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, i64 %offset, <vscale x 2 x i1> %mask) {
16 ; CHECK-LABEL: masked_gather_nxv2i16:
18 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, z0.d]
20 %byte_ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
21 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
22 %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)
23 %vals.zext = zext <vscale x 2 x i16> %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_nxv2i32(<vscale x 2 x ptr> %bases, i64 %offset, <vscale x 2 x i1> %mask) {
28 ; CHECK-LABEL: masked_gather_nxv2i32:
30 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0, z0.d]
32 %byte_ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
33 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
34 %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)
35 %vals.zext = zext <vscale x 2 x i32> %vals to <vscale x 2 x i64>
36 ret <vscale x 2 x i64> %vals.zext
39 define <vscale x 2 x i64> @masked_gather_nxv2i64(<vscale x 2 x ptr> %bases, i64 %offset, <vscale x 2 x i1> %mask) {
40 ; CHECK-LABEL: masked_gather_nxv2i64:
42 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0, z0.d]
44 %byte_ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
45 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
46 %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)
47 ret <vscale x 2 x i64> %vals
50 define <vscale x 2 x half> @masked_gather_nxv2f16(<vscale x 2 x ptr> %bases, i64 %offset, <vscale x 2 x i1> %mask) {
51 ; CHECK-LABEL: masked_gather_nxv2f16:
53 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, z0.d]
55 %byte_ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
56 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
57 %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)
58 ret <vscale x 2 x half> %vals
61 define <vscale x 2 x bfloat> @masked_gather_nxv2bf16(<vscale x 2 x ptr> %bases, i64 %offset, <vscale x 2 x i1> %mask) #0 {
62 ; CHECK-LABEL: masked_gather_nxv2bf16:
64 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, z0.d]
66 %byte_ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
67 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
68 %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)
69 ret <vscale x 2 x bfloat> %vals
72 define <vscale x 2 x float> @masked_gather_nxv2f32(<vscale x 2 x ptr> %bases, i64 %offset, <vscale x 2 x i1> %mask) {
73 ; CHECK-LABEL: masked_gather_nxv2f32:
75 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0, z0.d]
77 %byte_ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
78 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
79 %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)
80 ret <vscale x 2 x float> %vals
83 define <vscale x 2 x double> @masked_gather_nxv2f64(<vscale x 2 x ptr> %bases, i64 %offset, <vscale x 2 x i1> %mask) {
84 ; CHECK-LABEL: masked_gather_nxv2f64:
86 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0, z0.d]
88 %byte_ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
89 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
90 %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)
91 ret <vscale x 2 x double> %vals
94 define <vscale x 2 x i64> @masked_sgather_nxv2i8(<vscale x 2 x ptr> %bases, i64 %offset, <vscale x 2 x i1> %mask) {
95 ; CHECK-LABEL: masked_sgather_nxv2i8:
97 ; CHECK-NEXT: ld1sb { z0.d }, p0/z, [x0, z0.d]
99 %ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
100 %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)
101 %vals.sext = sext <vscale x 2 x i8> %vals to <vscale x 2 x i64>
102 ret <vscale x 2 x i64> %vals.sext
105 define <vscale x 2 x i64> @masked_sgather_nxv2i16(<vscale x 2 x ptr> %bases, i64 %offset, <vscale x 2 x i1> %mask) {
106 ; CHECK-LABEL: masked_sgather_nxv2i16:
108 ; CHECK-NEXT: ld1sh { z0.d }, p0/z, [x0, z0.d]
110 %byte_ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
111 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
112 %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)
113 %vals.sext = sext <vscale x 2 x i16> %vals to <vscale x 2 x i64>
114 ret <vscale x 2 x i64> %vals.sext
117 define <vscale x 2 x i64> @masked_sgather_nxv2i32(<vscale x 2 x ptr> %bases, i64 %offset, <vscale x 2 x i1> %mask) {
118 ; CHECK-LABEL: masked_sgather_nxv2i32:
120 ; CHECK-NEXT: ld1sw { z0.d }, p0/z, [x0, z0.d]
122 %byte_ptrs = getelementptr i8, <vscale x 2 x ptr> %bases, i64 %offset
123 %ptrs = bitcast <vscale x 2 x ptr> %byte_ptrs to <vscale x 2 x ptr>
124 %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)
125 %vals.sext = sext <vscale x 2 x i32> %vals to <vscale x 2 x i64>
126 ret <vscale x 2 x i64> %vals.sext
129 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>)
130 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>)
131 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>)
132 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>)
133 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>)
134 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>)
135 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>)
136 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>)
137 attributes #0 = { "target-features"="+sve,+bf16" }