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
50 ; GFX12-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
51 ; GFX12-NEXT: s_endpgm
52 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
53 %tmp1 = bitcast i32 %tmp0 to float
54 %ret = tail call i32 @llvm.amdgcn.cvt.pk.bf8.f32(float %tmp1, float %y, i32 %old, i1 false)
55 store i32 %ret, ptr addrspace(1) %out
59 define amdgpu_cs void @test_cvt_pk_fp8_f32_word1(i32 %a, float %y, i32 %old, ptr addrspace(1) %out) {
60 ; GFX12-LABEL: test_cvt_pk_fp8_f32_word1:
62 ; GFX12-NEXT: v_mov_b32_dpp v0, v0 quad_perm:[0,1,2,3] row_mask:0xf bank_mask:0xf bound_ctrl:1
63 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
64 ; GFX12-NEXT: v_cvt_pk_fp8_f32 v2, v0, v1 op_sel:[0,0,1]
65 ; GFX12-NEXT: global_store_b32 v[3:4], v2, off
67 ; GFX12-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
68 ; GFX12-NEXT: s_endpgm
69 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
70 %tmp1 = bitcast i32 %tmp0 to float
71 %ret = tail call i32 @llvm.amdgcn.cvt.pk.fp8.f32(float %tmp1, float %y, i32 %old, i1 true)
72 store i32 %ret, ptr addrspace(1) %out
76 define amdgpu_cs void @test_cvt_sr_bf8_f32_byte0(i32 %a, i32 %r, i32 %old, ptr addrspace(1) %out) {
77 ; GFX12-LABEL: test_cvt_sr_bf8_f32_byte0:
79 ; 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
80 ; GFX12-NEXT: global_store_b32 v[3:4], v2, off
82 ; GFX12-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
83 ; GFX12-NEXT: s_endpgm
84 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
85 %tmp1 = bitcast i32 %tmp0 to float
86 %ret = tail call i32 @llvm.amdgcn.cvt.sr.bf8.f32(float %tmp1, i32 %r, i32 %old, i32 0)
87 store i32 %ret, ptr addrspace(1) %out
91 define amdgpu_cs void @test_cvt_sr_fp8_f32_byte1(i32 %a, i32 %r, i32 %old, ptr addrspace(1) %out) {
92 ; GFX12-LABEL: test_cvt_sr_fp8_f32_byte1:
94 ; 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
95 ; GFX12-NEXT: global_store_b32 v[3:4], v2, off
97 ; GFX12-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
98 ; GFX12-NEXT: s_endpgm
99 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
100 %tmp1 = bitcast i32 %tmp0 to float
101 %ret = tail call i32 @llvm.amdgcn.cvt.sr.fp8.f32(float %tmp1, i32 %r, i32 %old, i32 1)
102 store i32 %ret, ptr addrspace(1) %out
106 define amdgpu_cs void @test_cvt_sr_fp8_f32_byte2(i32 %a, i32 %r, i32 %old, ptr addrspace(1) %out) {
107 ; GFX12-LABEL: test_cvt_sr_fp8_f32_byte2:
109 ; 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
110 ; GFX12-NEXT: global_store_b32 v[3:4], v2, off
111 ; GFX12-NEXT: s_nop 0
112 ; GFX12-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
113 ; GFX12-NEXT: s_endpgm
114 %tmp0 = call i32 @llvm.amdgcn.mov.dpp.i32(i32 %a, i32 228, i32 15, i32 15, i1 1)
115 %tmp1 = bitcast i32 %tmp0 to float
116 %ret = tail call i32 @llvm.amdgcn.cvt.sr.fp8.f32(float %tmp1, i32 %r, i32 %old, i32 2)
117 store i32 %ret, ptr addrspace(1) %out
121 declare float @llvm.amdgcn.cvt.f32.bf8(i32, i32)
122 declare float @llvm.amdgcn.cvt.f32.fp8(i32, i32)
123 declare i32 @llvm.amdgcn.cvt.pk.bf8.f32(float, float, i32, i1)
124 declare i32 @llvm.amdgcn.cvt.pk.fp8.f32(float, float, i32, i1)
125 declare i32 @llvm.amdgcn.cvt.sr.bf8.f32(float, i32, i32, i32)
126 declare i32 @llvm.amdgcn.cvt.sr.fp8.f32(float, i32, i32, i32)
128 declare i32 @llvm.amdgcn.mov.dpp.i32(i32, i32, i32, i32, i1) #1
129 declare i32 @llvm.amdgcn.mov.dpp8.i32(i32, i32) #1
131 attributes #0 = { nounwind convergent }
132 attributes #1 = { nounwind readnone convergent }