1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs < %s | FileCheck -check-prefix=GFX12 %s
4 define amdgpu_cs float @test_cvt_f32_bf8_byte0(i32 %a) {
5 ; GFX12-LABEL: test_cvt_f32_bf8_byte0:
7 ; GFX12-NEXT: v_cvt_f32_bf8_dpp v0, v0 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
8 ; GFX12-NEXT: ; return to shader part epilog
9 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
10 %ret = tail call float @llvm.amdgcn.cvt.f32.bf8(i32 %tmp0, i32 0)
14 define amdgpu_cs float @test_cvt_f32_bf8_byte1(i32 %a) {
15 ; GFX12-LABEL: test_cvt_f32_bf8_byte1:
17 ; GFX12-NEXT: v_cvt_f32_bf8_e64_dpp v0, v0 byte_sel:1 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
18 ; GFX12-NEXT: ; return to shader part epilog
19 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
20 %ret = tail call float @llvm.amdgcn.cvt.f32.bf8(i32 %tmp0, i32 1)
24 define amdgpu_cs float @test_cvt_f32_bf8_byte2(i32 %a) {
25 ; GFX12-LABEL: test_cvt_f32_bf8_byte2:
27 ; GFX12-NEXT: v_cvt_f32_bf8_e64_dpp v0, v0 byte_sel:2 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
28 ; GFX12-NEXT: ; return to shader part epilog
29 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
30 %ret = tail call float @llvm.amdgcn.cvt.f32.bf8(i32 %tmp0, i32 2)
34 define amdgpu_cs float @test_cvt_f32_fp8_byte3(i32 %a) {
35 ; GFX12-LABEL: test_cvt_f32_fp8_byte3:
37 ; GFX12-NEXT: v_cvt_f32_fp8_e64_dpp v0, v0 byte_sel:3 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
38 ; GFX12-NEXT: ; return to shader part epilog
39 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
40 %ret = tail call float @llvm.amdgcn.cvt.f32.fp8(i32 %tmp0, i32 3)
44 define amdgpu_cs void @test_cvt_pk_bf8_f32_word0(i32 %a, float %y, i32 %old, ptr addrspace(1) %out) {
45 ; GFX12-LABEL: test_cvt_pk_bf8_f32_word0:
47 ; GFX12-NEXT: v_cvt_pk_bf8_f32_e64_dpp v2, v0, v1 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
48 ; GFX12-NEXT: global_store_b32 v[3:4], v2, off
49 ; GFX12-NEXT: s_endpgm
50 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
51 %tmp1 = bitcast i32 %tmp0 to float
52 %ret = tail call i32 @llvm.amdgcn.cvt.pk.bf8.f32(float %tmp1, float %y, i32 %old, i1 false)
53 store i32 %ret, ptr addrspace(1) %out
57 define amdgpu_cs void @test_cvt_pk_fp8_f32_word1(i32 %a, float %y, i32 %old, ptr addrspace(1) %out) {
58 ; GFX12-LABEL: test_cvt_pk_fp8_f32_word1:
60 ; GFX12-NEXT: v_mov_b32_dpp v0, v0 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
61 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
62 ; GFX12-NEXT: v_cvt_pk_fp8_f32 v2, v0, v1 op_sel:[0,0,1]
63 ; GFX12-NEXT: global_store_b32 v[3:4], v2, off
64 ; GFX12-NEXT: s_endpgm
65 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
66 %tmp1 = bitcast i32 %tmp0 to float
67 %ret = tail call i32 @llvm.amdgcn.cvt.pk.fp8.f32(float %tmp1, float %y, i32 %old, i1 true)
68 store i32 %ret, ptr addrspace(1) %out
72 define amdgpu_cs void @test_cvt_sr_bf8_f32_byte0(i32 %a, i32 %r, i32 %old, ptr addrspace(1) %out) {
73 ; GFX12-LABEL: test_cvt_sr_bf8_f32_byte0:
75 ; GFX12-NEXT: v_cvt_sr_bf8_f32_e64_dpp v2, v0, v1 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
76 ; GFX12-NEXT: global_store_b32 v[3:4], v2, off
77 ; GFX12-NEXT: s_endpgm
78 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
79 %tmp1 = bitcast i32 %tmp0 to float
80 %ret = tail call i32 @llvm.amdgcn.cvt.sr.bf8.f32(float %tmp1, i32 %r, i32 %old, i32 0)
81 store i32 %ret, ptr addrspace(1) %out
85 define amdgpu_cs void @test_cvt_sr_fp8_f32_byte1(i32 %a, i32 %r, i32 %old, ptr addrspace(1) %out) {
86 ; GFX12-LABEL: test_cvt_sr_fp8_f32_byte1:
88 ; GFX12-NEXT: v_cvt_sr_fp8_f32_e64_dpp v2, v0, v1 byte_sel:1 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
89 ; GFX12-NEXT: global_store_b32 v[3:4], v2, off
90 ; GFX12-NEXT: s_endpgm
91 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
92 %tmp1 = bitcast i32 %tmp0 to float
93 %ret = tail call i32 @llvm.amdgcn.cvt.sr.fp8.f32(float %tmp1, i32 %r, i32 %old, i32 1)
94 store i32 %ret, ptr addrspace(1) %out
98 define amdgpu_cs void @test_cvt_sr_fp8_f32_byte2(i32 %a, i32 %r, i32 %old, ptr addrspace(1) %out) {
99 ; GFX12-LABEL: test_cvt_sr_fp8_f32_byte2:
101 ; GFX12-NEXT: v_cvt_sr_fp8_f32_e64_dpp v2, v0, v1 byte_sel:2 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
102 ; GFX12-NEXT: global_store_b32 v[3:4], v2, off
103 ; GFX12-NEXT: s_endpgm
104 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
105 %tmp1 = bitcast i32 %tmp0 to float
106 %ret = tail call i32 @llvm.amdgcn.cvt.sr.fp8.f32(float %tmp1, i32 %r, i32 %old, i32 2)
107 store i32 %ret, ptr addrspace(1) %out
111 declare float @llvm.amdgcn.cvt.f32.bf8(i32, i32)
112 declare float @llvm.amdgcn.cvt.f32.fp8(i32, i32)
113 declare i32 @llvm.amdgcn.cvt.pk.bf8.f32(float, float, i32, i1)
114 declare i32 @llvm.amdgcn.cvt.pk.fp8.f32(float, float, i32, i1)
115 declare i32 @llvm.amdgcn.cvt.sr.bf8.f32(float, i32, i32, i32)
116 declare i32 @llvm.amdgcn.cvt.sr.fp8.f32(float, i32, i32, i32)
118 declare i32 @llvm.amdgcn.mov.dpp.i32(i32, i32, i32, i32, i1) #1
119 declare i32 @llvm.amdgcn.mov.dpp8.i32(i32, i32) #1
121 attributes #0 = { nounwind convergent }
122 attributes #1 = { nounwind readnone convergent }