150
|
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
|
|
4
|
|
5 declare i32 @llvm.amdgcn.udot2(<2 x i16> %a, <2 x i16> %b, i32 %c, i1 %clamp)
|
221
|
6 declare i32 @llvm.amdgcn.workitem.id.x()
|
150
|
7
|
221
|
8 ; GCN-LABEL: {{^}}test_llvm_amdgcn_udot2_clamp:
|
150
|
9 ; GFX906: v_dot2_u32_u16 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} clamp{{$}}
|
|
10 ; GFX10: v_dot2_u32_u16 v{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}} clamp{{$}}
|
|
11 define amdgpu_kernel void @test_llvm_amdgcn_udot2_clamp(
|
|
12 i32 addrspace(1)* %r,
|
|
13 <2 x i16> addrspace(1)* %a,
|
|
14 <2 x i16> addrspace(1)* %b,
|
|
15 i32 addrspace(1)* %c) {
|
|
16 entry:
|
|
17 %a.val = load <2 x i16>, <2 x i16> addrspace(1)* %a
|
|
18 %b.val = load <2 x i16>, <2 x i16> addrspace(1)* %b
|
|
19 %c.val = load i32, i32 addrspace(1)* %c
|
|
20 %r.val = call i32 @llvm.amdgcn.udot2(<2 x i16> %a.val, <2 x i16> %b.val, i32 %c.val, i1 1)
|
|
21 store i32 %r.val, i32 addrspace(1)* %r
|
|
22 ret void
|
|
23 }
|
|
24
|
221
|
25 ; GCN-LABEL: {{^}}test_llvm_amdgcn_udot2_no_clamp:
|
150
|
26 ; GFX906: v_dot2_u32_u16 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}{{$}}
|
|
27 ; GFX10: v_dot2_u32_u16 v{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}}{{$}}
|
|
28 define amdgpu_kernel void @test_llvm_amdgcn_udot2_no_clamp(
|
|
29 i32 addrspace(1)* %r,
|
|
30 <2 x i16> addrspace(1)* %a,
|
|
31 <2 x i16> addrspace(1)* %b,
|
|
32 i32 addrspace(1)* %c) {
|
|
33 entry:
|
|
34 %a.val = load <2 x i16>, <2 x i16> addrspace(1)* %a
|
|
35 %b.val = load <2 x i16>, <2 x i16> addrspace(1)* %b
|
|
36 %c.val = load i32, i32 addrspace(1)* %c
|
|
37 %r.val = call i32 @llvm.amdgcn.udot2(<2 x i16> %a.val, <2 x i16> %b.val, i32 %c.val, i1 0)
|
|
38 store i32 %r.val, i32 addrspace(1)* %r
|
|
39 ret void
|
|
40 }
|
221
|
41
|
|
42 ; GCN-LABEL: {{^}}test_llvm_amdgcn_udot2_op_sel:
|
|
43 ; GFX906: v_dot2_u32_u16 v{{[0-9]+}}, 1, v{{[0-9]+}}, s{{[0-9]+}} op_sel:[0,1,0] op_sel_hi:[0,0,1]{{$}}
|
|
44 ; GFX10: v_dot2_u32_u16 v{{[0-9]+}}, 1, v{{[0-9]+}}, s{{[0-9]+}} op_sel:[0,1,0] op_sel_hi:[0,0,1]{{$}}
|
|
45 define amdgpu_kernel void @test_llvm_amdgcn_udot2_op_sel(
|
|
46 i32 addrspace(1)* %r,
|
|
47 <2 x i16> addrspace(1)* %b,
|
|
48 i32 %c) {
|
|
49 entry:
|
|
50 %id = tail call i32 @llvm.amdgcn.workitem.id.x()
|
|
51 %b.gep = getelementptr inbounds <2 x i16>, <2 x i16> addrspace(1)* %b, i32 %id
|
|
52 %b.val = load <2 x i16>, <2 x i16> addrspace(1)* %b.gep
|
|
53 %b.elt0 = extractelement <2 x i16> %b.val, i32 0
|
|
54 %b.elt1 = extractelement <2 x i16> %b.val, i32 1
|
|
55 %b0 = insertelement <2 x i16> undef, i16 %b.elt1, i32 0
|
|
56 %b1 = insertelement <2 x i16> %b0, i16 %b.elt0, i32 1
|
|
57 %r.val = call i32 @llvm.amdgcn.udot2(<2 x i16> <i16 1, i16 1>, <2 x i16> %b1, i32 %c, i1 0)
|
|
58 store i32 %r.val, i32 addrspace(1)* %r
|
|
59 ret void
|
|
60 }
|