Krzysztof Parzyszek | 06a2b6b | 2016-07-27 21:20:54 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=hexagon -disable-machine-licm -hwloop-spec-preheader=1 < %s | FileCheck %s |
| 2 | ; CHECK: loop0 |
| 3 | |
| 4 | target triple = "hexagon" |
| 5 | |
| 6 | define i32 @foo(i32 %x, i32 %n, i32* nocapture %A, i32* nocapture %B) #0 { |
| 7 | entry: |
| 8 | %cmp = icmp sgt i32 %x, 0 |
| 9 | br i1 %cmp, label %for.cond.preheader, label %return |
| 10 | |
| 11 | for.cond.preheader: ; preds = %entry |
| 12 | %cmp16 = icmp sgt i32 %n, 0 |
| 13 | br i1 %cmp16, label %for.body.preheader, label %return |
| 14 | |
| 15 | for.body.preheader: ; preds = %for.cond.preheader |
| 16 | br label %for.body |
| 17 | |
| 18 | for.body: ; preds = %for.body.preheader, %for.body |
| 19 | %arrayidx.phi = phi i32* [ %arrayidx.inc, %for.body ], [ %B, %for.body.preheader ] |
| 20 | %arrayidx2.phi = phi i32* [ %arrayidx2.inc, %for.body ], [ %A, %for.body.preheader ] |
| 21 | %i.07 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ] |
| 22 | %0 = load i32, i32* %arrayidx.phi, align 4, !tbaa !0 |
| 23 | %1 = load i32, i32* %arrayidx2.phi, align 4, !tbaa !0 |
| 24 | %add = add nsw i32 %1, %0 |
| 25 | store i32 %add, i32* %arrayidx2.phi, align 4, !tbaa !0 |
| 26 | %inc = add nsw i32 %i.07, 1 |
| 27 | %exitcond = icmp eq i32 %inc, %n |
| 28 | %arrayidx.inc = getelementptr i32, i32* %arrayidx.phi, i32 1 |
| 29 | %arrayidx2.inc = getelementptr i32, i32* %arrayidx2.phi, i32 1 |
| 30 | br i1 %exitcond, label %return.loopexit, label %for.body |
| 31 | |
| 32 | return.loopexit: ; preds = %for.body |
| 33 | br label %return |
| 34 | |
| 35 | return: ; preds = %return.loopexit, %for.cond.preheader, %entry |
| 36 | %retval.0 = phi i32 [ 2, %entry ], [ 0, %for.cond.preheader ], [ 0, %return.loopexit ] |
| 37 | ret i32 %retval.0 |
| 38 | } |
| 39 | |
| 40 | !0 = !{!"int", !1} |
| 41 | !1 = !{!"omnipotent char", !2} |
| 42 | !2 = !{!"Simple C/C++ TBAA"} |
| 43 | |
Sumanth Gundapaneni | e1983bc | 2017-10-18 18:07:07 +0000 | [diff] [blame] | 44 | attributes #0 = { nounwind "target-cpu"="hexagonv60" "target-features"="-hvx" } |