brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.6 KiB · 7ae50a5 Raw
124 lines · plain
1; REQUIRES: asserts2; RUN: opt -S < %s -p loop-vectorize -disable-output \3; RUN:   -debug-only=loop-vectorize 2>&1 | FileCheck %s --check-prefixes=CHECK4 5target triple = "aarch64-unknown-linux-gnu"6 7declare void @init_mem(ptr, i64);8 9define i64 @same_exit_block_pre_inc_use1_sve() #1 {10; CHECK-LABEL: LV: Checking a loop in 'same_exit_block_pre_inc_use1_sve'11; CHECK: LV: Selecting VF: vscale x 1612; CHECK: Calculating cost of work in exit block vector.early.exit13; CHECK-NEXT: Cost of 4 for VF vscale x 16: EMIT vp<{{.*}}> = first-active-lane ir<%cmp3>14; CHECK-NEXT: Cost of 0 for VF vscale x 16: EMIT vp<{{.*}}> = add15; CHECK-NEXT: Cost of 0 for VF vscale x 16: vp<{{.*}}> = DERIVED-IV16; CHECK-NEXT: Cost of 4 for VF vscale x 16: EMIT vp<{{.*}}> = first-active-lane ir<%cmp3>17; CHECK-NEXT: Cost of 0 for VF vscale x 16: EMIT vp<{{.*}}> = add18; CHECK-NEXT: Cost of 0 for VF vscale x 16: vp<{{.*}}> = DERIVED-IV19; CHECK: LV: Minimum required TC for runtime checks to be profitable:1620entry:21  %p1 = alloca [1024 x i8]22  %p2 = alloca [1024 x i8]23  call void @init_mem(ptr %p1, i64 1024)24  call void @init_mem(ptr %p2, i64 1024)25  br label %loop26 27loop:28  %index = phi i64 [ %index.next, %loop.inc ], [ 3, %entry ]29  %index2 = phi i64 [ %index2.next, %loop.inc ], [ 15, %entry ]30  %arrayidx = getelementptr inbounds i8, ptr %p1, i64 %index31  %ld1 = load i8, ptr %arrayidx, align 132  %arrayidx1 = getelementptr inbounds i8, ptr %p2, i64 %index33  %ld2 = load i8, ptr %arrayidx1, align 134  %cmp3 = icmp eq i8 %ld1, %ld235  br i1 %cmp3, label %loop.inc, label %loop.end36 37loop.inc:38  %index.next = add i64 %index, 139  %index2.next = add i64 %index2, 240  %exitcond = icmp ne i64 %index.next, 6741  br i1 %exitcond, label %loop, label %loop.end42 43loop.end:44  %val1 = phi i64 [ %index, %loop ], [ 67, %loop.inc ]45  %val2 = phi i64 [ %index2, %loop ], [ 98, %loop.inc ]46  %retval = add i64 %val1, %val247  ret i64 %retval48}49 50define i64 @same_exit_block_pre_inc_use1_nosve() {51; CHECK-LABEL: LV: Checking a loop in 'same_exit_block_pre_inc_use1_nosve'52; CHECK: LV: Selecting VF: 1653; CHECK: Calculating cost of work in exit block vector.early.exit54; CHECK-NEXT: Cost of 48 for VF 16: EMIT vp<{{.*}}> = first-active-lane ir<%cmp3>55; CHECK-NEXT: Cost of 0 for VF 16: EMIT vp<{{.*}}> = add56; CHECK-NEXT: Cost of 0 for VF 16: vp<{{.*}}> = DERIVED-IV57; CHECK-NEXT: Cost of 48 for VF 16: EMIT vp<{{.*}}> = first-active-lane ir<%cmp3>58; CHECK-NEXT: Cost of 0 for VF 16: EMIT vp<{{.*}}> = add59; CHECK-NEXT: Cost of 0 for VF 16: vp<{{.*}}> = DERIVED-IV60; CHECK: LV: Minimum required TC for runtime checks to be profitable:16061; CHECK-NEXT: LV: Vectorization is not beneficial: expected trip count < minimum profitable VF (64 < 160)62; CHECK-NEXT: LV: Too many memory checks needed.63entry:64  %p1 = alloca [1024 x i8]65  %p2 = alloca [1024 x i8]66  call void @init_mem(ptr %p1, i64 1024)67  call void @init_mem(ptr %p2, i64 1024)68  br label %loop69 70loop:71  %index = phi i64 [ %index.next, %loop.inc ], [ 3, %entry ]72  %index2 = phi i64 [ %index2.next, %loop.inc ], [ 15, %entry ]73  %arrayidx = getelementptr inbounds i8, ptr %p1, i64 %index74  %ld1 = load i8, ptr %arrayidx, align 175  %arrayidx1 = getelementptr inbounds i8, ptr %p2, i64 %index76  %ld2 = load i8, ptr %arrayidx1, align 177  %cmp3 = icmp eq i8 %ld1, %ld278  br i1 %cmp3, label %loop.inc, label %loop.end79 80loop.inc:81  %index.next = add i64 %index, 182  %index2.next = add i64 %index2, 283  %exitcond = icmp ne i64 %index.next, 6784  br i1 %exitcond, label %loop, label %loop.end85 86loop.end:87  %val1 = phi i64 [ %index, %loop ], [ 67, %loop.inc ]88  %val2 = phi i64 [ %index2, %loop ], [ 98, %loop.inc ]89  %retval = add i64 %val1, %val290  ret i64 %retval91}92 93define i64 @vectorization_not_profitable_due_to_trunc(ptr dereferenceable(800) %src) {94; CHECK-LABEL: LV: Checking a loop in 'vectorization_not_profitable_due_to_trunc'95; CHECK: LV: Selecting VF: 1.96; CHECK-NEXT: Calculating cost of work in exit block vector.early.exit:97; CHECK-NEXT: Cost of 1 for VF 1: EMIT vp<%first.active.lane> = first-active-lane ir<%t>98; CHECK-NEXT: Cost of 0 for VF 1: EMIT vp<%early.exit.value> = extract-lane vp<%first.active.lane>, ir<%l>99; CHECK-NEXT: LV: Vectorization is possible but not beneficial.100entry:101  br label %loop.header102 103loop.header:104  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop.latch ]105  %gep.src = getelementptr inbounds i64, ptr %src, i64 %iv106  %l = load i64, ptr %gep.src, align 1107  %t = trunc i64 %l to i1108  br i1 %t, label %exit.0, label %loop.latch109 110loop.latch:111  %iv.next = add i64 %iv, 1112  %ec = icmp eq i64 %iv.next, 100113  br i1 %ec, label %exit.1, label %loop.header114 115exit.0:116  %res = phi i64 [ %l, %loop.header ]117  ret i64 %res118 119exit.1:120  ret i64 0121}122 123attributes #1 = { "target-features"="+sve" vscale_range(1,16) }124