1 ; RUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -mtriple=amdgcn < %s | FileCheck -check-prefix=SI -check-prefix=COMMON %s
2 ; RUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -mtriple=amdgcn -mcpu=tonga < %s | FileCheck -check-prefix=SI -check-prefix=COMMON %s
3 ; XUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -mtriple=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=COMMON %s
5 ; SI hits an assertion at -O0, evergreen hits a not implemented unreachable.
7 ; COMMON-LABEL: {{^}}branch_true:
8 define amdgpu_kernel void @branch_true(ptr addrspace(1) nocapture %main, i32 %main_stride) #0 {
10 br i1 true, label %for.end, label %for.body.lr.ph
12 for.body.lr.ph: ; preds = %entry
13 %add.ptr.sum = shl i32 %main_stride, 1
14 %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride
15 %add.ptr4.sum = shl i32 %main_stride, 2
18 for.body: ; preds = %for.body, %for.body.lr.ph
19 %main.addr.011 = phi ptr addrspace(1) [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ]
20 %0 = load i32, ptr addrspace(1) %main.addr.011, align 4
21 %add.ptr = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %main_stride
22 %1 = load i32, ptr addrspace(1) %add.ptr, align 4
23 %add.ptr1 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %add.ptr.sum
24 %2 = load i32, ptr addrspace(1) %add.ptr1, align 4
25 %add.ptr2 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %add.ptr1.sum
26 %3 = load i32, ptr addrspace(1) %add.ptr2, align 4
27 %add.ptr3 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %add.ptr4.sum
28 %4 = load i32, ptr addrspace(1) %add.ptr3, align 4
29 %add.ptr6 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 undef
30 br i1 undef, label %for.end, label %for.body
32 for.end: ; preds = %for.body, %entry
36 ; COMMON-LABEL: {{^}}branch_false:
39 define amdgpu_kernel void @branch_false(ptr addrspace(1) nocapture %main, i32 %main_stride) #0 {
41 br i1 false, label %for.end, label %for.body.lr.ph
43 for.body.lr.ph: ; preds = %entry
44 %add.ptr.sum = shl i32 %main_stride, 1
45 %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride
46 %add.ptr4.sum = shl i32 %main_stride, 2
49 for.body: ; preds = %for.body, %for.body.lr.ph
50 %main.addr.011 = phi ptr addrspace(1) [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ]
51 %0 = load i32, ptr addrspace(1) %main.addr.011, align 4
52 %add.ptr = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %main_stride
53 %1 = load i32, ptr addrspace(1) %add.ptr, align 4
54 %add.ptr1 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %add.ptr.sum
55 %2 = load i32, ptr addrspace(1) %add.ptr1, align 4
56 %add.ptr2 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %add.ptr1.sum
57 %3 = load i32, ptr addrspace(1) %add.ptr2, align 4
58 %add.ptr3 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %add.ptr4.sum
59 %4 = load i32, ptr addrspace(1) %add.ptr3, align 4
60 %add.ptr6 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 undef
61 br i1 undef, label %for.end, label %for.body
63 for.end: ; preds = %for.body, %entry
67 ; COMMON-LABEL: {{^}}branch_undef:
71 define amdgpu_kernel void @branch_undef(ptr addrspace(1) nocapture %main, i32 %main_stride) #0 {
73 br i1 undef, label %for.end, label %for.body.lr.ph
75 for.body.lr.ph: ; preds = %entry
76 %add.ptr.sum = shl i32 %main_stride, 1
77 %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride
78 %add.ptr4.sum = shl i32 %main_stride, 2
81 for.body: ; preds = %for.body, %for.body.lr.ph
82 %main.addr.011 = phi ptr addrspace(1) [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ]
83 %0 = load i32, ptr addrspace(1) %main.addr.011, align 4
84 %add.ptr = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %main_stride
85 %1 = load i32, ptr addrspace(1) %add.ptr, align 4
86 %add.ptr1 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %add.ptr.sum
87 %2 = load i32, ptr addrspace(1) %add.ptr1, align 4
88 %add.ptr2 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %add.ptr1.sum
89 %3 = load i32, ptr addrspace(1) %add.ptr2, align 4
90 %add.ptr3 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 %add.ptr4.sum
91 %4 = load i32, ptr addrspace(1) %add.ptr3, align 4
92 %add.ptr6 = getelementptr inbounds i8, ptr addrspace(1) %main.addr.011, i32 undef
93 br i1 undef, label %for.end, label %for.body
95 for.end: ; preds = %for.body, %entry
99 attributes #0 = { nounwind }