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