2
2
; RUN: llc -march=amdgcn -mcpu=gfx940 < %s | FileCheck --check-prefixes=GCN %s
3
3
4
4
; TODO: Add global-isel when it can support bf16
5
+
5
6
define amdgpu_ps float @v_test_cvt_bf16_f32_v (bfloat %v ) {
6
7
; GCN-LABEL: v_test_cvt_bf16_f32_v:
7
8
; GCN: ; %bb.0:
@@ -10,6 +11,7 @@ define amdgpu_ps float @v_test_cvt_bf16_f32_v(bfloat %v) {
10
11
%cvt = fpext bfloat %v to float
11
12
ret float %cvt
12
13
}
14
+
13
15
define amdgpu_ps float @v_test_cvt_bf16_f32_s (bfloat inreg %v ) {
14
16
; GCN-LABEL: v_test_cvt_bf16_f32_s:
15
17
; GCN: ; %bb.0:
@@ -19,6 +21,7 @@ define amdgpu_ps float @v_test_cvt_bf16_f32_s(bfloat inreg %v) {
19
21
%cvt = fpext bfloat %v to float
20
22
ret float %cvt
21
23
}
24
+
22
25
define amdgpu_ps float @v_test_cvt_v2f32_v2bf16_v (<2 x float > %src ) {
23
26
; GCN-LABEL: v_test_cvt_v2f32_v2bf16_v:
24
27
; GCN: ; %bb.0:
@@ -42,6 +45,7 @@ define amdgpu_ps float @v_test_cvt_v2f32_v2bf16_v(<2 x float> %src) {
42
45
%cast = bitcast <2 x bfloat> %res to float
43
46
ret float %cast
44
47
}
48
+
45
49
define amdgpu_ps float @v_test_cvt_v2f32_v2bf16_s (<2 x float > inreg %src ) {
46
50
; GCN-LABEL: v_test_cvt_v2f32_v2bf16_s:
47
51
; GCN: ; %bb.0:
@@ -66,6 +70,7 @@ define amdgpu_ps float @v_test_cvt_v2f32_v2bf16_s(<2 x float> inreg %src) {
66
70
%cast = bitcast <2 x bfloat> %res to float
67
71
ret float %cast
68
72
}
73
+
69
74
define amdgpu_ps float @v_test_cvt_f32_bf16_v (float %src ) {
70
75
; GCN-LABEL: v_test_cvt_f32_bf16_v:
71
76
; GCN: ; %bb.0:
@@ -82,6 +87,7 @@ define amdgpu_ps float @v_test_cvt_f32_bf16_v(float %src) {
82
87
%ext = fpext bfloat %trunc to float
83
88
ret float %ext
84
89
}
90
+
85
91
define amdgpu_ps float @v_test_cvt_v2f64_v2bf16_v (<2 x double > %src ) {
86
92
; GCN-LABEL: v_test_cvt_v2f64_v2bf16_v:
87
93
; GCN: ; %bb.0:
@@ -128,6 +134,7 @@ define amdgpu_ps float @v_test_cvt_v2f64_v2bf16_v(<2 x double> %src) {
128
134
%cast = bitcast <2 x bfloat> %res to float
129
135
ret float %cast
130
136
}
137
+
131
138
define amdgpu_ps float @fptrunc_f32_f32_to_v2bf16 (float %a , float %b ) {
132
139
; GCN-LABEL: fptrunc_f32_f32_to_v2bf16:
133
140
; GCN: ; %bb.0: ; %entry
@@ -155,6 +162,7 @@ entry:
155
162
%ret = bitcast <2 x bfloat> %v2.2 to float
156
163
ret float %ret
157
164
}
165
+
158
166
define amdgpu_ps float @fptrunc_f32_f32_to_v2bf16_mods (float %a , float %b ) {
159
167
; GCN-LABEL: fptrunc_f32_f32_to_v2bf16_mods:
160
168
; GCN: ; %bb.0: ; %entry
@@ -186,6 +194,7 @@ entry:
186
194
%ret = bitcast <2 x bfloat> %v2.2 to float
187
195
ret float %ret
188
196
}
197
+
189
198
define amdgpu_ps void @fptrunc_f32_to_bf16 (float %a , ptr %out ) {
190
199
; GCN-LABEL: fptrunc_f32_to_bf16:
191
200
; GCN: ; %bb.0: ; %entry
@@ -205,6 +214,7 @@ entry:
205
214
store bfloat %a.cvt , ptr %out
206
215
ret void
207
216
}
217
+
208
218
define amdgpu_ps void @fptrunc_f32_to_bf16_abs (float %a , ptr %out ) {
209
219
; GCN-LABEL: fptrunc_f32_to_bf16_abs:
210
220
; GCN: ; %bb.0: ; %entry
@@ -226,6 +236,7 @@ entry:
226
236
store bfloat %a.cvt , ptr %out
227
237
ret void
228
238
}
239
+
229
240
define amdgpu_ps void @fptrunc_f32_to_bf16_neg (float %a , ptr %out ) {
230
241
; GCN-LABEL: fptrunc_f32_to_bf16_neg:
231
242
; GCN: ; %bb.0: ; %entry
@@ -247,6 +258,7 @@ entry:
247
258
store bfloat %a.cvt , ptr %out
248
259
ret void
249
260
}
261
+
250
262
define amdgpu_ps void @fptrunc_f64_to_bf16 (double %a , ptr %out ) {
251
263
; GCN-LABEL: fptrunc_f64_to_bf16:
252
264
; GCN: ; %bb.0: ; %entry
@@ -276,6 +288,7 @@ entry:
276
288
store bfloat %a.cvt , ptr %out
277
289
ret void
278
290
}
291
+
279
292
define amdgpu_ps void @fptrunc_f64_to_bf16_neg (double %a , ptr %out ) {
280
293
; GCN-LABEL: fptrunc_f64_to_bf16_neg:
281
294
; GCN: ; %bb.0: ; %entry
@@ -307,6 +320,7 @@ entry:
307
320
store bfloat %a.cvt , ptr %out
308
321
ret void
309
322
}
323
+
310
324
define amdgpu_ps void @fptrunc_f64_to_bf16_abs (double %a , ptr %out ) {
311
325
; GCN-LABEL: fptrunc_f64_to_bf16_abs:
312
326
; GCN: ; %bb.0: ; %entry
@@ -341,4 +355,3 @@ entry:
341
355
342
356
declare float @llvm.fabs.f32 (float )
343
357
declare double @llvm.fabs.f64 (double )
344
-
0 commit comments