1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -march=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=GFX11
3; RUN: llc -global-isel -march=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=GFX11
4
5declare float @llvm.amdgcn.fdot2.f32.bf16(<2 x i16> %a, <2 x i16> %b, float %c, i1 %clamp)
6
7define amdgpu_kernel void @test_llvm_amdgcn_fdot2_f32_bf16_clamp(
8; GFX11-LABEL: test_llvm_amdgcn_fdot2_f32_bf16_clamp:
9; GFX11:       ; %bb.0: ; %entry
10; GFX11-NEXT:    s_load_b256 s[0:7], s[0:1], 0x24
11; GFX11-NEXT:    v_mov_b32_e32 v1, 0
12; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
13; GFX11-NEXT:    s_load_b32 s6, s[6:7], 0x0
14; GFX11-NEXT:    s_load_b32 s2, s[2:3], 0x0
15; GFX11-NEXT:    s_load_b32 s3, s[4:5], 0x0
16; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
17; GFX11-NEXT:    v_mov_b32_e32 v0, s6
18; GFX11-NEXT:    v_dot2_f32_bf16 v0, s2, s3, v0 clamp
19; GFX11-NEXT:    global_store_b32 v1, v0, s[0:1]
20; GFX11-NEXT:    s_endpgm
21    float addrspace(1)* %r,
22    <2 x i16> addrspace(1)* %a,
23    <2 x i16> addrspace(1)* %b,
24    float addrspace(1)* %c) {
25entry:
26  %a.val = load <2 x i16>, <2 x i16> addrspace(1)* %a
27  %b.val = load <2 x i16>, <2 x i16> addrspace(1)* %b
28  %c.val = load float, float addrspace(1)* %c
29  %r.val = call float @llvm.amdgcn.fdot2.f32.bf16(<2 x i16> %a.val, <2 x i16> %b.val, float %c.val, i1 1)
30  store float %r.val, float addrspace(1)* %r
31  ret void
32}
33
34
35define amdgpu_kernel void @test_llvm_amdgcn_fdot2_f32_bf16_no_clamp(
36; GFX11-LABEL: test_llvm_amdgcn_fdot2_f32_bf16_no_clamp:
37; GFX11:       ; %bb.0: ; %entry
38; GFX11-NEXT:    s_load_b256 s[0:7], s[0:1], 0x24
39; GFX11-NEXT:    v_mov_b32_e32 v1, 0
40; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
41; GFX11-NEXT:    s_load_b32 s6, s[6:7], 0x0
42; GFX11-NEXT:    s_load_b32 s2, s[2:3], 0x0
43; GFX11-NEXT:    s_load_b32 s3, s[4:5], 0x0
44; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
45; GFX11-NEXT:    v_mov_b32_e32 v0, s6
46; GFX11-NEXT:    v_dot2_f32_bf16 v0, s2, s3, v0
47; GFX11-NEXT:    global_store_b32 v1, v0, s[0:1]
48; GFX11-NEXT:    s_endpgm
49    float addrspace(1)* %r,
50    <2 x i16> addrspace(1)* %a,
51    <2 x i16> addrspace(1)* %b,
52    float addrspace(1)* %c) {
53entry:
54  %a.val = load <2 x i16>, <2 x i16> addrspace(1)* %a
55  %b.val = load <2 x i16>, <2 x i16> addrspace(1)* %b
56  %c.val = load float, float addrspace(1)* %c
57  %r.val = call float @llvm.amdgcn.fdot2.f32.bf16(<2 x i16> %a.val, <2 x i16> %b.val, float %c.val, i1 0)
58  store float %r.val, float addrspace(1)* %r
59  ret void
60}
61