1*cee313d2SEric Christopher; RUN: opt < %s  -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -S | FileCheck %s
2*cee313d2SEric Christopher
3*cee313d2SEric Christophertarget 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"
4*cee313d2SEric Christopher
5*cee313d2SEric Christopher;CHECK-LABEL: @cpp_new_arrays(
6*cee313d2SEric Christopher;CHECK: sext i32
7*cee313d2SEric Christopher;CHECK: load <4 x float>
8*cee313d2SEric Christopher;CHECK: fadd <4 x float>
9*cee313d2SEric Christopher;CHECK: ret i32
10*cee313d2SEric Christopherdefine i32 @cpp_new_arrays() uwtable ssp {
11*cee313d2SEric Christopherentry:
12*cee313d2SEric Christopher  %call = call noalias i8* @_Znwm(i64 4)
13*cee313d2SEric Christopher  %0 = bitcast i8* %call to float*
14*cee313d2SEric Christopher  store float 1.000000e+03, float* %0, align 4
15*cee313d2SEric Christopher  %call1 = call noalias i8* @_Znwm(i64 4)
16*cee313d2SEric Christopher  %1 = bitcast i8* %call1 to float*
17*cee313d2SEric Christopher  store float 1.000000e+03, float* %1, align 4
18*cee313d2SEric Christopher  %call3 = call noalias i8* @_Znwm(i64 4)
19*cee313d2SEric Christopher  %2 = bitcast i8* %call3 to float*
20*cee313d2SEric Christopher  store float 1.000000e+03, float* %2, align 4
21*cee313d2SEric Christopher  br label %for.body
22*cee313d2SEric Christopher
23*cee313d2SEric Christopherfor.body:                                         ; preds = %entry, %for.body
24*cee313d2SEric Christopher  %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
25*cee313d2SEric Christopher  %idxprom = sext i32 %i.01 to i64
26*cee313d2SEric Christopher  %arrayidx = getelementptr inbounds float, float* %0, i64 %idxprom
27*cee313d2SEric Christopher  %3 = load float, float* %arrayidx, align 4
28*cee313d2SEric Christopher  %idxprom5 = sext i32 %i.01 to i64
29*cee313d2SEric Christopher  %arrayidx6 = getelementptr inbounds float, float* %1, i64 %idxprom5
30*cee313d2SEric Christopher  %4 = load float, float* %arrayidx6, align 4
31*cee313d2SEric Christopher  %add = fadd float %3, %4
32*cee313d2SEric Christopher  %idxprom7 = sext i32 %i.01 to i64
33*cee313d2SEric Christopher  %arrayidx8 = getelementptr inbounds float, float* %2, i64 %idxprom7
34*cee313d2SEric Christopher  store float %add, float* %arrayidx8, align 4
35*cee313d2SEric Christopher  %inc = add nsw i32 %i.01, 1
36*cee313d2SEric Christopher  %cmp = icmp slt i32 %inc, 1000
37*cee313d2SEric Christopher  br i1 %cmp, label %for.body, label %for.end
38*cee313d2SEric Christopher
39*cee313d2SEric Christopherfor.end:                                          ; preds = %for.body
40*cee313d2SEric Christopher  %5 = load float, float* %2, align 4
41*cee313d2SEric Christopher  %conv10 = fptosi float %5 to i32
42*cee313d2SEric Christopher  ret i32 %conv10
43*cee313d2SEric Christopher}
44*cee313d2SEric Christopher
45*cee313d2SEric Christopherdeclare noalias i8* @_Znwm(i64)
46