Matt Arsenault | 701c21e | 2016-04-29 21:52:13 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s |
| 2 | |
| 3 | ; GCN-LABEL: {{^}}lower_control_flow_unreachable_terminator: |
| 4 | ; GCN: v_cmp_eq_i32 |
| 5 | ; GCN: s_and_saveexec_b64 |
| 6 | ; GCN: s_xor_b64 |
| 7 | ; GCN: s_branch BB0_1 |
| 8 | |
| 9 | ; GCN: s_or_b64 exec, exec |
| 10 | ; GCN: s_endpgm |
| 11 | |
| 12 | ; GCN: ds_write_b32 |
| 13 | ; GCN: s_waitcnt |
| 14 | define void @lower_control_flow_unreachable_terminator() #0 { |
| 15 | bb: |
| 16 | %tmp15 = tail call i32 @llvm.amdgcn.workitem.id.y() |
| 17 | %tmp63 = icmp eq i32 %tmp15, 32 |
| 18 | br i1 %tmp63, label %bb64, label %bb68 |
| 19 | |
| 20 | bb64: |
| 21 | store volatile i32 0, i32 addrspace(3)* undef, align 4 |
| 22 | unreachable |
| 23 | |
| 24 | bb68: |
| 25 | ret void |
| 26 | } |
| 27 | |
| 28 | ; GCN-LABEL: {{^}}lower_control_flow_unreachable_terminator_swap_block_order: |
| 29 | ; GCN: v_cmp_eq_i32 |
| 30 | ; GCN: s_and_saveexec_b64 |
| 31 | ; GCN: s_xor_b64 |
| 32 | ; GCN: s_endpgm |
| 33 | |
| 34 | ; GCN: s_or_b64 exec, exec |
| 35 | ; GCN: ds_write_b32 |
| 36 | ; GCN: s_waitcnt |
| 37 | define void @lower_control_flow_unreachable_terminator_swap_block_order() #0 { |
| 38 | bb: |
| 39 | %tmp15 = tail call i32 @llvm.amdgcn.workitem.id.y() |
| 40 | %tmp63 = icmp eq i32 %tmp15, 32 |
| 41 | br i1 %tmp63, label %bb68, label %bb64 |
| 42 | |
| 43 | bb68: |
| 44 | ret void |
| 45 | |
| 46 | bb64: |
| 47 | store volatile i32 0, i32 addrspace(3)* undef, align 4 |
| 48 | unreachable |
| 49 | } |
| 50 | |
| 51 | ; Function Attrs: nounwind readnone |
| 52 | declare i32 @llvm.amdgcn.workitem.id.y() #1 |
| 53 | |
| 54 | attributes #0 = { nounwind } |
| 55 | attributes #1 = { nounwind readnone } |
| 56 | attributes #2 = { nounwind } |