brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 2d32606 Raw
31 lines · plain
1; RUN: opt -mtriple=x86_64-apple-darwin -mcpu=core2 -passes=loop-vectorize,dce,instcombine -S < %s | FileCheck %s2 3target 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 5@B = common global [1024 x i32] zeroinitializer, align 166@A = common global [1024 x i32] zeroinitializer, align 167 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 will10; vectorize this loop.11; CHECK: ashr <4 x i32>12define void @f() {13entry:14  br label %for.body15 16for.body: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.iv19  %0 = load i32, ptr %arrayidx, align 420  %shl = ashr i32 %0, 321  %arrayidx2 = getelementptr inbounds [1024 x i32], ptr @A, i64 0, i64 %indvars.iv22  store i32 %shl, ptr %arrayidx2, align 423  %indvars.iv.next = add i64 %indvars.iv, 124  %lftr.wideiv = trunc i64 %indvars.iv.next to i3225  %exitcond = icmp eq i32 %lftr.wideiv, 102426  br i1 %exitcond, label %for.end, label %for.body27 28for.end:29  ret void30}31