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(<vscale x 2 x i64> * %base, <vscale x 2 x i1> %mask) nounwind {
10 ; CHECK-LABEL: imm_out_of_range:
12 ; CHECK-NEXT: addvl x8, x0, #8
13 ; CHECK-NEXT: ldnt1d { z0.d }, p0/z, [x8]
14 ; CHECK-NEXT: addvl x8, x0, #-9
15 ; CHECK-NEXT: stnt1d { z0.d }, p0, [x8]
17 %base_load = getelementptr <vscale x 2 x i64>, <vscale x 2 x i64>* %base, i64 8
18 %base_load_bc = bitcast <vscale x 2 x i64>* %base_load to i64*
19 %data = call <vscale x 2 x i64> @llvm.aarch64.sve.ldnt1.nxv2i64(<vscale x 2 x i1> %mask,
21 %base_store = getelementptr <vscale x 2 x i64>, <vscale x 2 x i64> * %base, i64 -9
22 %base_store_bc = bitcast <vscale x 2 x i64>* %base_store to i64*
23 call void @llvm.aarch64.sve.stnt1.nxv2i64(<vscale x 2 x i64> %data,
24 <vscale x 2 x i1> %mask,
29 ; 2-lane non-temporal load/stores
32 define void @test_masked_ldst_sv2i64(<vscale x 2 x i64> * %base, <vscale x 2 x i1> %mask) nounwind {
33 ; CHECK-LABEL: test_masked_ldst_sv2i64:
35 ; CHECK-NEXT: ldnt1d { z0.d }, p0/z, [x0, #-8, mul vl]
36 ; CHECK-NEXT: stnt1d { z0.d }, p0, [x0, #-7, mul vl]
38 %base_load = getelementptr <vscale x 2 x i64>, <vscale x 2 x i64>* %base, i64 -8
39 %base_load_bc = bitcast <vscale x 2 x i64>* %base_load to i64*
40 %data = call <vscale x 2 x i64> @llvm.aarch64.sve.ldnt1.nxv2i64(<vscale x 2 x i1> %mask,
42 %base_store = getelementptr <vscale x 2 x i64>, <vscale x 2 x i64> * %base, i64 -7
43 %base_store_bc = bitcast <vscale x 2 x i64>* %base_store to i64*
44 call void @llvm.aarch64.sve.stnt1.nxv2i64(<vscale x 2 x i64> %data,
45 <vscale x 2 x i1> %mask,
50 define void @test_masked_ldst_sv2f64(<vscale x 2 x double> * %base, <vscale x 2 x i1> %mask) nounwind {
51 ; CHECK-LABEL: test_masked_ldst_sv2f64:
53 ; CHECK-NEXT: ldnt1d { z0.d }, p0/z, [x0, #-6, mul vl]
54 ; CHECK-NEXT: stnt1d { z0.d }, p0, [x0, #-5, mul vl]
56 %base_load = getelementptr <vscale x 2 x double>, <vscale x 2 x double>* %base, i64 -6
57 %base_load_bc = bitcast <vscale x 2 x double>* %base_load to double*
58 %data = call <vscale x 2 x double> @llvm.aarch64.sve.ldnt1.nxv2f64(<vscale x 2 x i1> %mask,
59 double* %base_load_bc)
60 %base_store = getelementptr <vscale x 2 x double>, <vscale x 2 x double> * %base, i64 -5
61 %base_store_bc = bitcast <vscale x 2 x double>* %base_store to double*
62 call void @llvm.aarch64.sve.stnt1.nxv2f64(<vscale x 2 x double> %data,
63 <vscale x 2 x i1> %mask,
64 double* %base_store_bc)
68 ; 4-lane non-temporal load/stores.
70 define void @test_masked_ldst_sv4i32(<vscale x 4 x i32> * %base, <vscale x 4 x i1> %mask) nounwind {
71 ; CHECK-LABEL: test_masked_ldst_sv4i32:
73 ; CHECK-NEXT: ldnt1w { z0.s }, p0/z, [x0, #6, mul vl]
74 ; CHECK-NEXT: stnt1w { z0.s }, p0, [x0, #7, mul vl]
76 %base_load = getelementptr <vscale x 4 x i32>, <vscale x 4 x i32>* %base, i64 6
77 %base_load_bc = bitcast <vscale x 4 x i32>* %base_load to i32*
78 %data = call <vscale x 4 x i32> @llvm.aarch64.sve.ldnt1.nxv4i32(<vscale x 4 x i1> %mask,
80 %base_store = getelementptr <vscale x 4 x i32>, <vscale x 4 x i32> * %base, i64 7
81 %base_store_bc = bitcast <vscale x 4 x i32>* %base_store to i32*
82 call void @llvm.aarch64.sve.stnt1.nxv4i32(<vscale x 4 x i32> %data,
83 <vscale x 4 x i1> %mask,
88 define void @test_masked_ldst_sv4f32(<vscale x 4 x float> * %base, <vscale x 4 x i1> %mask) nounwind {
89 ; CHECK-LABEL: test_masked_ldst_sv4f32:
91 ; CHECK-NEXT: ldnt1w { z0.s }, p0/z, [x0, #-1, mul vl]
92 ; CHECK-NEXT: stnt1w { z0.s }, p0, [x0, #2, mul vl]
94 %base_load = getelementptr <vscale x 4 x float>, <vscale x 4 x float>* %base, i64 -1
95 %base_load_bc = bitcast <vscale x 4 x float>* %base_load to float*
96 %data = call <vscale x 4 x float> @llvm.aarch64.sve.ldnt1.nxv4f32(<vscale x 4 x i1> %mask,
98 %base_store = getelementptr <vscale x 4 x float>, <vscale x 4 x float> * %base, i64 2
99 %base_store_bc = bitcast <vscale x 4 x float>* %base_store to float*
100 call void @llvm.aarch64.sve.stnt1.nxv4f32(<vscale x 4 x float> %data,
101 <vscale x 4 x i1> %mask,
102 float* %base_store_bc)
107 ; 8-lane non-temporal load/stores.
109 define void @test_masked_ldst_sv8i16(<vscale x 8 x i16> * %base, <vscale x 8 x i1> %mask) nounwind {
110 ; CHECK-LABEL: test_masked_ldst_sv8i16:
112 ; CHECK-NEXT: ldnt1h { z0.h }, p0/z, [x0, #6, mul vl]
113 ; CHECK-NEXT: stnt1h { z0.h }, p0, [x0, #7, mul vl]
115 %base_load = getelementptr <vscale x 8 x i16>, <vscale x 8 x i16>* %base, i64 6
116 %base_load_bc = bitcast <vscale x 8 x i16>* %base_load to i16*
117 %data = call <vscale x 8 x i16> @llvm.aarch64.sve.ldnt1.nxv8i16(<vscale x 8 x i1> %mask,
119 %base_store = getelementptr <vscale x 8 x i16>, <vscale x 8 x i16> * %base, i64 7
120 %base_store_bc = bitcast <vscale x 8 x i16>* %base_store to i16*
121 call void @llvm.aarch64.sve.stnt1.nxv8i16(<vscale x 8 x i16> %data,
122 <vscale x 8 x i1> %mask,
127 define void @test_masked_ldst_sv8f16(<vscale x 8 x half> * %base, <vscale x 8 x i1> %mask) nounwind {
128 ; CHECK-LABEL: test_masked_ldst_sv8f16:
130 ; CHECK-NEXT: ldnt1h { z0.h }, p0/z, [x0, #-1, mul vl]
131 ; CHECK-NEXT: stnt1h { z0.h }, p0, [x0, #2, mul vl]
133 %base_load = getelementptr <vscale x 8 x half>, <vscale x 8 x half>* %base, i64 -1
134 %base_load_bc = bitcast <vscale x 8 x half>* %base_load to half*
135 %data = call <vscale x 8 x half> @llvm.aarch64.sve.ldnt1.nxv8f16(<vscale x 8 x i1> %mask,
137 %base_store = getelementptr <vscale x 8 x half>, <vscale x 8 x half> * %base, i64 2
138 %base_store_bc = bitcast <vscale x 8 x half>* %base_store to half*
139 call void @llvm.aarch64.sve.stnt1.nxv8f16(<vscale x 8 x half> %data,
140 <vscale x 8 x i1> %mask,
141 half* %base_store_bc)
145 define void @test_masked_ldst_sv8bf16(<vscale x 8 x bfloat> * %base, <vscale x 8 x i1> %mask) nounwind #0 {
146 ; CHECK-LABEL: test_masked_ldst_sv8bf16:
148 ; CHECK-NEXT: ldnt1h { z0.h }, p0/z, [x0, #-1, mul vl]
149 ; CHECK-NEXT: stnt1h { z0.h }, p0, [x0, #2, mul vl]
151 %base_load = getelementptr <vscale x 8 x bfloat>, <vscale x 8 x bfloat>* %base, i64 -1
152 %base_load_bc = bitcast <vscale x 8 x bfloat>* %base_load to bfloat*
153 %data = call <vscale x 8 x bfloat> @llvm.aarch64.sve.ldnt1.nxv8bf16(<vscale x 8 x i1> %mask,
154 bfloat* %base_load_bc)
155 %base_store = getelementptr <vscale x 8 x bfloat>, <vscale x 8 x bfloat> * %base, i64 2
156 %base_store_bc = bitcast <vscale x 8 x bfloat>* %base_store to bfloat*
157 call void @llvm.aarch64.sve.stnt1.nxv8bf16(<vscale x 8 x bfloat> %data,
158 <vscale x 8 x i1> %mask,
159 bfloat* %base_store_bc)
163 ; 16-lane non-temporal load/stores.
165 define void @test_masked_ldst_sv16i8(<vscale x 16 x i8> * %base, <vscale x 16 x i1> %mask) nounwind {
166 ; CHECK-LABEL: test_masked_ldst_sv16i8:
168 ; CHECK-NEXT: ldnt1b { z0.b }, p0/z, [x0, #6, mul vl]
169 ; CHECK-NEXT: stnt1b { z0.b }, p0, [x0, #7, mul vl]
171 %base_load = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base, i64 6
172 %base_load_bc = bitcast <vscale x 16 x i8>* %base_load to i8*
173 %data = call <vscale x 16 x i8> @llvm.aarch64.sve.ldnt1.nxv16i8(<vscale x 16 x i1> %mask,
175 %base_store = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8> * %base, i64 7
176 %base_store_bc = bitcast <vscale x 16 x i8>* %base_store to i8*
177 call void @llvm.aarch64.sve.stnt1.nxv16i8(<vscale x 16 x i8> %data,
178 <vscale x 16 x i1> %mask,
183 ; 2-element non-temporal loads.
184 declare <vscale x 2 x i64> @llvm.aarch64.sve.ldnt1.nxv2i64(<vscale x 2 x i1>, i64*)
185 declare <vscale x 2 x double> @llvm.aarch64.sve.ldnt1.nxv2f64(<vscale x 2 x i1>, double*)
187 ; 4-element non-temporal loads.
188 declare <vscale x 4 x i32> @llvm.aarch64.sve.ldnt1.nxv4i32(<vscale x 4 x i1>, i32*)
189 declare <vscale x 4 x float> @llvm.aarch64.sve.ldnt1.nxv4f32(<vscale x 4 x i1>, float*)
191 ; 8-element non-temporal loads.
192 declare <vscale x 8 x i16> @llvm.aarch64.sve.ldnt1.nxv8i16(<vscale x 8 x i1>, i16*)
193 declare <vscale x 8 x half> @llvm.aarch64.sve.ldnt1.nxv8f16(<vscale x 8 x i1>, half*)
194 declare <vscale x 8 x bfloat> @llvm.aarch64.sve.ldnt1.nxv8bf16(<vscale x 8 x i1>, bfloat*)
196 ; 16-element non-temporal loads.
197 declare <vscale x 16 x i8> @llvm.aarch64.sve.ldnt1.nxv16i8(<vscale x 16 x i1>, i8*)
199 ; 2-element non-temporal stores.
200 declare void @llvm.aarch64.sve.stnt1.nxv2i64(<vscale x 2 x i64>, <vscale x 2 x i1>, i64*)
201 declare void @llvm.aarch64.sve.stnt1.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, double*)
203 ; 4-element non-temporal stores.
204 declare void @llvm.aarch64.sve.stnt1.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i1>, i32*)
205 declare void @llvm.aarch64.sve.stnt1.nxv4f32(<vscale x 4 x float>, <vscale x 4 x i1>, float*)
207 ; 8-element non-temporal stores.
208 declare void @llvm.aarch64.sve.stnt1.nxv8i16(<vscale x 8 x i16>, <vscale x 8 x i1>, i16*)
209 declare void @llvm.aarch64.sve.stnt1.nxv8f16(<vscale x 8 x half>, <vscale x 8 x i1>, half*)
210 declare void @llvm.aarch64.sve.stnt1.nxv8bf16(<vscale x 8 x bfloat>, <vscale x 8 x i1>, bfloat*)
212 ; 16-element non-temporal stores.
213 declare void @llvm.aarch64.sve.stnt1.nxv16i8(<vscale x 16 x i8>, <vscale x 16 x i1>, i8*)
215 ; +bf16 is required for the bfloat version.
216 attributes #0 = { "target-features"="+sve,+bf16" }