• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2
3declare i32 @llvm.amdgcn.workitem.id.x() nounwind readnone
4
5; FUNC-LABEL: @v_test_imax3_sgt_i32
6; SI: v_max3_i32
7define void @v_test_imax3_sgt_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %aptr, i32 addrspace(1)* %bptr, i32 addrspace(1)* %cptr) nounwind {
8  %tid = call i32 @llvm.amdgcn.workitem.id.x() nounwind readnone
9  %gep0 = getelementptr i32, i32 addrspace(1)* %aptr, i32 %tid
10  %gep1 = getelementptr i32, i32 addrspace(1)* %bptr, i32 %tid
11  %gep2 = getelementptr i32, i32 addrspace(1)* %cptr, i32 %tid
12  %outgep = getelementptr i32, i32 addrspace(1)* %out, i32 %tid
13  %a = load i32, i32 addrspace(1)* %gep0, align 4
14  %b = load i32, i32 addrspace(1)* %gep1, align 4
15  %c = load i32, i32 addrspace(1)* %gep2, align 4
16  %icmp0 = icmp sgt i32 %a, %b
17  %i0 = select i1 %icmp0, i32 %a, i32 %b
18  %icmp1 = icmp sgt i32 %i0, %c
19  %i1 = select i1 %icmp1, i32 %i0, i32 %c
20  store i32 %i1, i32 addrspace(1)* %out, align 4
21  ret void
22}
23
24; FUNC-LABEL: @v_test_umax3_ugt_i32
25; SI: v_max3_u32
26define void @v_test_umax3_ugt_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %aptr, i32 addrspace(1)* %bptr, i32 addrspace(1)* %cptr) nounwind {
27  %tid = call i32 @llvm.amdgcn.workitem.id.x() nounwind readnone
28  %gep0 = getelementptr i32, i32 addrspace(1)* %aptr, i32 %tid
29  %gep1 = getelementptr i32, i32 addrspace(1)* %bptr, i32 %tid
30  %gep2 = getelementptr i32, i32 addrspace(1)* %cptr, i32 %tid
31  %outgep = getelementptr i32, i32 addrspace(1)* %out, i32 %tid
32  %a = load i32, i32 addrspace(1)* %gep0, align 4
33  %b = load i32, i32 addrspace(1)* %gep1, align 4
34  %c = load i32, i32 addrspace(1)* %gep2, align 4
35  %icmp0 = icmp ugt i32 %a, %b
36  %i0 = select i1 %icmp0, i32 %a, i32 %b
37  %icmp1 = icmp ugt i32 %i0, %c
38  %i1 = select i1 %icmp1, i32 %i0, i32 %c
39  store i32 %i1, i32 addrspace(1)* %out, align 4
40  ret void
41}
42