Brendon Cahoon | 55bdeb7 | 2015-04-27 14:16:43 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=hexagon -hexagon-loop-range=0 < %s | FileCheck %s |
| 2 | |
| 3 | ; Test that the loop start address operand uses a constant extender |
| 4 | ; if the offset is out of range. |
| 5 | |
| 6 | ; CHECK: loop0(##.LBB |
| 7 | ; CHECK: endloop0 |
| 8 | |
| 9 | @g = external global i32, align 4 |
| 10 | |
| 11 | define void @test(i32* nocapture %a, i32* nocapture readonly %b, i32 %n) #0 { |
| 12 | entry: |
| 13 | %cmp6 = icmp slt i32 %n, 1 |
| 14 | br i1 %cmp6, label %for.end, label %for.body.preheader |
| 15 | |
| 16 | for.body.preheader: |
| 17 | br label %for.body |
| 18 | |
| 19 | for.body: |
| 20 | %i.07 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ] |
| 21 | %arrayidx = getelementptr inbounds i32, i32* %b, i32 %i.07 |
| 22 | %0 = load i32, i32* %arrayidx, align 4 |
| 23 | %1 = load i32, i32* @g, align 4 |
| 24 | %mul = mul nsw i32 %1, %0 |
| 25 | %arrayidx1 = getelementptr inbounds i32, i32* %a, i32 %i.07 |
| 26 | store i32 %mul, i32* %arrayidx1, align 4 |
| 27 | %inc = add nuw nsw i32 %i.07, 1 |
| 28 | %exitcond = icmp eq i32 %inc, %n |
| 29 | br i1 %exitcond, label %for.end.loopexit, label %for.body |
| 30 | |
| 31 | for.end.loopexit: |
| 32 | br label %for.end |
| 33 | |
| 34 | for.end: |
| 35 | ret void |
| 36 | } |