summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/optimize-max-3.ll
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-04-24 03:13:44 +0000
committerDan Gohman <gohman@apple.com>2010-04-24 03:13:44 +0000
commit1d367988e21bb1b4e8346877f8fa377dff194c29 (patch)
treecb0953ec9ece04f795994b7df064445324229413 /test/CodeGen/X86/optimize-max-3.ll
parent9f93d30a26ae9928f886ef7271efeafcea2a00a6 (diff)
downloadllvm-1d367988e21bb1b4e8346877f8fa377dff194c29.tar.gz
llvm-1d367988e21bb1b4e8346877f8fa377dff194c29.tar.bz2
llvm-1d367988e21bb1b4e8346877f8fa377dff194c29.tar.xz
Generalize LSR's OptimizeMax to handle the new kinds of max expressions
that indvars may use, now that indvars is recognizing le and ge loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/optimize-max-3.ll')
-rw-r--r--test/CodeGen/X86/optimize-max-3.ll32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/CodeGen/X86/optimize-max-3.ll b/test/CodeGen/X86/optimize-max-3.ll
new file mode 100644
index 0000000000..bf8bfa28da
--- /dev/null
+++ b/test/CodeGen/X86/optimize-max-3.ll
@@ -0,0 +1,32 @@
+; RUN: llc < %s -march=x86-64 | FileCheck %s
+
+; LSR's OptimizeMax should eliminate the select (max).
+
+; CHECK: foo:
+; CHECK-NOT: cmov
+; CHECK: jle
+
+define void @foo(i64 %n, double* nocapture %p) nounwind {
+entry:
+ %cmp6 = icmp slt i64 %n, 0 ; <i1> [#uses=1]
+ br i1 %cmp6, label %for.end, label %for.body.preheader
+
+for.body.preheader: ; preds = %entry
+ %tmp = icmp sgt i64 %n, 0 ; <i1> [#uses=1]
+ %n.op = add i64 %n, 1 ; <i64> [#uses=1]
+ %tmp1 = select i1 %tmp, i64 %n.op, i64 1 ; <i64> [#uses=1]
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i = phi i64 [ %i.next, %for.body ], [ 0, %for.body.preheader ] ; <i64> [#uses=2]
+ %arrayidx = getelementptr double* %p, i64 %i ; <double*> [#uses=2]
+ %t4 = load double* %arrayidx ; <double> [#uses=1]
+ %mul = fmul double %t4, 2.200000e+00 ; <double> [#uses=1]
+ store double %mul, double* %arrayidx
+ %i.next = add nsw i64 %i, 1 ; <i64> [#uses=2]
+ %exitcond = icmp eq i64 %i.next, %tmp1 ; <i1> [#uses=1]
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}