1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 fast-math-vect-reduc-8.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer fast-math-vect-reduc-8.s > fast-math-vect-reduc-8.ll
6 ; ModuleID = 'fast-math-vect-reduc-8.s'
7 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"
8 target triple = "x86_64-unknown-linux-gnu"
10 @x = external global [128 x float]
11 @y = external global [128 x float]
12 @z = external global [128 x float]
14 define float @f(i32 %n) nounwind uwtable {
16 %tmp = zext i32 %n to i64
19 for.cond: ; preds = %for.inc, %entry
20 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
21 %ret.0 = phi float [ 0.000000e+00, %entry ], [ %sub17, %for.inc ]
22 %arrayidx13 = getelementptr [128 x float]* @z, i64 0, i64 %indvar
23 %arrayidx7 = getelementptr [128 x float]* @y, i64 0, i64 %indvar
24 %arrayidx = getelementptr [128 x float]* @x, i64 0, i64 %indvar
25 %exitcond = icmp ne i64 %indvar, %tmp
26 br i1 %exitcond, label %for.body, label %for.end
28 for.body: ; preds = %for.cond
29 %tmp4 = load float* %arrayidx, align 4
30 %tmp8 = load float* %arrayidx7, align 4
31 %sub = fsub float %tmp4, %tmp8
34 for.inc: ; preds = %for.body
35 %tmp14 = load float* %arrayidx13, align 4
36 %mul = fmul float %sub, %sub
37 %mul15 = fmul float %mul, %tmp14
38 %sub17 = fsub float %ret.0, %mul15
39 %indvar.next = add i64 %indvar, 1
42 for.end: ; preds = %for.cond
43 %ret.0.lcssa = phi float [ %ret.0, %for.cond ]
44 ret float %ret.0.lcssa