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 ; Range checks: for all the instruction tested in this file, the
5 ; immediate must be within the range [-8, 7] (4-bit immediate). Out of
6 ; range values are tested only in one case (following). Valid values
7 ; are tested all through the rest of the file.
9 define void @imm_out_of_range(ptr %base, <vscale x 2 x i1> %mask) nounwind {
10 ; CHECK-LABEL: imm_out_of_range:
12 ; CHECK-NEXT: rdvl x8, #8
13 ; CHECK-NEXT: add x8, x0, x8
14 ; CHECK-NEXT: ldnt1d { z0.d }, p0/z, [x8]
15 ; CHECK-NEXT: rdvl x8, #-9
16 ; CHECK-NEXT: add x8, x0, x8
17 ; CHECK-NEXT: stnt1d { z0.d }, p0, [x8]
19 %base_load = getelementptr <vscale x 2 x i64>, ptr %base, i64 8
20 %base_load_bc = bitcast ptr %base_load to ptr
21 %data = call <vscale x 2 x i64> @llvm.aarch64.sve.ldnt1.nxv2i64(<vscale x 2 x i1> %mask,
23 %base_store = getelementptr <vscale x 2 x i64>, ptr %base, i64 -9
24 %base_store_bc = bitcast ptr %base_store to ptr
25 call void @llvm.aarch64.sve.stnt1.nxv2i64(<vscale x 2 x i64> %data,
26 <vscale x 2 x i1> %mask,
31 ; 2-lane non-temporal load/stores
34 define void @test_masked_ldst_sv2i64(ptr %base, <vscale x 2 x i1> %mask) nounwind {
35 ; CHECK-LABEL: test_masked_ldst_sv2i64:
37 ; CHECK-NEXT: ldnt1d { z0.d }, p0/z, [x0, #-8, mul vl]
38 ; CHECK-NEXT: stnt1d { z0.d }, p0, [x0, #-7, mul vl]
40 %base_load = getelementptr <vscale x 2 x i64>, ptr %base, i64 -8
41 %base_load_bc = bitcast ptr %base_load to ptr
42 %data = call <vscale x 2 x i64> @llvm.aarch64.sve.ldnt1.nxv2i64(<vscale x 2 x i1> %mask,
44 %base_store = getelementptr <vscale x 2 x i64>, ptr %base, i64 -7
45 %base_store_bc = bitcast ptr %base_store to ptr
46 call void @llvm.aarch64.sve.stnt1.nxv2i64(<vscale x 2 x i64> %data,
47 <vscale x 2 x i1> %mask,
52 define void @test_masked_ldst_sv2f64(ptr %base, <vscale x 2 x i1> %mask) nounwind {
53 ; CHECK-LABEL: test_masked_ldst_sv2f64:
55 ; CHECK-NEXT: ldnt1d { z0.d }, p0/z, [x0, #-6, mul vl]
56 ; CHECK-NEXT: stnt1d { z0.d }, p0, [x0, #-5, mul vl]
58 %base_load = getelementptr <vscale x 2 x double>, ptr %base, i64 -6
59 %base_load_bc = bitcast ptr %base_load to ptr
60 %data = call <vscale x 2 x double> @llvm.aarch64.sve.ldnt1.nxv2f64(<vscale x 2 x i1> %mask,
62 %base_store = getelementptr <vscale x 2 x double>, ptr %base, i64 -5
63 %base_store_bc = bitcast ptr %base_store to ptr
64 call void @llvm.aarch64.sve.stnt1.nxv2f64(<vscale x 2 x double> %data,
65 <vscale x 2 x i1> %mask,
70 ; 4-lane non-temporal load/stores.
72 define void @test_masked_ldst_sv4i32(ptr %base, <vscale x 4 x i1> %mask) nounwind {
73 ; CHECK-LABEL: test_masked_ldst_sv4i32:
75 ; CHECK-NEXT: ldnt1w { z0.s }, p0/z, [x0, #6, mul vl]
76 ; CHECK-NEXT: stnt1w { z0.s }, p0, [x0, #7, mul vl]
78 %base_load = getelementptr <vscale x 4 x i32>, ptr %base, i64 6
79 %base_load_bc = bitcast ptr %base_load to ptr
80 %data = call <vscale x 4 x i32> @llvm.aarch64.sve.ldnt1.nxv4i32(<vscale x 4 x i1> %mask,
82 %base_store = getelementptr <vscale x 4 x i32>, ptr %base, i64 7
83 %base_store_bc = bitcast ptr %base_store to ptr
84 call void @llvm.aarch64.sve.stnt1.nxv4i32(<vscale x 4 x i32> %data,
85 <vscale x 4 x i1> %mask,
90 define void @test_masked_ldst_sv4f32(ptr %base, <vscale x 4 x i1> %mask) nounwind {
91 ; CHECK-LABEL: test_masked_ldst_sv4f32:
93 ; CHECK-NEXT: ldnt1w { z0.s }, p0/z, [x0, #-1, mul vl]
94 ; CHECK-NEXT: stnt1w { z0.s }, p0, [x0, #2, mul vl]
96 %base_load = getelementptr <vscale x 4 x float>, ptr %base, i64 -1
97 %base_load_bc = bitcast ptr %base_load to ptr
98 %data = call <vscale x 4 x float> @llvm.aarch64.sve.ldnt1.nxv4f32(<vscale x 4 x i1> %mask,
100 %base_store = getelementptr <vscale x 4 x float>, ptr %base, i64 2
101 %base_store_bc = bitcast ptr %base_store to ptr
102 call void @llvm.aarch64.sve.stnt1.nxv4f32(<vscale x 4 x float> %data,
103 <vscale x 4 x i1> %mask,
109 ; 8-lane non-temporal load/stores.
111 define void @test_masked_ldst_sv8i16(ptr %base, <vscale x 8 x i1> %mask) nounwind {
112 ; CHECK-LABEL: test_masked_ldst_sv8i16:
114 ; CHECK-NEXT: ldnt1h { z0.h }, p0/z, [x0, #6, mul vl]
115 ; CHECK-NEXT: stnt1h { z0.h }, p0, [x0, #7, mul vl]
117 %base_load = getelementptr <vscale x 8 x i16>, ptr %base, i64 6
118 %base_load_bc = bitcast ptr %base_load to ptr
119 %data = call <vscale x 8 x i16> @llvm.aarch64.sve.ldnt1.nxv8i16(<vscale x 8 x i1> %mask,
121 %base_store = getelementptr <vscale x 8 x i16>, ptr %base, i64 7
122 %base_store_bc = bitcast ptr %base_store to ptr
123 call void @llvm.aarch64.sve.stnt1.nxv8i16(<vscale x 8 x i16> %data,
124 <vscale x 8 x i1> %mask,
129 define void @test_masked_ldst_sv8f16(ptr %base, <vscale x 8 x i1> %mask) nounwind {
130 ; CHECK-LABEL: test_masked_ldst_sv8f16:
132 ; CHECK-NEXT: ldnt1h { z0.h }, p0/z, [x0, #-1, mul vl]
133 ; CHECK-NEXT: stnt1h { z0.h }, p0, [x0, #2, mul vl]
135 %base_load = getelementptr <vscale x 8 x half>, ptr %base, i64 -1
136 %base_load_bc = bitcast ptr %base_load to ptr
137 %data = call <vscale x 8 x half> @llvm.aarch64.sve.ldnt1.nxv8f16(<vscale x 8 x i1> %mask,
139 %base_store = getelementptr <vscale x 8 x half>, ptr %base, i64 2
140 %base_store_bc = bitcast ptr %base_store to ptr
141 call void @llvm.aarch64.sve.stnt1.nxv8f16(<vscale x 8 x half> %data,
142 <vscale x 8 x i1> %mask,
147 define void @test_masked_ldst_sv8bf16(ptr %base, <vscale x 8 x i1> %mask) nounwind #0 {
148 ; CHECK-LABEL: test_masked_ldst_sv8bf16:
150 ; CHECK-NEXT: ldnt1h { z0.h }, p0/z, [x0, #-1, mul vl]
151 ; CHECK-NEXT: stnt1h { z0.h }, p0, [x0, #2, mul vl]
153 %base_load = getelementptr <vscale x 8 x bfloat>, ptr %base, i64 -1
154 %base_load_bc = bitcast ptr %base_load to ptr
155 %data = call <vscale x 8 x bfloat> @llvm.aarch64.sve.ldnt1.nxv8bf16(<vscale x 8 x i1> %mask,
157 %base_store = getelementptr <vscale x 8 x bfloat>, ptr %base, i64 2
158 %base_store_bc = bitcast ptr %base_store to ptr
159 call void @llvm.aarch64.sve.stnt1.nxv8bf16(<vscale x 8 x bfloat> %data,
160 <vscale x 8 x i1> %mask,
165 ; 16-lane non-temporal load/stores.
167 define void @test_masked_ldst_sv16i8(ptr %base, <vscale x 16 x i1> %mask) nounwind {
168 ; CHECK-LABEL: test_masked_ldst_sv16i8:
170 ; CHECK-NEXT: ldnt1b { z0.b }, p0/z, [x0, #6, mul vl]
171 ; CHECK-NEXT: stnt1b { z0.b }, p0, [x0, #7, mul vl]
173 %base_load = getelementptr <vscale x 16 x i8>, ptr %base, i64 6
174 %base_load_bc = bitcast ptr %base_load to ptr
175 %data = call <vscale x 16 x i8> @llvm.aarch64.sve.ldnt1.nxv16i8(<vscale x 16 x i1> %mask,
177 %base_store = getelementptr <vscale x 16 x i8>, ptr %base, i64 7
178 %base_store_bc = bitcast ptr %base_store to ptr
179 call void @llvm.aarch64.sve.stnt1.nxv16i8(<vscale x 16 x i8> %data,
180 <vscale x 16 x i1> %mask,
185 ; 2-element non-temporal loads.
186 declare <vscale x 2 x i64> @llvm.aarch64.sve.ldnt1.nxv2i64(<vscale x 2 x i1>, ptr)
187 declare <vscale x 2 x double> @llvm.aarch64.sve.ldnt1.nxv2f64(<vscale x 2 x i1>, ptr)
189 ; 4-element non-temporal loads.
190 declare <vscale x 4 x i32> @llvm.aarch64.sve.ldnt1.nxv4i32(<vscale x 4 x i1>, ptr)
191 declare <vscale x 4 x float> @llvm.aarch64.sve.ldnt1.nxv4f32(<vscale x 4 x i1>, ptr)
193 ; 8-element non-temporal loads.
194 declare <vscale x 8 x i16> @llvm.aarch64.sve.ldnt1.nxv8i16(<vscale x 8 x i1>, ptr)
195 declare <vscale x 8 x half> @llvm.aarch64.sve.ldnt1.nxv8f16(<vscale x 8 x i1>, ptr)
196 declare <vscale x 8 x bfloat> @llvm.aarch64.sve.ldnt1.nxv8bf16(<vscale x 8 x i1>, ptr)
198 ; 16-element non-temporal loads.
199 declare <vscale x 16 x i8> @llvm.aarch64.sve.ldnt1.nxv16i8(<vscale x 16 x i1>, ptr)
201 ; 2-element non-temporal stores.
202 declare void @llvm.aarch64.sve.stnt1.nxv2i64(<vscale x 2 x i64>, <vscale x 2 x i1>, ptr)
203 declare void @llvm.aarch64.sve.stnt1.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, ptr)
205 ; 4-element non-temporal stores.
206 declare void @llvm.aarch64.sve.stnt1.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i1>, ptr)
207 declare void @llvm.aarch64.sve.stnt1.nxv4f32(<vscale x 4 x float>, <vscale x 4 x i1>, ptr)
209 ; 8-element non-temporal stores.
210 declare void @llvm.aarch64.sve.stnt1.nxv8i16(<vscale x 8 x i16>, <vscale x 8 x i1>, ptr)
211 declare void @llvm.aarch64.sve.stnt1.nxv8f16(<vscale x 8 x half>, <vscale x 8 x i1>, ptr)
212 declare void @llvm.aarch64.sve.stnt1.nxv8bf16(<vscale x 8 x bfloat>, <vscale x 8 x i1>, ptr)
214 ; 16-element non-temporal stores.
215 declare void @llvm.aarch64.sve.stnt1.nxv16i8(<vscale x 16 x i8>, <vscale x 16 x i1>, ptr)
217 ; +bf16 is required for the bfloat version.
218 attributes #0 = { "target-features"="+sve,+bf16" }