brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.2 KiB · 6b7b202 Raw
105 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=slp-vectorizer,dce -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s3 4target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"5target triple = "i386-apple-macosx10.9.0"6 7; We disable the vectorization of <3 x float> for now8 9; float foo(ptr A) {10;11;   float R = A[0];12;   float G = A[1];13;   float B = A[2];14;   for (int i=0; i < 121; i+=3) {15;     R+=Aptr7;16;     G+=Aptr8;17;     B+=Aptr9;18;   }19;20;   return R+G+B;21; }22 23define float @foo(ptr nocapture readonly %A) {24; CHECK-LABEL: @foo(25; CHECK-NEXT:  entry:26; CHECK-NEXT:    [[TMP1:%.*]] = load <2 x float>, ptr [[A:%.*]], align 427; CHECK-NEXT:    [[ARRAYIDX2:%.*]] = getelementptr inbounds float, ptr [[A]], i64 228; CHECK-NEXT:    [[TMP2:%.*]] = load float, ptr [[ARRAYIDX2]], align 429; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <2 x float> [[TMP1]], i32 030; CHECK-NEXT:    br label [[FOR_BODY:%.*]]31; CHECK:       for.body:32; CHECK-NEXT:    [[TMP4:%.*]] = phi float [ [[TMP3]], [[ENTRY:%.*]] ], [ [[DOTPRE:%.*]], [[FOR_BODY_FOR_BODY_CRIT_EDGE:%.*]] ]33; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY_FOR_BODY_CRIT_EDGE]] ]34; CHECK-NEXT:    [[B_032:%.*]] = phi float [ [[TMP2]], [[ENTRY]] ], [ [[ADD14:%.*]], [[FOR_BODY_FOR_BODY_CRIT_EDGE]] ]35; CHECK-NEXT:    [[TMP5:%.*]] = phi <2 x float> [ [[TMP1]], [[ENTRY]] ], [ [[TMP11:%.*]], [[FOR_BODY_FOR_BODY_CRIT_EDGE]] ]36; CHECK-NEXT:    [[TMP6:%.*]] = add nsw i64 [[INDVARS_IV]], 137; CHECK-NEXT:    [[ARRAYIDX7:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[TMP6]]38; CHECK-NEXT:    [[TMP7:%.*]] = load float, ptr [[ARRAYIDX7]], align 439; CHECK-NEXT:    [[TMP8:%.*]] = insertelement <2 x float> poison, float [[TMP4]], i32 040; CHECK-NEXT:    [[TMP9:%.*]] = insertelement <2 x float> [[TMP8]], float [[TMP7]], i32 141; CHECK-NEXT:    [[TMP10:%.*]] = fmul <2 x float> [[TMP9]], <float 7.000000e+00, float 8.000000e+00>42; CHECK-NEXT:    [[TMP11]] = fadd <2 x float> [[TMP5]], [[TMP10]]43; CHECK-NEXT:    [[TMP12:%.*]] = add nsw i64 [[INDVARS_IV]], 244; CHECK-NEXT:    [[ARRAYIDX12:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[TMP12]]45; CHECK-NEXT:    [[TMP13:%.*]] = load float, ptr [[ARRAYIDX12]], align 446; CHECK-NEXT:    [[MUL13:%.*]] = fmul float [[TMP13]], 9.000000e+0047; CHECK-NEXT:    [[ADD14]] = fadd float [[B_032]], [[MUL13]]48; CHECK-NEXT:    [[INDVARS_IV_NEXT]] = add i64 [[INDVARS_IV]], 349; CHECK-NEXT:    [[TMP14:%.*]] = trunc i64 [[INDVARS_IV_NEXT]] to i3250; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 [[TMP14]], 12151; CHECK-NEXT:    br i1 [[CMP]], label [[FOR_BODY_FOR_BODY_CRIT_EDGE]], label [[FOR_END:%.*]]52; CHECK:       for.body.for.body_crit_edge:53; CHECK-NEXT:    [[ARRAYIDX3_PHI_TRANS_INSERT:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[INDVARS_IV_NEXT]]54; CHECK-NEXT:    [[DOTPRE]] = load float, ptr [[ARRAYIDX3_PHI_TRANS_INSERT]], align 455; CHECK-NEXT:    br label [[FOR_BODY]]56; CHECK:       for.end:57; CHECK-NEXT:    [[TMP15:%.*]] = extractelement <2 x float> [[TMP11]], i32 058; CHECK-NEXT:    [[TMP16:%.*]] = extractelement <2 x float> [[TMP11]], i32 159; CHECK-NEXT:    [[ADD16:%.*]] = fadd float [[TMP15]], [[TMP16]]60; CHECK-NEXT:    [[ADD17:%.*]] = fadd float [[ADD16]], [[ADD14]]61; CHECK-NEXT:    ret float [[ADD17]]62;63entry:64  %0 = load float, ptr %A, align 465  %arrayidx1 = getelementptr inbounds float, ptr %A, i64 166  %1 = load float, ptr %arrayidx1, align 467  %arrayidx2 = getelementptr inbounds float, ptr %A, i64 268  %2 = load float, ptr %arrayidx2, align 469  br label %for.body70 71for.body:                                         ; preds = %for.body.for.body_crit_edge, %entry72  %3 = phi float [ %0, %entry ], [ %.pre, %for.body.for.body_crit_edge ]73  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body.for.body_crit_edge ]74  %B.032 = phi float [ %2, %entry ], [ %add14, %for.body.for.body_crit_edge ]75  %G.031 = phi float [ %1, %entry ], [ %add9, %for.body.for.body_crit_edge ]76  %R.030 = phi float [ %0, %entry ], [ %add4, %for.body.for.body_crit_edge ]77  %mul = fmul float %3, 7.000000e+0078  %add4 = fadd float %R.030, %mul79  %4 = add nsw i64 %indvars.iv, 180  %arrayidx7 = getelementptr inbounds float, ptr %A, i64 %481  %5 = load float, ptr %arrayidx7, align 482  %mul8 = fmul float %5, 8.000000e+0083  %add9 = fadd float %G.031, %mul884  %6 = add nsw i64 %indvars.iv, 285  %arrayidx12 = getelementptr inbounds float, ptr %A, i64 %686  %7 = load float, ptr %arrayidx12, align 487  %mul13 = fmul float %7, 9.000000e+0088  %add14 = fadd float %B.032, %mul1389  %indvars.iv.next = add i64 %indvars.iv, 390  %8 = trunc i64 %indvars.iv.next to i3291  %cmp = icmp slt i32 %8, 12192  br i1 %cmp, label %for.body.for.body_crit_edge, label %for.end93 94for.body.for.body_crit_edge:                      ; preds = %for.body95  %arrayidx3.phi.trans.insert = getelementptr inbounds float, ptr %A, i64 %indvars.iv.next96  %.pre = load float, ptr %arrayidx3.phi.trans.insert, align 497  br label %for.body98 99for.end:                                          ; preds = %for.body100  %add16 = fadd float %add4, %add9101  %add17 = fadd float %add16, %add14102  ret float %add17103}104 105