78 lines · plain
1; RUN: opt < %s -passes=loop-vectorize,dce,instcombine -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 -S | FileCheck %s2; RUN: opt < %s -passes=loop-vectorize,dce,instcombine -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 -force-vector-interleave=0 -S | FileCheck %s -check-prefix=UNROLL3 4target 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"5target triple = "x86_64-apple-macosx10.8.0"6 7@b = common global [2048 x i32] zeroinitializer, align 168@c = common global [2048 x i32] zeroinitializer, align 169@a = common global [2048 x i32] zeroinitializer, align 1610 11; Select VF = 8;12;CHECK-LABEL: @example1(13;CHECK: load <4 x i32>14;CHECK: add nsw <4 x i32>15;CHECK: store <4 x i32>16;CHECK: ret void17 18;UNROLL-LABEL: @example1(19;UNROLL: load <4 x i32>20;UNROLL: load <4 x i32>21;UNROLL: add nsw <4 x i32>22;UNROLL: add nsw <4 x i32>23;UNROLL: store <4 x i32>24;UNROLL: store <4 x i32>25;UNROLL: ret void26define void @example1() nounwind uwtable ssp {27 br label %128 29; <label>:1 ; preds = %1, %030 %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %1 ]31 %2 = getelementptr inbounds [2048 x i32], ptr @b, i64 0, i64 %indvars.iv32 %3 = load i32, ptr %2, align 433 %4 = getelementptr inbounds [2048 x i32], ptr @c, i64 0, i64 %indvars.iv34 %5 = load i32, ptr %4, align 435 %6 = add nsw i32 %5, %336 %7 = getelementptr inbounds [2048 x i32], ptr @a, i64 0, i64 %indvars.iv37 store i32 %6, ptr %7, align 438 %indvars.iv.next = add i64 %indvars.iv, 139 %lftr.wideiv = trunc i64 %indvars.iv.next to i3240 %exitcond = icmp eq i32 %lftr.wideiv, 25641 br i1 %exitcond, label %8, label %142 43; <label>:8 ; preds = %144 ret void45}46 47; Select VF=4 because sext <8 x i1> to <8 x i32> is expensive.48;CHECK-LABEL: @example10b(49;CHECK: load <4 x i16>50;CHECK: sext <4 x i16>51;CHECK: store <4 x i32>52;CHECK: ret void53;UNROLL-LABEL: @example10b(54;UNROLL: load <4 x i16>55;UNROLL: load <4 x i16>56;UNROLL: store <4 x i32>57;UNROLL: store <4 x i32>58;UNROLL: ret void59define void @example10b(ptr noalias nocapture %sa, ptr noalias nocapture %sb, ptr noalias nocapture %sc, ptr noalias nocapture %ia, ptr noalias nocapture %ib, ptr noalias nocapture %ic) nounwind uwtable ssp {60 br label %161 62; <label>:1 ; preds = %1, %063 %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %1 ]64 %2 = getelementptr inbounds i16, ptr %sb, i64 %indvars.iv65 %3 = load i16, ptr %2, align 266 %4 = sext i16 %3 to i3267 %5 = getelementptr inbounds i32, ptr %ia, i64 %indvars.iv68 store i32 %4, ptr %5, align 469 %indvars.iv.next = add i64 %indvars.iv, 170 %lftr.wideiv = trunc i64 %indvars.iv.next to i3271 %exitcond = icmp eq i32 %lftr.wideiv, 102472 br i1 %exitcond, label %6, label %173 74; <label>:6 ; preds = %175 ret void76}77 78