1 ; RUN: llc -march=amdgcn -mcpu=gfx906 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=GCN,GFX906
2 ; RUN: llc -march=amdgcn -mcpu=gfx1011 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=GCN,GFX10
3 ; RUN: llc -march=amdgcn -mcpu=gfx1012 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=GCN,GFX10
5 declare float @llvm.amdgcn.fdot2(<2 x half> %a, <2 x half> %b, float %c, i1 %clamp)
7 ; GCN-LABEL: {{^}}test_llvm_amdgcn_fdot2_clamp
8 ; GFX906: v_dot2_f32_f16 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} clamp{{$}}
9 ; GFX10: v_dot2_f32_f16 v{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}} clamp{{$}}
10 define amdgpu_kernel void @test_llvm_amdgcn_fdot2_clamp(
11 float addrspace(1)* %r,
12 <2 x half> addrspace(1)* %a,
13 <2 x half> addrspace(1)* %b,
14 float addrspace(1)* %c) {
16 %a.val = load <2 x half>, <2 x half> addrspace(1)* %a
17 %b.val = load <2 x half>, <2 x half> addrspace(1)* %b
18 %c.val = load float, float addrspace(1)* %c
19 %r.val = call float @llvm.amdgcn.fdot2(<2 x half> %a.val, <2 x half> %b.val, float %c.val, i1 1)
20 store float %r.val, float addrspace(1)* %r
24 ; GCN-LABEL: {{^}}test_llvm_amdgcn_fdot2_no_clamp
25 ; GFX906: v_dot2_f32_f16 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}{{$}}
26 ; GFX10: v_dot2c_f32_f16_e32 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}}{{$}}
27 define amdgpu_kernel void @test_llvm_amdgcn_fdot2_no_clamp(
28 float addrspace(1)* %r,
29 <2 x half> addrspace(1)* %a,
30 <2 x half> addrspace(1)* %b,
31 float addrspace(1)* %c) {
33 %a.val = load <2 x half>, <2 x half> addrspace(1)* %a
34 %b.val = load <2 x half>, <2 x half> addrspace(1)* %b
35 %c.val = load float, float addrspace(1)* %c
36 %r.val = call float @llvm.amdgcn.fdot2(<2 x half> %a.val, <2 x half> %b.val, float %c.val, i1 0)
37 store float %r.val, float addrspace(1)* %r
41 ; GFX906-LABEL: {{^}}fdot2_inline_literal
42 ; GFX906: v_dot2_f32_f16 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, 1.0
43 define float @fdot2_inline_literal(<2 x half> %a, <2 x half> %b) {
44 %ret = tail call float @llvm.amdgcn.fdot2(<2 x half> %a, <2 x half> %b, float 1.0, i1 false)