brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.6 KiB · 1d21511 Raw
167 lines · plain
1; REQUIRES: asserts2; RUN: opt -mtriple=aarch64-none-linux-gnu -mattr=+sve -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output -scalable-vectorization=off < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK_SCALABLE_DISABLED3; RUN: opt -mtriple=aarch64-none-linux-gnu -mattr=+sve -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output -scalable-vectorization=on < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK_SCALABLE_ON4; RUN: opt -mtriple=aarch64-none-linux-gnu -mattr=+sve -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output -vectorizer-maximize-bandwidth=false -scalable-vectorization=on < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK_SCALABLE_ON_NOMAXBW5 6; Test that the MaxVF for the following loop, that has no dependence distances,7; is calculated as vscale x 4 (max legal SVE vector size) or vscale x 168; (maximized bandwidth for i8 in the loop).9define void @test0(ptr %a, ptr %b, ptr %c) #0 {10; CHECK: LV: Checking a loop in 'test0'11; CHECK_SCALABLE_ON: LV: Found feasible scalable VF = vscale x 1612; CHECK_SCALABLE_ON: LV: Selecting VF: vscale x 1613; CHECK_SCALABLE_DISABLED-NOT: LV: Found feasible scalable VF14; CHECK_SCALABLE_DISABLED: LV: Selecting VF: 1615; CHECK_SCALABLE_ON_NOMAXBW: LV: Found feasible scalable VF = vscale x 416; CHECK_SCALABLE_ON_NOMAXBW: LV: Selecting VF: vscale x 417entry:18  br label %loop19 20loop:21  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]22  %arrayidx = getelementptr inbounds i32, ptr %c, i64 %iv23  %0 = load i32, ptr %arrayidx, align 424  %arrayidx2 = getelementptr inbounds i8, ptr %b, i64 %iv25  %1 = load i8, ptr %arrayidx2, align 426  %zext = zext i8 %1 to i3227  %add = add nsw i32 %zext, %028  %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %iv29  store i32 %add, ptr %arrayidx5, align 430  %iv.next = add nuw nsw i64 %iv, 131  %exitcond.not = icmp eq i64 %iv.next, 102432  br i1 %exitcond.not, label %exit, label %loop33 34exit:35  ret void36}37 38; Test that the MaxVF for the following loop, with a dependence distance39; of 64 elements, is calculated as (maxvscale = 16) * 4.40define void @test1(ptr %a, ptr %b) #0 {41; CHECK: LV: Checking a loop in 'test1'42; CHECK_SCALABLE_ON: LV: Found feasible scalable VF = vscale x 443; CHECK_SCALABLE_ON: LV: Selecting VF: 1644; CHECK_SCALABLE_DISABLED-NOT: LV: Found feasible scalable VF45; CHECK_SCALABLE_DISABLED: LV: Selecting VF: 1646; CHECK_SCALABLE_ON_NOMAXBW: LV: Found feasible scalable VF = vscale x 447; CHECK_SCALABLE_ON_NOMAXBW: LV: Selecting VF: vscale x 448entry:49  br label %loop50 51loop:52  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]53  %arrayidx = getelementptr inbounds i32, ptr %a, i64 %iv54  %0 = load i32, ptr %arrayidx, align 455  %arrayidx2 = getelementptr inbounds i8, ptr %b, i64 %iv56  %1 = load i8, ptr %arrayidx2, align 457  %zext = zext i8 %1 to i3258  %add = add nsw i32 %zext, %059  %2 = add nuw nsw i64 %iv, 6460  %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %261  store i32 %add, ptr %arrayidx5, align 462  %iv.next = add nuw nsw i64 %iv, 163  %exitcond.not = icmp eq i64 %iv.next, 102464  br i1 %exitcond.not, label %exit, label %loop65 66exit:67  ret void68}69 70; Test that the MaxVF for the following loop, with a dependence distance71; of 32 elements, is calculated as (maxvscale = 16) * 2.72define void @test2(ptr %a, ptr %b) #0 {73; CHECK: LV: Checking a loop in 'test2'74; CHECK_SCALABLE_ON: LV: Found feasible scalable VF = vscale x 275; CHECK_SCALABLE_ON: LV: Selecting VF: 1676; CHECK_SCALABLE_DISABLED-NOT: LV: Found feasible scalable VF77; CHECK_SCALABLE_DISABLED: LV: Selecting VF: 1678; CHECK_SCALABLE_ON_NOMAXBW: LV: Found feasible scalable VF = vscale x 279; CHECK_SCALABLE_ON_NOMAXBW: LV: Selecting VF: 480entry:81  br label %loop82 83loop:84  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]85  %arrayidx = getelementptr inbounds i32, ptr %a, i64 %iv86  %0 = load i32, ptr %arrayidx, align 487  %arrayidx2 = getelementptr inbounds i8, ptr %b, i64 %iv88  %1 = load i8, ptr %arrayidx2, align 489  %zext = zext i8 %1 to i3290  %add = add nsw i32 %zext, %091  %2 = add nuw nsw i64 %iv, 3292  %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %293  store i32 %add, ptr %arrayidx5, align 494  %iv.next = add nuw nsw i64 %iv, 195  %exitcond.not = icmp eq i64 %iv.next, 102496  br i1 %exitcond.not, label %exit, label %loop97 98exit:99  ret void100}101 102; Test that the MaxVF for the following loop, with a dependence distance103; of 16 elements, is calculated as (maxvscale = 16) * 1.104define void @test3(ptr %a, ptr %b) #0 {105; CHECK: LV: Checking a loop in 'test3'106; CHECK_SCALABLE_ON: LV: Found feasible scalable VF = vscale x 1107; CHECK_SCALABLE_ON: LV: Selecting VF: 16108; CHECK_SCALABLE_DISABLED-NOT: LV: Found feasible scalable VF109; CHECK_SCALABLE_DISABLED: LV: Selecting VF: 16110; CHECK_SCALABLE_ON_NOMAXBW: LV: Found feasible scalable VF = vscale x 1111; CHECK_SCALABLE_ON_NOMAXBW: LV: Selecting VF: 4112entry:113  br label %loop114 115loop:116  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]117  %arrayidx = getelementptr inbounds i32, ptr %a, i64 %iv118  %0 = load i32, ptr %arrayidx, align 4119  %arrayidx2 = getelementptr inbounds i8, ptr %b, i64 %iv120  %1 = load i8, ptr %arrayidx2, align 4121  %zext = zext i8 %1 to i32122  %add = add nsw i32 %zext, %0123  %2 = add nuw nsw i64 %iv, 16124  %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %2125  store i32 %add, ptr %arrayidx5, align 4126  %iv.next = add nuw nsw i64 %iv, 1127  %exitcond.not = icmp eq i64 %iv.next, 1024128  br i1 %exitcond.not, label %exit, label %loop129 130exit:131  ret void132}133 134; Test the fallback mechanism when scalable vectors are not feasible due135; to e.g. dependence distance.136define void @test4(ptr %a, ptr %b) #0 {137; CHECK: LV: Checking a loop in 'test4'138; CHECK_SCALABLE_ON-NOT: LV: Found feasible scalable VF139; CHECK_SCALABLE_ON-NOT: LV: Found feasible scalable VF140; CHECK_SCALABLE_ON: LV: Selecting VF: 4141; CHECK_SCALABLE_DISABLED-NOT: LV: Found feasible scalable VF142; CHECK_SCALABLE_DISABLED: LV: Selecting VF: 4143; CHECK_SCALABLE_ON_NOMAXBW-NOT: LV: Found feasible scalable VF144; CHECK_SCALABLE_ON_NOMAXBW: LV: Selecting VF: 4145entry:146  br label %loop147 148loop:149  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]150  %arrayidx = getelementptr inbounds i32, ptr %a, i64 %iv151  %0 = load i32, ptr %arrayidx, align 4152  %arrayidx2 = getelementptr inbounds i32, ptr %b, i64 %iv153  %1 = load i32, ptr %arrayidx2, align 4154  %add = add nsw i32 %1, %0155  %2 = add nuw nsw i64 %iv, 8156  %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %2157  store i32 %add, ptr %arrayidx5, align 4158  %iv.next = add nuw nsw i64 %iv, 1159  %exitcond.not = icmp eq i64 %iv.next, 1024160  br i1 %exitcond.not, label %exit, label %loop161 162exit:163  ret void164}165 166attributes #0 = { vscale_range(1, 16) }167