119 lines · plain
1; RUN: opt -passes=loop-vectorize -S < %s | FileCheck %s2 3target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"4target triple = "aarch64-unknown-linux-gnu"5 6define noundef i32 @V1(ptr noalias nocapture noundef %0, ptr noalias nocapture noundef readonly %1, i32 noundef %2) #0 {7; CHECK-LABEL: @V1(8; CHECK-NOT: vec.epilog.ph:9; CHECK-NOT: vec.epilog.vector.body:10; CHECK-NOT: vec.epilog.middle.block:11; CHECK-NOT: vec.epilog.scalar.ph:12;13entry:14 %4 = icmp sgt i32 %2, 015 br i1 %4, label %5, label %816 175:18 %6 = zext nneg i32 %2 to i6419 br label %920 217:22 br label %823 248:25 ret i32 4226 279:28 %10 = phi i64 [ 0, %5 ], [ %16, %9 ]29 %11 = getelementptr inbounds double, ptr %0, i64 %1030 %12 = load double, ptr %11, align 831 %13 = getelementptr inbounds double, ptr %1, i64 %1032 %14 = load double, ptr %13, align 833 %15 = fadd fast double %14, %1234 store double %15, ptr %11, align 835 %16 = add nuw nsw i64 %10, 136 %17 = icmp eq i64 %16, %637 br i1 %17, label %7, label %938}39 40define noundef i32 @V2(ptr noalias nocapture noundef %0, ptr noalias nocapture noundef readonly %1, i32 noundef %2) #1 {41;42; CHECK-LABEL: @V2(43; CHECK: vec.epilog.ph:44; CHECK: vec.epilog.vector.body:45; CHECK: vec.epilog.middle.block:46; CHECK: vec.epilog.scalar.ph:47;48entry:49 %4 = icmp sgt i32 %2, 050 br i1 %4, label %5, label %851 525:53 %6 = zext nneg i32 %2 to i6454 br label %955 567:57 br label %858 598:60 ret i32 4261 629:63 %10 = phi i64 [ 0, %5 ], [ %16, %9 ]64 %11 = getelementptr inbounds double, ptr %0, i64 %1065 %12 = load double, ptr %11, align 866 %13 = getelementptr inbounds double, ptr %1, i64 %1067 %14 = load double, ptr %13, align 868 %15 = fadd fast double %14, %1269 store double %15, ptr %11, align 870 %16 = add nuw nsw i64 %10, 171 %17 = icmp eq i64 %16, %672 br i1 %17, label %7, label %973}74 75; TODO: The V3 will generate a scalable vector body, so doesn't need a76; epilogue loop, but will need to be checked that is really the best thing to77; for the V3.78;79define noundef i32 @V3(ptr noalias nocapture noundef %0, ptr noalias nocapture noundef readonly %1, i32 noundef %2) #2 {80;81; CHECK-LABEL: @V3(82; CHECK-NOT: vec.epilog.ph:83; CHECK-NOT: vec.epilog.vector.body:84; CHECK-NOT: vec.epilog.middle.block:85; CHECK-NOT: vec.epilog.scalar.ph:86;87entry:88 %4 = icmp sgt i32 %2, 089 br i1 %4, label %5, label %890 915:92 %6 = zext nneg i32 %2 to i6493 br label %994 957:96 br label %897 988:99 ret i32 42100 1019:102 %10 = phi i64 [ 0, %5 ], [ %16, %9 ]103 %11 = getelementptr inbounds double, ptr %0, i64 %10104 %12 = load double, ptr %11, align 8105 %13 = getelementptr inbounds double, ptr %1, i64 %10106 %14 = load double, ptr %13, align 8107 %15 = fadd fast double %14, %12108 store double %15, ptr %11, align 8109 %16 = add nuw nsw i64 %10, 1110 %17 = icmp eq i64 %16, %6111 br i1 %17, label %7, label %9112}113 114attributes #0 = { vscale_range(1,16) "target-cpu"="neoverse-v1" "target-features"="+sve2" }115 116attributes #1 = { vscale_range(1,16) "target-cpu"="neoverse-v2" "target-features"="+sve2" }117 118attributes #2 = { vscale_range(1,16) "target-cpu"="neoverse-v3" "target-features"="+sve2" }119