1; RUN: llc < %s -march=amdgcn -mcpu=verde -verify-machineinstrs | FileCheck --check-prefix=SI --check-prefix=FUNC %s 2; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck --check-prefix=SI --check-prefix=FUNC %s 3 4; FUNC-LABEL: {{^}}break_inserted_outside_of_loop: 5 6; SI: [[LOOP_LABEL:[A-Z0-9]+]]: 7; Lowered break instructin: 8; SI: s_or_b64 9; Lowered Loop instruction: 10; SI: s_andn2_b64 11; s_cbranch_execnz [[LOOP_LABEL]] 12; SI: s_endpgm 13define void @break_inserted_outside_of_loop(i32 addrspace(1)* %out, i32 %a, i32 %b) { 14main_body: 15 %0 = and i32 %a, %b 16 %1 = trunc i32 %0 to i1 17 br label %ENDIF 18 19ENDLOOP: 20 store i32 0, i32 addrspace(1)* %out 21 ret void 22 23ENDIF: 24 br i1 %1, label %ENDLOOP, label %ENDIF 25} 26 27 28; FUNC-LABEL: {{^}}phi_cond_outside_loop: 29; FIXME: This could be folded into the s_or_b64 instruction 30; SI: s_mov_b64 [[ZERO:s\[[0-9]+:[0-9]+\]]], 0 31; SI: [[LOOP_LABEL:[A-Z0-9]+]] 32; SI: v_cmp_ne_i32_e32 vcc, 0, v{{[0-9]+}} 33 34; SI_IF_BREAK instruction: 35; SI: s_or_b64 [[BREAK:s\[[0-9]+:[0-9]+\]]], vcc, [[ZERO]] 36 37; SI_LOOP instruction: 38; SI: s_andn2_b64 exec, exec, [[BREAK]] 39; SI: s_cbranch_execnz [[LOOP_LABEL]] 40; SI: s_endpgm 41 42define void @phi_cond_outside_loop(i32 %a, i32 %b) { 43entry: 44 %0 = icmp eq i32 %a , 0 45 br i1 %0, label %if, label %else 46 47if: 48 br label %endif 49 50else: 51 %1 = icmp eq i32 %b, 0 52 br label %endif 53 54endif: 55 %2 = phi i1 [0, %if], [%1, %else] 56 br label %loop 57 58loop: 59 br i1 %2, label %exit, label %loop 60 61exit: 62 ret void 63} 64