1; RUN: opt < %s -loop-vectorize -S | FileCheck %s
2
3; CHECK: fadd
4; CHECK-NEXT: fadd
5; CHECK-NEXT: fadd
6; CHECK-NEXT: fadd
7; CHECK-NEXT: fadd
8; CHECK-NEXT: fadd
9; CHECK-NEXT: fadd
10; CHECK-NEXT: fadd
11; CHECK-NEXT: fadd
12; CHECK-NEXT: fadd
13; CHECK-NEXT: fadd
14; CHECK-NEXT: fadd
15; CHECK-NEXT-NOT: fadd
16
17target datalayout = "e-m:e-i64:64-n32:64"
18target triple = "powerpc64le-ibm-linux-gnu"
19
20define void @QLA_F3_r_veq_norm2_V(float* noalias nocapture %r, [3 x { float, float }]* noalias nocapture readonly %a, i32 signext %n) #0 {
21entry:
22  %cmp24 = icmp sgt i32 %n, 0
23  br i1 %cmp24, label %for.cond1.preheader.preheader, label %for.end13
24
25for.cond1.preheader.preheader:                    ; preds = %entry
26  br label %for.cond1.preheader
27
28for.cond1.preheader:                              ; preds = %for.cond1.preheader.preheader, %for.cond1.preheader
29  %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %for.cond1.preheader.preheader ]
30  %sum.026 = phi double [ %add10.2, %for.cond1.preheader ], [ 0.000000e+00, %for.cond1.preheader.preheader ]
31  %arrayidx5.realp = getelementptr inbounds [3 x { float, float }], [3 x { float, float }]* %a, i64 %indvars.iv, i64 0, i32 0
32  %arrayidx5.real = load float, float* %arrayidx5.realp, align 8
33  %arrayidx5.imagp = getelementptr inbounds [3 x { float, float }], [3 x { float, float }]* %a, i64 %indvars.iv, i64 0, i32 1
34  %arrayidx5.imag = load float, float* %arrayidx5.imagp, align 8
35  %mul = fmul fast float %arrayidx5.real, %arrayidx5.real
36  %mul9 = fmul fast float %arrayidx5.imag, %arrayidx5.imag
37  %add = fadd fast float %mul9, %mul
38  %conv = fpext float %add to double
39  %add10 = fadd fast double %conv, %sum.026
40  %arrayidx5.realp.1 = getelementptr inbounds [3 x { float, float }], [3 x { float, float }]* %a, i64 %indvars.iv, i64 1, i32 0
41  %arrayidx5.real.1 = load float, float* %arrayidx5.realp.1, align 8
42  %arrayidx5.imagp.1 = getelementptr inbounds [3 x { float, float }], [3 x { float, float }]* %a, i64 %indvars.iv, i64 1, i32 1
43  %arrayidx5.imag.1 = load float, float* %arrayidx5.imagp.1, align 8
44  %mul.1 = fmul fast float %arrayidx5.real.1, %arrayidx5.real.1
45  %mul9.1 = fmul fast float %arrayidx5.imag.1, %arrayidx5.imag.1
46  %add.1 = fadd fast float %mul9.1, %mul.1
47  %conv.1 = fpext float %add.1 to double
48  %add10.1 = fadd fast double %conv.1, %add10
49  %arrayidx5.realp.2 = getelementptr inbounds [3 x { float, float }], [3 x { float, float }]* %a, i64 %indvars.iv, i64 2, i32 0
50  %arrayidx5.real.2 = load float, float* %arrayidx5.realp.2, align 8
51  %arrayidx5.imagp.2 = getelementptr inbounds [3 x { float, float }], [3 x { float, float }]* %a, i64 %indvars.iv, i64 2, i32 1
52  %arrayidx5.imag.2 = load float, float* %arrayidx5.imagp.2, align 8
53  %mul.2 = fmul fast float %arrayidx5.real.2, %arrayidx5.real.2
54  %mul9.2 = fmul fast float %arrayidx5.imag.2, %arrayidx5.imag.2
55  %add.2 = fadd fast float %mul9.2, %mul.2
56  %conv.2 = fpext float %add.2 to double
57  %add10.2 = fadd fast double %conv.2, %add10.1
58  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
59  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
60  %exitcond = icmp eq i32 %lftr.wideiv, %n
61  br i1 %exitcond, label %for.cond.for.end13_crit_edge, label %for.cond1.preheader
62
63for.cond.for.end13_crit_edge:                     ; preds = %for.cond1.preheader
64  %add10.2.lcssa = phi double [ %add10.2, %for.cond1.preheader ]
65  %phitmp = fptrunc double %add10.2.lcssa to float
66  br label %for.end13
67
68for.end13:                                        ; preds = %for.cond.for.end13_crit_edge, %entry
69  %sum.0.lcssa = phi float [ %phitmp, %for.cond.for.end13_crit_edge ], [ 0.000000e+00, %entry ]
70  store float %sum.0.lcssa, float* %r, align 4
71  ret void
72}
73
74