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