1 ; RUN: llc -march=amdgcn < %s | FileCheck -check-prefixes=GCN,SI %s
2 ; RUN: llc -march=amdgcn -mcpu=tonga < %s | FileCheck -check-prefixes=GCN,VI %s
3 ; RUN: llc -march=amdgcn -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,GFX9 %s
5 ; GCN-LABEL: {{^}}v_test_imax3_sgt_i32:
7 define amdgpu_kernel void @v_test_imax3_sgt_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %aptr, i32 addrspace(1)* %bptr, i32 addrspace(1)* %cptr) #0 {
8 %tid = call i32 @llvm.amdgcn.workitem.id.x()
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
14 %b = load i32, i32 addrspace(1)* %gep1
15 %c = load i32, i32 addrspace(1)* %gep2
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
24 ; GCN-LABEL: {{^}}v_test_umax3_ugt_i32:
26 define amdgpu_kernel void @v_test_umax3_ugt_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %aptr, i32 addrspace(1)* %bptr, i32 addrspace(1)* %cptr) #0 {
27 %tid = call i32 @llvm.amdgcn.workitem.id.x()
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
33 %b = load i32, i32 addrspace(1)* %gep1
34 %c = load i32, i32 addrspace(1)* %gep2
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
43 ; GCN-LABEL: {{^}}v_test_imax3_sgt_i16:
50 define amdgpu_kernel void @v_test_imax3_sgt_i16(i16 addrspace(1)* %out, i16 addrspace(1)* %aptr, i16 addrspace(1)* %bptr, i16 addrspace(1)* %cptr) #0 {
51 %tid = call i32 @llvm.amdgcn.workitem.id.x()
52 %gep0 = getelementptr i16, i16 addrspace(1)* %aptr, i32 %tid
53 %gep1 = getelementptr i16, i16 addrspace(1)* %bptr, i32 %tid
54 %gep2 = getelementptr i16, i16 addrspace(1)* %cptr, i32 %tid
55 %outgep = getelementptr i16, i16 addrspace(1)* %out, i32 %tid
56 %a = load i16, i16 addrspace(1)* %gep0
57 %b = load i16, i16 addrspace(1)* %gep1
58 %c = load i16, i16 addrspace(1)* %gep2
59 %icmp0 = icmp sgt i16 %a, %b
60 %i0 = select i1 %icmp0, i16 %a, i16 %b
61 %icmp1 = icmp sgt i16 %i0, %c
62 %i1 = select i1 %icmp1, i16 %i0, i16 %c
63 store i16 %i1, i16 addrspace(1)* %out
67 ; GCN-LABEL: {{^}}v_test_umax3_ugt_i16:
74 define amdgpu_kernel void @v_test_umax3_ugt_i16(i16 addrspace(1)* %out, i16 addrspace(1)* %aptr, i16 addrspace(1)* %bptr, i16 addrspace(1)* %cptr) #0 {
75 %tid = call i32 @llvm.amdgcn.workitem.id.x()
76 %gep0 = getelementptr i16, i16 addrspace(1)* %aptr, i32 %tid
77 %gep1 = getelementptr i16, i16 addrspace(1)* %bptr, i32 %tid
78 %gep2 = getelementptr i16, i16 addrspace(1)* %cptr, i32 %tid
79 %outgep = getelementptr i16, i16 addrspace(1)* %out, i32 %tid
80 %a = load i16, i16 addrspace(1)* %gep0
81 %b = load i16, i16 addrspace(1)* %gep1
82 %c = load i16, i16 addrspace(1)* %gep2
83 %icmp0 = icmp ugt i16 %a, %b
84 %i0 = select i1 %icmp0, i16 %a, i16 %b
85 %icmp1 = icmp ugt i16 %i0, %c
86 %i1 = select i1 %icmp1, i16 %i0, i16 %c
87 store i16 %i1, i16 addrspace(1)* %out
91 declare i32 @llvm.amdgcn.workitem.id.x() #1
93 attributes #0 = { nounwind }
94 attributes #1 = { nounwind readnone speculatable }