Karl Schimpf | c836acb | 2014-09-05 08:32:47 -0700 | [diff] [blame] | 1 | ; Tests if we handle a branch instructions. |
| 2 | |
Karl Schimpf | 2a5324a | 2014-09-25 09:37:49 -0700 | [diff] [blame] | 3 | ; RUN: %p2i -i %s --insts | FileCheck %s |
Jim Stichnoth | 0d4fc92 | 2015-12-13 21:36:33 -0800 | [diff] [blame] | 4 | ; RUN: %p2i -i %s --args -notranslate -timing | \ |
Karl Schimpf | 6fcbddd | 2014-11-06 09:49:24 -0800 | [diff] [blame] | 5 | ; RUN: FileCheck --check-prefix=NOIR %s |
Karl Schimpf | c836acb | 2014-09-05 08:32:47 -0700 | [diff] [blame] | 6 | |
Karl Schimpf | 57d31ac | 2015-10-07 09:53:12 -0700 | [diff] [blame] | 7 | define internal void @SimpleBranch() { |
Karl Schimpf | c132b76 | 2014-09-11 09:43:47 -0700 | [diff] [blame] | 8 | entry: |
Karl Schimpf | c836acb | 2014-09-05 08:32:47 -0700 | [diff] [blame] | 9 | br label %b3 |
| 10 | b1: |
| 11 | br label %b2 |
| 12 | b2: |
| 13 | ret void |
| 14 | b3: |
| 15 | br label %b1 |
| 16 | } |
| 17 | |
Karl Schimpf | 57d31ac | 2015-10-07 09:53:12 -0700 | [diff] [blame] | 18 | ; CHECK: define internal void @SimpleBranch() { |
Karl Schimpf | c132b76 | 2014-09-11 09:43:47 -0700 | [diff] [blame] | 19 | ; CHECK-NEXT: entry: |
| 20 | ; CHECK-NEXT: br label %b3 |
| 21 | ; CHECK-NEXT: b1: |
| 22 | ; CHECK-NEXT: br label %b2 |
| 23 | ; CHECK-NEXT: b2: |
Karl Schimpf | c836acb | 2014-09-05 08:32:47 -0700 | [diff] [blame] | 24 | ; CHECK-NEXT: ret void |
Karl Schimpf | c132b76 | 2014-09-11 09:43:47 -0700 | [diff] [blame] | 25 | ; CHECK-NEXT: b3: |
| 26 | ; CHECK-NEXT: br label %b1 |
Karl Schimpf | c836acb | 2014-09-05 08:32:47 -0700 | [diff] [blame] | 27 | ; CHECK-NEXT: } |
| 28 | |
Karl Schimpf | 57d31ac | 2015-10-07 09:53:12 -0700 | [diff] [blame] | 29 | define internal void @CondBranch(i32 %p) { |
Karl Schimpf | c132b76 | 2014-09-11 09:43:47 -0700 | [diff] [blame] | 30 | entry: |
Karl Schimpf | c836acb | 2014-09-05 08:32:47 -0700 | [diff] [blame] | 31 | %test = trunc i32 %p to i1 |
| 32 | br i1 %test, label %b1, label %b2 |
| 33 | b1: |
| 34 | ret void |
| 35 | b2: |
| 36 | br i1 %test, label %b2, label %b1 |
| 37 | } |
| 38 | |
Karl Schimpf | 57d31ac | 2015-10-07 09:53:12 -0700 | [diff] [blame] | 39 | ; CHECK-NEXT: define internal void @CondBranch(i32 %p) { |
Karl Schimpf | c132b76 | 2014-09-11 09:43:47 -0700 | [diff] [blame] | 40 | ; CHECK-NEXT: entry: |
| 41 | ; CHECK-NEXT: %test = trunc i32 %p to i1 |
| 42 | ; CHECK-NEXT: br i1 %test, label %b1, label %b2 |
| 43 | ; CHECK-NEXT: b1: |
Karl Schimpf | c836acb | 2014-09-05 08:32:47 -0700 | [diff] [blame] | 44 | ; CHECK-NEXT: ret void |
Karl Schimpf | c132b76 | 2014-09-11 09:43:47 -0700 | [diff] [blame] | 45 | ; CHECK-NEXT: b2: |
| 46 | ; CHECK-NEXT: br i1 %test, label %b2, label %b1 |
Karl Schimpf | c836acb | 2014-09-05 08:32:47 -0700 | [diff] [blame] | 47 | ; CHECK-NEXT: } |
Karl Schimpf | 6fcbddd | 2014-11-06 09:49:24 -0800 | [diff] [blame] | 48 | |
| 49 | ; NOIR: Total across all functions |