diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:41:23 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:41:23 +0000 |
commit | 169d2bd06003c39970bc94c99669a34b61bb7e45 (patch) | |
tree | 06099edc18d30894081a822b756f117cbe0b8207 /test/Transforms/LoopVectorize/if-conversion-reduction.ll | |
parent | 0ac5f94c68a3d8fbd1380dbba26d891ea7816b5e (diff) | |
download | FreeBSD-src-169d2bd06003c39970bc94c99669a34b61bb7e45.zip FreeBSD-src-169d2bd06003c39970bc94c99669a34b61bb7e45.tar.gz |
Vendor import of llvm trunk r178860:
http://llvm.org/svn/llvm-project/llvm/trunk@178860
Diffstat (limited to 'test/Transforms/LoopVectorize/if-conversion-reduction.ll')
-rw-r--r-- | test/Transforms/LoopVectorize/if-conversion-reduction.ll | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/Transforms/LoopVectorize/if-conversion-reduction.ll b/test/Transforms/LoopVectorize/if-conversion-reduction.ll new file mode 100644 index 0000000..3a2d82e --- /dev/null +++ b/test/Transforms/LoopVectorize/if-conversion-reduction.ll @@ -0,0 +1,38 @@ +; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -enable-if-conversion -dce -instcombine -S | FileCheck %s + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.9.0" + +;CHECK: @reduction_func +;CHECK-NOT: load <4 x i32> +;CHECK: ret i32 +define i32 @reduction_func(i32* nocapture %A, i32 %n) nounwind uwtable readonly ssp { +entry: + %cmp10 = icmp sgt i32 %n, 0 + br i1 %cmp10, label %for.body, label %for.end + +for.body: ; preds = %entry, %for.inc + %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ] + %sum.011 = phi i32 [ %sum.1, %for.inc ], [ 0, %entry ] + %arrayidx = getelementptr inbounds i32* %A, i64 %indvars.iv + %0 = load i32* %arrayidx, align 4 + %cmp1 = icmp sgt i32 %0, 30 + br i1 %cmp1, label %if.then, label %for.inc + +if.then: ; preds = %for.body + %add = add i32 %sum.011, 2 + %add4 = add i32 %add, %0 + br label %for.inc + +for.inc: ; preds = %for.body, %if.then + %sum.1 = phi i32 [ %add4, %if.then ], [ %sum.011, %for.body ] + %indvars.iv.next = add i64 %indvars.iv, 1 + %lftr.wideiv = trunc i64 %indvars.iv.next to i32 + %exitcond = icmp eq i32 %lftr.wideiv, %n + br i1 %exitcond, label %for.end, label %for.body + +for.end: ; preds = %for.inc, %entry + %sum.0.lcssa = phi i32 [ 0, %entry ], [ 4, %for.inc ] + ret i32 %sum.0.lcssa +} + |