Brendon Cahoon | 9376e99 | 2015-05-14 14:15:08 +0000 | [diff] [blame] | 1 | ; RUN: llc -O2 -march=hexagon -mcpu=hexagonv5 < %s |
| 2 | ; REQUIRES: asserts |
| 3 | ; Check for successful compilation. |
| 4 | |
| 5 | @c = common global i32 0, align 4 |
| 6 | @e = common global i32 0, align 4 |
| 7 | @g = common global i32* null, align 4 |
| 8 | @a = common global i32 0, align 4 |
| 9 | @b = common global i32 0, align 4 |
| 10 | @h = common global i32* null, align 4 |
| 11 | @d = common global i32 0, align 4 |
| 12 | @f = common global i32 0, align 4 |
| 13 | |
| 14 | define i32 @fn1([0 x i32]* nocapture readnone %p1) #0 { |
| 15 | entry: |
| 16 | %0 = load i32*, i32** @h, align 4 |
| 17 | %1 = load i32*, i32** @g, align 4 |
| 18 | %.pre = load i32, i32* @c, align 4 |
| 19 | br label %for.cond |
| 20 | |
| 21 | for.cond: |
| 22 | %2 = phi i32 [ %10, %if.end ], [ %.pre, %entry ] |
| 23 | store i32 %2, i32* @e, align 4 |
| 24 | %tobool5 = icmp eq i32 %2, 0 |
| 25 | br i1 %tobool5, label %for.end, label %for.body.lr.ph |
| 26 | |
| 27 | for.body.lr.ph: |
| 28 | %3 = sub i32 -5, %2 |
| 29 | %4 = urem i32 %3, 5 |
| 30 | %5 = sub i32 %3, %4 |
| 31 | br label %for.body |
| 32 | |
| 33 | for.body: |
| 34 | %add6 = phi i32 [ %2, %for.body.lr.ph ], [ %add, %for.body ] |
| 35 | %6 = load i32, i32* %1, align 4 |
| 36 | store i32 %6, i32* @a, align 4 |
| 37 | %add = add nsw i32 %add6, 5 |
| 38 | %tobool = icmp eq i32 %add, 0 |
| 39 | br i1 %tobool, label %for.cond1.for.end_crit_edge, label %for.body |
| 40 | |
| 41 | for.cond1.for.end_crit_edge: |
| 42 | %7 = add i32 %2, 5 |
| 43 | %8 = add i32 %7, %5 |
| 44 | store i32 %8, i32* @e, align 4 |
| 45 | br label %for.end |
| 46 | |
| 47 | for.end: |
| 48 | %9 = load i32, i32* @b, align 4 |
| 49 | %tobool2 = icmp eq i32 %9, 0 |
| 50 | br i1 %tobool2, label %if.end, label %if.then |
| 51 | |
| 52 | if.then: |
| 53 | store i32 0, i32* %0, align 4 |
| 54 | %.pre7 = load i32, i32* @c, align 4 |
| 55 | br label %if.end |
| 56 | |
| 57 | if.end: |
| 58 | %10 = phi i32 [ %2, %for.end ], [ %.pre7, %if.then ] |
| 59 | store i32 %10, i32* @d, align 4 |
| 60 | %11 = load i32, i32* @f, align 4 |
| 61 | %inc = add nsw i32 %11, 1 |
| 62 | store i32 %inc, i32* @f, align 4 |
| 63 | br label %for.cond |
| 64 | } |