1; RUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -march=amdgcn < %s | FileCheck -check-prefix=SI -check-prefix=COMMON %s 2; RUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -march=amdgcn -mcpu=tonga < %s | FileCheck -check-prefix=SI -check-prefix=COMMON %s 3; XUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=COMMON %s 4 5; SI hits an assertion at -O0, evergreen hits a not implemented unreachable. 6 7; COMMON-LABEL: {{^}}branch_true: 8define amdgpu_kernel void @branch_true(i8 addrspace(1)* nocapture %main, i32 %main_stride) #0 { 9entry: 10 br i1 true, label %for.end, label %for.body.lr.ph 11 12for.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 16 br label %for.body 17 18for.body: ; preds = %for.body, %for.body.lr.ph 19 %main.addr.011 = phi i8 addrspace(1)* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ] 20 %0 = bitcast i8 addrspace(1)* %main.addr.011 to i32 addrspace(1)* 21 %1 = load i32, i32 addrspace(1)* %0, align 4 22 %add.ptr = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %main_stride 23 %2 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)* 24 %3 = load i32, i32 addrspace(1)* %2, align 4 25 %add.ptr1 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr.sum 26 %4 = bitcast i8 addrspace(1)* %add.ptr1 to i32 addrspace(1)* 27 %5 = load i32, i32 addrspace(1)* %4, align 4 28 %add.ptr2 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr1.sum 29 %6 = bitcast i8 addrspace(1)* %add.ptr2 to i32 addrspace(1)* 30 %7 = load i32, i32 addrspace(1)* %6, align 4 31 %add.ptr3 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr4.sum 32 %8 = bitcast i8 addrspace(1)* %add.ptr3 to i32 addrspace(1)* 33 %9 = load i32, i32 addrspace(1)* %8, align 4 34 %add.ptr6 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 undef 35 br i1 undef, label %for.end, label %for.body 36 37for.end: ; preds = %for.body, %entry 38 ret void 39} 40 41; COMMON-LABEL: {{^}}branch_false: 42; SI: s_cbranch_scc1 43; SI: s_endpgm 44define amdgpu_kernel void @branch_false(i8 addrspace(1)* nocapture %main, i32 %main_stride) #0 { 45entry: 46 br i1 false, label %for.end, label %for.body.lr.ph 47 48for.body.lr.ph: ; preds = %entry 49 %add.ptr.sum = shl i32 %main_stride, 1 50 %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride 51 %add.ptr4.sum = shl i32 %main_stride, 2 52 br label %for.body 53 54for.body: ; preds = %for.body, %for.body.lr.ph 55 %main.addr.011 = phi i8 addrspace(1)* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ] 56 %0 = bitcast i8 addrspace(1)* %main.addr.011 to i32 addrspace(1)* 57 %1 = load i32, i32 addrspace(1)* %0, align 4 58 %add.ptr = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %main_stride 59 %2 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)* 60 %3 = load i32, i32 addrspace(1)* %2, align 4 61 %add.ptr1 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr.sum 62 %4 = bitcast i8 addrspace(1)* %add.ptr1 to i32 addrspace(1)* 63 %5 = load i32, i32 addrspace(1)* %4, align 4 64 %add.ptr2 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr1.sum 65 %6 = bitcast i8 addrspace(1)* %add.ptr2 to i32 addrspace(1)* 66 %7 = load i32, i32 addrspace(1)* %6, align 4 67 %add.ptr3 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr4.sum 68 %8 = bitcast i8 addrspace(1)* %add.ptr3 to i32 addrspace(1)* 69 %9 = load i32, i32 addrspace(1)* %8, align 4 70 %add.ptr6 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 undef 71 br i1 undef, label %for.end, label %for.body 72 73for.end: ; preds = %for.body, %entry 74 ret void 75} 76 77; COMMON-LABEL: {{^}}branch_undef: 78; SI: s_cbranch_scc1 79; SI: s_cbranch_scc1 80; SI: s_endpgm 81define amdgpu_kernel void @branch_undef(i8 addrspace(1)* nocapture %main, i32 %main_stride) #0 { 82entry: 83 br i1 undef, label %for.end, label %for.body.lr.ph 84 85for.body.lr.ph: ; preds = %entry 86 %add.ptr.sum = shl i32 %main_stride, 1 87 %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride 88 %add.ptr4.sum = shl i32 %main_stride, 2 89 br label %for.body 90 91for.body: ; preds = %for.body, %for.body.lr.ph 92 %main.addr.011 = phi i8 addrspace(1)* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ] 93 %0 = bitcast i8 addrspace(1)* %main.addr.011 to i32 addrspace(1)* 94 %1 = load i32, i32 addrspace(1)* %0, align 4 95 %add.ptr = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %main_stride 96 %2 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)* 97 %3 = load i32, i32 addrspace(1)* %2, align 4 98 %add.ptr1 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr.sum 99 %4 = bitcast i8 addrspace(1)* %add.ptr1 to i32 addrspace(1)* 100 %5 = load i32, i32 addrspace(1)* %4, align 4 101 %add.ptr2 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr1.sum 102 %6 = bitcast i8 addrspace(1)* %add.ptr2 to i32 addrspace(1)* 103 %7 = load i32, i32 addrspace(1)* %6, align 4 104 %add.ptr3 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr4.sum 105 %8 = bitcast i8 addrspace(1)* %add.ptr3 to i32 addrspace(1)* 106 %9 = load i32, i32 addrspace(1)* %8, align 4 107 %add.ptr6 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 undef 108 br i1 undef, label %for.end, label %for.body 109 110for.end: ; preds = %for.body, %entry 111 ret void 112} 113 114attributes #0 = { nounwind } 115