51 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; PR344383; Loop has a short trip count of 8 iterations. It should be vectorized because no runtime checks or tail loop are necessary.4; Two cases tested AVX (MaxVF=8 = TripCount) and AVX512 (MaxVF=16 > TripCount)5 6; RUN: opt < %s -passes=loop-vectorize -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -S | FileCheck %s7; RUN: opt < %s -passes=loop-vectorize -mtriple=x86_64-apple-macosx10.8.0 -mcpu=skylake-avx512 -S | FileCheck %s8 9target 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"10target triple = "x86_64-apple-macosx10.8.0"11 12define void @small_tc(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {13; CHECK-LABEL: @small_tc(14; CHECK-NEXT: entry:15; CHECK-NEXT: br label [[VECTOR_PH:%.*]]16; CHECK: vector.ph:17; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]18; CHECK: vector.body:19; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <8 x float>, ptr [[B:%.*]], align 4, !llvm.access.group [[ACC_GRP0:![0-9]+]]20; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <8 x float>, ptr [[A:%.*]], align 4, !llvm.access.group [[ACC_GRP0]]21; CHECK-NEXT: [[TMP4:%.*]] = fadd fast <8 x float> [[WIDE_LOAD]], [[WIDE_LOAD1]]22; CHECK-NEXT: store <8 x float> [[TMP4]], ptr [[A]], align 4, !llvm.access.group [[ACC_GRP0]]23; CHECK-NEXT: br label [[MIDDLE_BLOCK:%.*]]24; CHECK: middle.block:25; CHECK-NEXT: br label [[FOR_BODY:%.*]]26; CHECK: for.end:27; CHECK-NEXT: ret void28;29entry:30 br label %for.body31 32for.body:33 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]34 %arrayidx = getelementptr inbounds float, ptr %B, i64 %indvars.iv35 %0 = load float, ptr %arrayidx, align 4, !llvm.access.group !536 %arrayidx2 = getelementptr inbounds float, ptr %A, i64 %indvars.iv37 %1 = load float, ptr %arrayidx2, align 4, !llvm.access.group !538 %add = fadd fast float %0, %139 store float %add, ptr %arrayidx2, align 4, !llvm.access.group !540 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 141 %exitcond = icmp eq i64 %indvars.iv.next, 842 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !443 44for.end:45 ret void46}47 48!3 = !{!3, !{!"llvm.loop.parallel_accesses", !5}}49!4 = !{!4}50!5 = distinct !{}51