Brendon Cahoon | d11c92a | 2015-05-13 17:56:03 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=hexagon -mcpu=hexagonv5 < %s | FileCheck %s |
| 2 | ; |
| 3 | ; Generate loop1 instruction for double loop sequence. |
| 4 | |
Krzysztof Parzyszek | a72fad9 | 2017-02-10 15:33:13 +0000 | [diff] [blame^] | 5 | ; CHECK: loop1(.LBB{{.}}_{{.}},#100) |
| 6 | ; CHECK: loop0(.LBB{{.}}_{{.}},#100) |
Brendon Cahoon | d11c92a | 2015-05-13 17:56:03 +0000 | [diff] [blame] | 7 | ; CHECK: endloop0 |
| 8 | ; CHECK: endloop1 |
| 9 | |
| 10 | define i32 @main() #0 { |
| 11 | entry: |
| 12 | %array = alloca [100 x i32], align 8 |
| 13 | %doublearray = alloca [100 x [100 x i32]], align 8 |
| 14 | %0 = bitcast [100 x i32]* %array to i8* |
| 15 | call void @llvm.lifetime.start(i64 400, i8* %0) #1 |
| 16 | %1 = bitcast [100 x [100 x i32]]* %doublearray to i8* |
| 17 | call void @llvm.lifetime.start(i64 40000, i8* %1) #1 |
| 18 | %arrayidx1 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %doublearray, i32 0, i32 10, i32 10 |
| 19 | %arrayidx2.gep = getelementptr [100 x i32], [100 x i32]* %array, i32 0, i32 0 |
| 20 | br label %for.body |
| 21 | |
| 22 | for.body: |
| 23 | %2 = phi i32 [ undef, %entry ], [ %.pre, %for.body.for.body_crit_edge ] |
| 24 | %sum.031 = phi i32 [ undef, %entry ], [ %add, %for.body.for.body_crit_edge ] |
| 25 | %arrayidx2.phi = phi i32* [ %arrayidx2.gep, %entry ], [ %arrayidx2.inc, %for.body.for.body_crit_edge ] |
| 26 | %i.030 = phi i32 [ 1, %entry ], [ %phitmp, %for.body.for.body_crit_edge ] |
| 27 | %add = add nsw i32 %2, %sum.031 |
| 28 | %exitcond33 = icmp eq i32 %i.030, 100 |
| 29 | %arrayidx2.inc = getelementptr i32, i32* %arrayidx2.phi, i32 1 |
| 30 | br i1 %exitcond33, label %for.cond7.preheader.preheader, label %for.body.for.body_crit_edge |
| 31 | |
| 32 | for.cond7.preheader.preheader: |
| 33 | br label %for.cond7.preheader |
| 34 | |
| 35 | for.body.for.body_crit_edge: |
| 36 | %.pre = load i32, i32* %arrayidx2.inc, align 4 |
| 37 | %phitmp = add i32 %i.030, 1 |
| 38 | br label %for.body |
| 39 | |
| 40 | for.cond7.preheader: |
| 41 | %i.129 = phi i32 [ %inc16, %for.inc15 ], [ 0, %for.cond7.preheader.preheader ] |
| 42 | br label %for.body9 |
| 43 | |
| 44 | for.body9: |
| 45 | %j.028 = phi i32 [ 0, %for.cond7.preheader ], [ %inc13, %for.body9 ] |
| 46 | %arrayidx11 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %doublearray, i32 0, i32 %i.129, i32 %j.028 |
| 47 | store i32 %add, i32* %arrayidx11, align 4 |
| 48 | %inc13 = add nsw i32 %j.028, 1 |
| 49 | %exitcond = icmp eq i32 %inc13, 100 |
| 50 | br i1 %exitcond, label %for.inc15, label %for.body9 |
| 51 | |
| 52 | for.inc15: |
| 53 | %inc16 = add nsw i32 %i.129, 1 |
| 54 | %exitcond32 = icmp eq i32 %inc16, 100 |
| 55 | br i1 %exitcond32, label %for.end17, label %for.cond7.preheader |
| 56 | |
| 57 | for.end17: |
| 58 | %3 = load i32, i32* %arrayidx1, align 8 |
| 59 | call void @llvm.lifetime.end(i64 40000, i8* %1) #1 |
| 60 | call void @llvm.lifetime.end(i64 400, i8* %0) #1 |
| 61 | ret i32 %3 |
| 62 | } |
| 63 | |
| 64 | declare void @llvm.lifetime.start(i64, i8* nocapture) #1 |
| 65 | |
| 66 | declare void @llvm.lifetime.end(i64, i8* nocapture) #1 |