Tom Stellard | 0f29de7 | 2015-02-05 15:32:15 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=amdgcn -mcpu=SI -verify-machineinstrs | FileCheck %s |
| 2 | |
| 3 | ; This tests that the llvm.SI.end.cf intrinsic is not inserted into the |
| 4 | ; loop block. This intrinsic will be lowered to s_or_b64 by the code |
| 5 | ; generator. |
| 6 | |
| 7 | ; CHECK-LABEL: {{^}}test: |
| 8 | |
| 9 | ; This is was lowered from the llvm.SI.end.cf intrinsic: |
| 10 | ; CHECK: s_or_b64 exec, exec |
| 11 | |
| 12 | ; CHECK: [[LOOP_LABEL:[0-9A-Za-z_]+]]: ; %loop{{$}} |
| 13 | ; CHECK-NOT: s_or_b64 exec, exec |
| 14 | ; CHECK: s_cbranch_execnz [[LOOP_LABEL]] |
Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 15 | define void @test(i32 addrspace(1)* %out) { |
Tom Stellard | 0f29de7 | 2015-02-05 15:32:15 +0000 | [diff] [blame] | 16 | entry: |
Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 17 | %cond = call i32 @llvm.r600.read.tidig.x() #0 |
Tom Stellard | 0f29de7 | 2015-02-05 15:32:15 +0000 | [diff] [blame] | 18 | %tmp0 = icmp eq i32 %cond, 0 |
| 19 | br i1 %tmp0, label %if, label %loop |
| 20 | |
| 21 | if: |
| 22 | store i32 0, i32 addrspace(1)* %out |
| 23 | br label %loop |
| 24 | |
| 25 | loop: |
| 26 | %tmp1 = phi i32 [0, %entry], [0, %if], [%inc, %loop] |
| 27 | %inc = add i32 %tmp1, %cond |
| 28 | %tmp2 = icmp ugt i32 %inc, 10 |
| 29 | br i1 %tmp2, label %done, label %loop |
| 30 | |
| 31 | done: |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 32 | %tmp3 = getelementptr i32, i32 addrspace(1)* %out, i64 1 |
Tom Stellard | 0f29de7 | 2015-02-05 15:32:15 +0000 | [diff] [blame] | 33 | store i32 %inc, i32 addrspace(1)* %tmp3 |
| 34 | ret void |
| 35 | } |
Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 36 | |
| 37 | declare i32 @llvm.r600.read.tidig.x() #0 |
| 38 | |
| 39 | attributes #0 = { readnone } |