blob: 06cc7fcad0646f44ee8ec36dad5afce6aa7ce9d6 [file] [log] [blame]
Stanislav Mekhanoshine3eb42c2017-06-21 22:05:06 +00001; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
3; GCN-LABEL: {{^}}add1:
4; GCN: v_cmp_gt_u32_e{{32|64}} [[CC:[^,]+]], v{{[0-9]+}}, v{{[0-9]+}}
5; GCN: v_addc_u32_e{{32|64}} v{{[0-9]+}}, {{[^,]+}}, 0, v{{[0-9]+}}, [[CC]]
6; GCN-NOT: v_cndmask
7
8define amdgpu_kernel void @add1(i32 addrspace(1)* nocapture %arg) {
9bb:
10 %x = tail call i32 @llvm.amdgcn.workitem.id.x()
11 %y = tail call i32 @llvm.amdgcn.workitem.id.y()
12 %gep = getelementptr inbounds i32, i32 addrspace(1)* %arg, i32 %x
13 %v = load i32, i32 addrspace(1)* %gep, align 4
14 %cmp = icmp ugt i32 %x, %y
15 %ext = zext i1 %cmp to i32
16 %add = add i32 %v, %ext
17 store i32 %add, i32 addrspace(1)* %gep, align 4
18 ret void
19}
20
21; GCN-LABEL: {{^}}sub1:
22; GCN: v_cmp_gt_u32_e{{32|64}} [[CC:[^,]+]], v{{[0-9]+}}, v{{[0-9]+}}
23; GCN: v_subb_u32_e{{32|64}} v{{[0-9]+}}, {{[^,]+}}, v{{[0-9]+}}, 0, [[CC]]
24; GCN-NOT: v_cndmask
25
26define amdgpu_kernel void @sub1(i32 addrspace(1)* nocapture %arg) {
27bb:
28 %x = tail call i32 @llvm.amdgcn.workitem.id.x()
29 %y = tail call i32 @llvm.amdgcn.workitem.id.y()
30 %gep = getelementptr inbounds i32, i32 addrspace(1)* %arg, i32 %x
31 %v = load i32, i32 addrspace(1)* %gep, align 4
32 %cmp = icmp ugt i32 %x, %y
33 %ext = sext i1 %cmp to i32
34 %add = add i32 %v, %ext
35 store i32 %add, i32 addrspace(1)* %gep, align 4
36 ret void
37}
38
39declare i32 @llvm.amdgcn.workitem.id.x() #0
40
41declare i32 @llvm.amdgcn.workitem.id.y() #0
42
43attributes #0 = { nounwind readnone speculatable }