sve-intrinsics-st1-addressing-mode-reg-imm.ll
11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s 2>%t | FileCheck %s
; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t
; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it.
; WARN-NOT: warning
;
; ST1B
;
define void @st1b_upper_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
; CHECK-LABEL: st1b_upper_bound:
; CHECK: st1b { z0.b }, p0, [x0, #7, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
%base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 7
%base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
ret void
}
define void @st1b_inbound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
; CHECK-LABEL: st1b_inbound:
; CHECK: st1b { z0.b }, p0, [x0, #1, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
%base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 1
%base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
ret void
}
define void @st1b_lower_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
; CHECK-LABEL: st1b_lower_bound:
; CHECK: st1b { z0.b }, p0, [x0, #-8, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
%base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 -8
%base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
ret void
}
define void @st1b_out_of_upper_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
; CHECK-LABEL: st1b_out_of_upper_bound:
; CHECK: rdvl x[[OFFSET:[0-9]+]], #8
; CHECK: st1b { z0.b }, p0, [x0, x[[OFFSET]]]
; CHECK-NEXT: ret
%base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
%base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 8
%base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
ret void
}
define void @st1b_out_of_lower_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
; CHECK-LABEL: st1b_out_of_lower_bound:
; CHECK: rdvl x[[OFFSET:[0-9]+]], #-9
; CHECK: st1b { z0.b }, p0, [x0, x[[OFFSET]]]
; CHECK-NEXT: ret
%base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
%base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 -9
%base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
ret void
}
define void @st1b_s_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, i8* %a) {
; CHECK-LABEL: st1b_s_inbound:
; CHECK: st1b { z0.s }, p0, [x0, #7, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i8* %a to <vscale x 4 x i8>*
%base = getelementptr <vscale x 4 x i8>, <vscale x 4 x i8>* %base_scalable, i64 7
%base_scalar = bitcast <vscale x 4 x i8>* %base to i8*
%trunc = trunc <vscale x 4 x i32> %data to <vscale x 4 x i8>
call void @llvm.aarch64.sve.st1.nxv4i8(<vscale x 4 x i8> %trunc, <vscale x 4 x i1> %pg, i8* %base_scalar)
ret void
}
define void @st1b_h_inbound(<vscale x 8 x i16> %data, <vscale x 8 x i1> %pg, i8* %a) {
; CHECK-LABEL: st1b_h_inbound:
; CHECK: st1b { z0.h }, p0, [x0, #1, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i8* %a to <vscale x 8 x i8>*
%base = getelementptr <vscale x 8 x i8>, <vscale x 8 x i8>* %base_scalable, i64 1
%base_scalar = bitcast <vscale x 8 x i8>* %base to i8*
%trunc = trunc <vscale x 8 x i16> %data to <vscale x 8 x i8>
call void @llvm.aarch64.sve.st1.nxv8i8(<vscale x 8 x i8> %trunc, <vscale x 8 x i1> %pg, i8* %base_scalar)
ret void
}
define void @st1b_d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i8* %a) {
; CHECK-LABEL: st1b_d_inbound:
; CHECK: st1b { z0.d }, p0, [x0, #-7, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i8* %a to <vscale x 2 x i8>*
%base = getelementptr <vscale x 2 x i8>, <vscale x 2 x i8>* %base_scalable, i64 -7
%base_scalar = bitcast <vscale x 2 x i8>* %base to i8*
%trunc = trunc <vscale x 2 x i64> %data to <vscale x 2 x i8>
call void @llvm.aarch64.sve.st1.nxv2i8(<vscale x 2 x i8> %trunc, <vscale x 2 x i1> %pg, i8* %base_scalar)
ret void
}
;
; ST1H
;
define void @st1h_inbound(<vscale x 8 x i16> %data, <vscale x 8 x i1> %pg, i16* %a) {
; CHECK-LABEL: st1h_inbound:
; CHECK: st1h { z0.h }, p0, [x0, #-1, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i16* %a to <vscale x 8 x i16>*
%base = getelementptr <vscale x 8 x i16>, <vscale x 8 x i16>* %base_scalable, i64 -1
%base_scalar = bitcast <vscale x 8 x i16>* %base to i16*
call void @llvm.aarch64.sve.st1.nxv8i16(<vscale x 8 x i16> %data, <vscale x 8 x i1> %pg, i16* %base_scalar)
ret void
}
define void @st1h_f16_inbound(<vscale x 8 x half> %data, <vscale x 8 x i1> %pg, half* %a) {
; CHECK-LABEL: st1h_f16_inbound:
; CHECK: st1h { z0.h }, p0, [x0, #-5, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast half* %a to <vscale x 8 x half>*
%base = getelementptr <vscale x 8 x half>, <vscale x 8 x half>* %base_scalable, i64 -5
%base_scalar = bitcast <vscale x 8 x half>* %base to half*
call void @llvm.aarch64.sve.st1.nxv8f16(<vscale x 8 x half> %data, <vscale x 8 x i1> %pg, half* %base_scalar)
ret void
}
define void @st1h_bf16_inbound(<vscale x 8 x bfloat> %data, <vscale x 8 x i1> %pg, bfloat* %a) #0 {
; CHECK-LABEL: st1h_bf16_inbound:
; CHECK: st1h { z0.h }, p0, [x0, #-5, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast bfloat* %a to <vscale x 8 x bfloat>*
%base = getelementptr <vscale x 8 x bfloat>, <vscale x 8 x bfloat>* %base_scalable, i64 -5
%base_scalar = bitcast <vscale x 8 x bfloat>* %base to bfloat*
call void @llvm.aarch64.sve.st1.nxv8bf16(<vscale x 8 x bfloat> %data, <vscale x 8 x i1> %pg, bfloat* %base_scalar)
ret void
}
define void @st1h_s_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, i16* %a) {
; CHECK-LABEL: st1h_s_inbound:
; CHECK: st1h { z0.s }, p0, [x0, #2, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i16* %a to <vscale x 4 x i16>*
%base = getelementptr <vscale x 4 x i16>, <vscale x 4 x i16>* %base_scalable, i64 2
%base_scalar = bitcast <vscale x 4 x i16>* %base to i16*
%trunc = trunc <vscale x 4 x i32> %data to <vscale x 4 x i16>
call void @llvm.aarch64.sve.st1.nxv4i16(<vscale x 4 x i16> %trunc, <vscale x 4 x i1> %pg, i16* %base_scalar)
ret void
}
define void @st1h_d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i16* %a) {
; CHECK-LABEL: st1h_d_inbound:
; CHECK: st1h { z0.d }, p0, [x0, #-4, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i16* %a to <vscale x 2 x i16>*
%base = getelementptr <vscale x 2 x i16>, <vscale x 2 x i16>* %base_scalable, i64 -4
%base_scalar = bitcast <vscale x 2 x i16>* %base to i16*
%trunc = trunc <vscale x 2 x i64> %data to <vscale x 2 x i16>
call void @llvm.aarch64.sve.st1.nxv2i16(<vscale x 2 x i16> %trunc, <vscale x 2 x i1> %pg, i16* %base_scalar)
ret void
}
;
; ST1W
;
define void @st1w_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, i32* %a) {
; CHECK-LABEL: st1w_inbound:
; CHECK: st1w { z0.s }, p0, [x0, #6, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i32* %a to <vscale x 4 x i32>*
%base = getelementptr <vscale x 4 x i32>, <vscale x 4 x i32>* %base_scalable, i64 6
%base_scalar = bitcast <vscale x 4 x i32>* %base to i32*
call void @llvm.aarch64.sve.st1.nxv4i32(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, i32* %base_scalar)
ret void
}
define void @st1w_f32_inbound(<vscale x 4 x float> %data, <vscale x 4 x i1> %pg, float* %a) {
; CHECK-LABEL: st1w_f32_inbound:
; CHECK: st1w { z0.s }, p0, [x0, #-1, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast float* %a to <vscale x 4 x float>*
%base = getelementptr <vscale x 4 x float>, <vscale x 4 x float>* %base_scalable, i64 -1
%base_scalar = bitcast <vscale x 4 x float>* %base to float*
call void @llvm.aarch64.sve.st1.nxv4f32(<vscale x 4 x float> %data, <vscale x 4 x i1> %pg, float* %base_scalar)
ret void
}
define void @st1w_d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i32* %a) {
; CHECK-LABEL: st1w_d_inbound:
; CHECK: st1w { z0.d }, p0, [x0, #1, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i32* %a to <vscale x 2 x i32>*
%base = getelementptr <vscale x 2 x i32>, <vscale x 2 x i32>* %base_scalable, i64 1
%base_scalar = bitcast <vscale x 2 x i32>* %base to i32*
%trunc = trunc <vscale x 2 x i64> %data to <vscale x 2 x i32>
call void @llvm.aarch64.sve.st1.nxv2i32(<vscale x 2 x i32> %trunc, <vscale x 2 x i1> %pg, i32* %base_scalar)
ret void
}
;
; ST1D
;
define void @st1d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i64* %a) {
; CHECK-LABEL: st1d_inbound:
; CHECK: st1d { z0.d }, p0, [x0, #5, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast i64* %a to <vscale x 2 x i64>*
%base = getelementptr <vscale x 2 x i64>, <vscale x 2 x i64>* %base_scalable, i64 5
%base_scalar = bitcast <vscale x 2 x i64>* %base to i64*
call void @llvm.aarch64.sve.st1.nxv2i64(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i64* %base_scalar)
ret void
}
define void @st1d_f64_inbound(<vscale x 2 x double> %data, <vscale x 2 x i1> %pg, double* %a) {
; CHECK-LABEL: st1d_f64_inbound:
; CHECK: st1d { z0.d }, p0, [x0, #-8, mul vl]
; CHECK-NEXT: ret
%base_scalable = bitcast double* %a to <vscale x 2 x double>*
%base = getelementptr <vscale x 2 x double>, <vscale x 2 x double>* %base_scalable, i64 -8
%base_scalar = bitcast <vscale x 2 x double>* %base to double*
call void @llvm.aarch64.sve.st1.nxv2f64(<vscale x 2 x double> %data, <vscale x 2 x i1> %pg, double* %base_scalar)
ret void
}
declare void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8>, <vscale x 16 x i1>, i8*)
declare void @llvm.aarch64.sve.st1.nxv8i8(<vscale x 8 x i8>, <vscale x 8 x i1>, i8*)
declare void @llvm.aarch64.sve.st1.nxv8i16(<vscale x 8 x i16>, <vscale x 8 x i1>, i16*)
declare void @llvm.aarch64.sve.st1.nxv8f16(<vscale x 8 x half>, <vscale x 8 x i1>, half*)
declare void @llvm.aarch64.sve.st1.nxv8bf16(<vscale x 8 x bfloat>, <vscale x 8 x i1>, bfloat*)
declare void @llvm.aarch64.sve.st1.nxv4i8(<vscale x 4 x i8>, <vscale x 4 x i1>, i8*)
declare void @llvm.aarch64.sve.st1.nxv4i16(<vscale x 4 x i16>, <vscale x 4 x i1>, i16*)
declare void @llvm.aarch64.sve.st1.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i1>, i32*)
declare void @llvm.aarch64.sve.st1.nxv4f32(<vscale x 4 x float>, <vscale x 4 x i1>, float*)
declare void @llvm.aarch64.sve.st1.nxv2i8(<vscale x 2 x i8>, <vscale x 2 x i1>, i8*)
declare void @llvm.aarch64.sve.st1.nxv2i16(<vscale x 2 x i16>, <vscale x 2 x i1>, i16*)
declare void @llvm.aarch64.sve.st1.nxv2i32(<vscale x 2 x i32>, <vscale x 2 x i1>, i32*)
declare void @llvm.aarch64.sve.st1.nxv2i64(<vscale x 2 x i64>, <vscale x 2 x i1>, i64*)
declare void @llvm.aarch64.sve.st1.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, double*)
; +bf16 is required for the bfloat version.
attributes #0 = { "target-features"="+sve,+bf16" }