diff options
author | Brendon Cahoon <bcahoon@codeaurora.org> | 2015-05-08 16:16:29 +0000 |
---|---|---|
committer | Brendon Cahoon <bcahoon@codeaurora.org> | 2015-05-08 16:16:29 +0000 |
commit | df43e6862918eba86dd8b608bc2ae202225092dc (patch) | |
tree | 28f78cf7f97c2468597adb6bcefe09df4a42956a /llvm/test/CodeGen/Hexagon/remove-endloop.ll | |
parent | f7b548047479b0d1fc28921d32d3108580ecf1a3 (diff) | |
download | bcm5719-llvm-df43e6862918eba86dd8b608bc2ae202225092dc.tar.gz bcm5719-llvm-df43e6862918eba86dd8b608bc2ae202225092dc.zip |
[Hexagon] Update AnalyzeBranch, etc target hooks
Improved the AnalyzeBranch, InsertBranch, and RemoveBranch
functions in order to handle more of our branch instructions.
This requires changes to analyzeCompare and PredicateInstructions.
Specifically, we've added support for new value compare jumps,
improved handling of endloop, added more compare instructions,
and improved support for predicate instructions.
Differential Revision: http://reviews.llvm.org/D9559
llvm-svn: 236876
Diffstat (limited to 'llvm/test/CodeGen/Hexagon/remove-endloop.ll')
-rw-r--r-- | llvm/test/CodeGen/Hexagon/remove-endloop.ll | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Hexagon/remove-endloop.ll b/llvm/test/CodeGen/Hexagon/remove-endloop.ll new file mode 100644 index 00000000000..73e1ad02cd8 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/remove-endloop.ll @@ -0,0 +1,56 @@ +; RUN: llc -march=hexagon -O2 < %s | FileCheck %s + +define void @foo(i32 %n, i32* nocapture %A, i32* nocapture %B) nounwind optsize { +entry: + %cmp = icmp sgt i32 %n, 100 + br i1 %cmp, label %for.body.preheader, label %for.cond4.preheader + +; CHECK: endloop0 +; CHECK: endloop0 +; CHECK-NOT: endloop0 + +for.body.preheader: + br label %for.body + +for.cond4.preheader: + %cmp113 = icmp sgt i32 %n, 0 + br i1 %cmp113, label %for.body7.preheader, label %if.end + +for.body7.preheader: + br label %for.body7 + +for.body: + %arrayidx.phi = phi i32* [ %arrayidx.inc, %for.body ], [ %B, %for.body.preheader ] + %arrayidx3.phi = phi i32* [ %arrayidx3.inc, %for.body ], [ %A, %for.body.preheader ] + %i.014 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ] + %0 = load i32, i32* %arrayidx.phi, align 4 + %sub = add nsw i32 %0, -1 + store i32 %sub, i32* %arrayidx3.phi, align 4 + %inc = add nsw i32 %i.014, 1 + %exitcond = icmp eq i32 %inc, %n + %arrayidx.inc = getelementptr i32, i32* %arrayidx.phi, i32 1 + %arrayidx3.inc = getelementptr i32, i32* %arrayidx3.phi, i32 1 + br i1 %exitcond, label %if.end.loopexit, label %for.body + +for.body7: + %arrayidx8.phi = phi i32* [ %arrayidx8.inc, %for.body7 ], [ %B, %for.body7.preheader ] + %arrayidx9.phi = phi i32* [ %arrayidx9.inc, %for.body7 ], [ %A, %for.body7.preheader ] + %i.117 = phi i32 [ %inc11, %for.body7 ], [ 0, %for.body7.preheader ] + %1 = load i32, i32* %arrayidx8.phi, align 4 + %add = add nsw i32 %1, 1 + store i32 %add, i32* %arrayidx9.phi, align 4 + %inc11 = add nsw i32 %i.117, 1 + %exitcond18 = icmp eq i32 %inc11, %n + %arrayidx8.inc = getelementptr i32, i32* %arrayidx8.phi, i32 1 + %arrayidx9.inc = getelementptr i32, i32* %arrayidx9.phi, i32 1 + br i1 %exitcond18, label %if.end.loopexit21, label %for.body7 + +if.end.loopexit: + br label %if.end + +if.end.loopexit21: + br label %if.end + +if.end: + ret void +} |