You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[AArch64][CostModel] Add SVE bfloat arithmetic tests (NFC) (#166951)
This patch adds cost model tests for `bfloat` operations with
`+sve-b16b16`. Currently, some of these costs are higher than they
should be as the cost model is assuming `bfloat`s need promotion, but
some of these operations are natively supported with `+sve-b16b16`.
; CHECK-NEXT: Cost Model: Found costs of RThru:11 CodeSize:1 Lat:3 SizeLat:1 for: %NXV4BF16 = fadd <vscale x 4 x bfloat> poison, poison
38
+
; CHECK-NEXT: Cost Model: Found costs of RThru:27 CodeSize:1 Lat:3 SizeLat:1 for: %NXV8BF16 = fadd <vscale x 8 x bfloat> poison, poison
39
+
; CHECK-NEXT: Cost Model: Found costs of RThru:54 CodeSize:1 Lat:3 SizeLat:1 for: %NXV16BF16 = fadd <vscale x 16 x bfloat> poison, poison
40
+
; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
41
+
;
42
+
%NXV4BF16 = fadd <vscale x 4 x bfloat> poison, poison
43
+
%NXV8BF16 = fadd <vscale x 8 x bfloat> poison, poison
44
+
%NXV16BF16 = fadd <vscale x 16 x bfloat> poison, poison
45
+
46
+
retvoid
47
+
}
48
+
49
+
34
50
definevoid@fsub() {
35
51
; CHECK-LABEL: 'fsub'
36
52
; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fsub <vscale x 4 x half> poison, poison
@@ -59,6 +75,20 @@ define void @fsub() {
59
75
retvoid
60
76
}
61
77
78
+
definevoid@fsub_bf16() {
79
+
; CHECK-LABEL: 'fsub_bf16'
80
+
; CHECK-NEXT: Cost Model: Found costs of RThru:11 CodeSize:1 Lat:3 SizeLat:1 for: %NXV4BF16 = fsub <vscale x 4 x bfloat> poison, poison
81
+
; CHECK-NEXT: Cost Model: Found costs of RThru:27 CodeSize:1 Lat:3 SizeLat:1 for: %NXV8BF16 = fsub <vscale x 8 x bfloat> poison, poison
82
+
; CHECK-NEXT: Cost Model: Found costs of RThru:54 CodeSize:1 Lat:3 SizeLat:1 for: %NXV16BF16 = fsub <vscale x 16 x bfloat> poison, poison
83
+
; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
84
+
;
85
+
%NXV4BF16 = fsub <vscale x 4 x bfloat> poison, poison
86
+
%NXV8BF16 = fsub <vscale x 8 x bfloat> poison, poison
87
+
%NXV16BF16 = fsub <vscale x 16 x bfloat> poison, poison
88
+
89
+
retvoid
90
+
}
91
+
62
92
definevoid@fneg() {
63
93
; CHECK-LABEL: 'fneg'
64
94
; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F16 = fneg <vscale x 2 x half> poison
@@ -87,6 +117,22 @@ define void @fneg() {
87
117
retvoid
88
118
}
89
119
120
+
definevoid@fneg_bf16() {
121
+
; CHECK-LABEL: 'fneg_bf16'
122
+
; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %NXV2BF16 = fneg <vscale x 2 x bfloat> poison
123
+
; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %NXV4BF16 = fneg <vscale x 4 x bfloat> poison
124
+
; CHECK-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %NXV8BF16 = fneg <vscale x 8 x bfloat> poison
125
+
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %NXV16BF16 = fneg <vscale x 16 x bfloat> poison
126
+
; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
127
+
;
128
+
%NXV2BF16 = fneg <vscale x 2 x bfloat> poison
129
+
%NXV4BF16 = fneg <vscale x 4 x bfloat> poison
130
+
%NXV8BF16 = fneg <vscale x 8 x bfloat> poison
131
+
%NXV16BF16 = fneg <vscale x 16 x bfloat> poison
132
+
133
+
retvoid
134
+
}
135
+
90
136
definevoid@fmul() {
91
137
; CHECK-LABEL: 'fmul'
92
138
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = fmul <vscale x 4 x half> poison, poison
@@ -113,6 +159,20 @@ define void @fmul() {
113
159
retvoid
114
160
}
115
161
162
+
definevoid@fmul_bf16() {
163
+
; CHECK-LABEL: 'fmul_bf16'
164
+
; CHECK-NEXT: Cost Model: Found costs of RThru:12 CodeSize:1 Lat:3 SizeLat:1 for: %NXV4BF16 = fmul <vscale x 4 x bfloat> poison, poison
165
+
; CHECK-NEXT: Cost Model: Found costs of RThru:29 CodeSize:1 Lat:3 SizeLat:1 for: %NXV8BF16 = fmul <vscale x 8 x bfloat> poison, poison
166
+
; CHECK-NEXT: Cost Model: Found costs of RThru:58 CodeSize:1 Lat:3 SizeLat:1 for: %NXV16BF16 = fmul <vscale x 16 x bfloat> poison, poison
167
+
; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
168
+
;
169
+
%NXV4BF16 = fmul <vscale x 4 x bfloat> poison, poison
170
+
%NXV8BF16 = fmul <vscale x 8 x bfloat> poison, poison
171
+
%NXV16BF16 = fmul <vscale x 16 x bfloat> poison, poison
172
+
173
+
retvoid
174
+
}
175
+
116
176
definevoid@fdiv() {
117
177
; CHECK-LABEL: 'fdiv'
118
178
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:4 Lat:4 SizeLat:4 for: %V4F16 = fdiv <vscale x 4 x half> poison, poison
@@ -139,6 +199,20 @@ define void @fdiv() {
139
199
retvoid
140
200
}
141
201
202
+
definevoid@fdiv_bf16() {
203
+
; CHECK-LABEL: 'fdiv_bf16'
204
+
; CHECK-NEXT: Cost Model: Found costs of RThru:12 CodeSize:4 Lat:4 SizeLat:4 for: %NXV4BF16 = fdiv <vscale x 4 x bfloat> poison, poison
205
+
; CHECK-NEXT: Cost Model: Found costs of RThru:29 CodeSize:4 Lat:4 SizeLat:4 for: %NXV8BF16 = fdiv <vscale x 8 x bfloat> poison, poison
206
+
; CHECK-NEXT: Cost Model: Found costs of RThru:58 CodeSize:4 Lat:4 SizeLat:4 for: %NXV16BF16 = fdiv <vscale x 16 x bfloat> poison, poison
207
+
; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
208
+
;
209
+
%NXV4BF16 = fdiv <vscale x 4 x bfloat> poison, poison
210
+
%NXV8BF16 = fdiv <vscale x 8 x bfloat> poison, poison
211
+
%NXV16BF16 = fdiv <vscale x 16 x bfloat> poison, poison
212
+
213
+
retvoid
214
+
}
215
+
142
216
definevoid@frem() {
143
217
; CHECK-LABEL: 'frem'
144
218
; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %V4F16 = frem <vscale x 4 x half> poison, poison
@@ -165,6 +239,20 @@ define void @frem() {
165
239
retvoid
166
240
}
167
241
242
+
definevoid@frem_bf16() {
243
+
; CHECK-LABEL: 'frem_bf16'
244
+
; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %NXV4BF16 = frem <vscale x 4 x bfloat> poison, poison
245
+
; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %NXV8BF16 = frem <vscale x 8 x bfloat> poison, poison
246
+
; CHECK-NEXT: Cost Model: Found costs of RThru:Invalid CodeSize:4 Lat:4 SizeLat:4 for: %NXV16BF16 = frem <vscale x 16 x bfloat> poison, poison
247
+
; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
248
+
;
249
+
%NXV4BF16 = frem <vscale x 4 x bfloat> poison, poison
250
+
%NXV8BF16 = frem <vscale x 8 x bfloat> poison, poison
251
+
%NXV16BF16 = frem <vscale x 16 x bfloat> poison, poison
252
+
253
+
retvoid
254
+
}
255
+
168
256
definevoid@fma() {
169
257
; CHECK-LABEL: 'fma'
170
258
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = call <vscale x 4 x half> @llvm.fma.nxv4f16(<vscale x 4 x half> poison, <vscale x 4 x half> poison, <vscale x 4 x half> poison)
@@ -191,6 +279,26 @@ define void @fma() {
191
279
retvoid
192
280
}
193
281
282
+
definevoid@fma_bf16() {
283
+
; CHECK-BASE-LABEL: 'fma_bf16'
284
+
; CHECK-BASE-NEXT: Cost Model: Found costs of 1 for: %NXV4BF16 = call <vscale x 4 x bfloat> @llvm.fma.nxv4bf16(<vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison)
285
+
; CHECK-BASE-NEXT: Cost Model: Found costs of 1 for: %NXV8BF16 = call <vscale x 8 x bfloat> @llvm.fma.nxv8bf16(<vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison)
286
+
; CHECK-BASE-NEXT: Cost Model: Found costs of 4 for: %NXV16BF16 = call <vscale x 16 x bfloat> @llvm.fma.nxv16bf16(<vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison)
287
+
; CHECK-BASE-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
288
+
;
289
+
; CHECK-BF16-LABEL: 'fma_bf16'
290
+
; CHECK-BF16-NEXT: Cost Model: Found costs of 2 for: %NXV4BF16 = call <vscale x 4 x bfloat> @llvm.fma.nxv4bf16(<vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison)
291
+
; CHECK-BF16-NEXT: Cost Model: Found costs of 2 for: %NXV8BF16 = call <vscale x 8 x bfloat> @llvm.fma.nxv8bf16(<vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison)
292
+
; CHECK-BF16-NEXT: Cost Model: Found costs of 4 for: %NXV16BF16 = call <vscale x 16 x bfloat> @llvm.fma.nxv16bf16(<vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison)
293
+
; CHECK-BF16-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
294
+
;
295
+
%NXV4BF16 = call <vscale x 4 x bfloat> @llvm.fma.nxv4bf16(<vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison)
296
+
%NXV8BF16 = call <vscale x 8 x bfloat> @llvm.fma.nxv8bf16(<vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison)
297
+
%NXV16BF16 = call <vscale x 16 x bfloat> @llvm.fma.nxv16bf16(<vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison)
298
+
299
+
retvoid
300
+
}
301
+
194
302
definevoid@fmuladd() {
195
303
; CHECK-LABEL: 'fmuladd'
196
304
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:3 SizeLat:1 for: %V4F16 = call <vscale x 4 x half> @llvm.fmuladd.nxv4f16(<vscale x 4 x half> poison, <vscale x 4 x half> poison, <vscale x 4 x half> poison)
@@ -216,3 +324,23 @@ define void @fmuladd() {
216
324
217
325
retvoid
218
326
}
327
+
328
+
definevoid@fmuladd_bf16() {
329
+
; CHECK-BASE-LABEL: 'fmuladd_bf16'
330
+
; CHECK-BASE-NEXT: Cost Model: Found costs of 1 for: %NXV4BF16 = call <vscale x 4 x bfloat> @llvm.fmuladd.nxv4bf16(<vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison)
331
+
; CHECK-BASE-NEXT: Cost Model: Found costs of 1 for: %NXV8BF16 = call <vscale x 8 x bfloat> @llvm.fmuladd.nxv8bf16(<vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison)
332
+
; CHECK-BASE-NEXT: Cost Model: Found costs of 4 for: %NXV16BF16 = call <vscale x 16 x bfloat> @llvm.fmuladd.nxv16bf16(<vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison)
333
+
; CHECK-BASE-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
334
+
;
335
+
; CHECK-BF16-LABEL: 'fmuladd_bf16'
336
+
; CHECK-BF16-NEXT: Cost Model: Found costs of 2 for: %NXV4BF16 = call <vscale x 4 x bfloat> @llvm.fmuladd.nxv4bf16(<vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison)
337
+
; CHECK-BF16-NEXT: Cost Model: Found costs of 2 for: %NXV8BF16 = call <vscale x 8 x bfloat> @llvm.fmuladd.nxv8bf16(<vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison)
338
+
; CHECK-BF16-NEXT: Cost Model: Found costs of 4 for: %NXV16BF16 = call <vscale x 16 x bfloat> @llvm.fmuladd.nxv16bf16(<vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison)
339
+
; CHECK-BF16-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
340
+
;
341
+
%NXV4BF16 = call <vscale x 4 x bfloat> @llvm.fmuladd.nxv4bf16(<vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison, <vscale x 4 x bfloat> poison)
342
+
%NXV8BF16 = call <vscale x 8 x bfloat> @llvm.fmuladd.nxv8bf16(<vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison, <vscale x 8 x bfloat> poison)
343
+
%NXV16BF16 = call <vscale x 16 x bfloat> @llvm.fmuladd.nxv16bf16(<vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison, <vscale x 16 x bfloat> poison)
0 commit comments