1 ; RUN: opt -mtriple=x86_64-apple-darwin -mcpu=core2 -passes=loop-vectorize,dce,instcombine -S < %s | FileCheck %s
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"
5 @B = common global [1024 x i32] zeroinitializer, align 16
6 @A = common global [1024 x i32] zeroinitializer, align 16
8 ; We use to not vectorize this loop because the shift was deemed to expensive.
9 ; Now that we differentiate shift cost base on the operand value kind, we will
10 ; vectorize this loop.
11 ; CHECK: ashr <4 x i32>
17 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
18 %arrayidx = getelementptr inbounds [1024 x i32], ptr @B, i64 0, i64 %indvars.iv
19 %0 = load i32, ptr %arrayidx, align 4
21 %arrayidx2 = getelementptr inbounds [1024 x i32], ptr @A, i64 0, i64 %indvars.iv
22 store i32 %shl, ptr %arrayidx2, align 4
23 %indvars.iv.next = add i64 %indvars.iv, 1
24 %lftr.wideiv = trunc i64 %indvars.iv.next to i32
25 %exitcond = icmp eq i32 %lftr.wideiv, 1024
26 br i1 %exitcond, label %for.end, label %for.body