1; RUN: llc -march=amdgcn -mcpu=gfx906 -verify-machineinstrs < %s | FileCheck %s --check-prefix=GFX906
2
3declare float @llvm.amdgcn.fdot2(<2 x half> %a, <2 x half> %b, float %c, i1 %clamp)
4
5; GFX906-LABEL: {{^}}test_llvm_amdgcn_fdot2_clamp
6; GFX906: v_dot2_f32_f16 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} clamp{{$}}
7define amdgpu_kernel void @test_llvm_amdgcn_fdot2_clamp(
8    float addrspace(1)* %r,
9    <2 x half> addrspace(1)* %a,
10    <2 x half> addrspace(1)* %b,
11    float addrspace(1)* %c) {
12entry:
13  %a.val = load <2 x half>, <2 x half> addrspace(1)* %a
14  %b.val = load <2 x half>, <2 x half> addrspace(1)* %b
15  %c.val = load float, float addrspace(1)* %c
16  %r.val = call float @llvm.amdgcn.fdot2(<2 x half> %a.val, <2 x half> %b.val, float %c.val, i1 1)
17  store float %r.val, float addrspace(1)* %r
18  ret void
19}
20
21; GFX906-LABEL: {{^}}test_llvm_amdgcn_fdot2_no_clamp
22; GFX906: v_dot2_f32_f16 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}{{$}}
23define amdgpu_kernel void @test_llvm_amdgcn_fdot2_no_clamp(
24    float addrspace(1)* %r,
25    <2 x half> addrspace(1)* %a,
26    <2 x half> addrspace(1)* %b,
27    float addrspace(1)* %c) {
28entry:
29  %a.val = load <2 x half>, <2 x half> addrspace(1)* %a
30  %b.val = load <2 x half>, <2 x half> addrspace(1)* %b
31  %c.val = load float, float addrspace(1)* %c
32  %r.val = call float @llvm.amdgcn.fdot2(<2 x half> %a.val, <2 x half> %b.val, float %c.val, i1 0)
33  store float %r.val, float addrspace(1)* %r
34  ret void
35}
36