148 lines · plain
1; RUN: opt -passes=loop-vectorize -force-vector-width=2 -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=VF_22; RUN: opt -passes=loop-vectorize -force-vector-width=4 -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=VF_43; RUN: opt -passes=loop-vectorize -force-vector-width=8 -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=VF_84; RUN: opt -passes=loop-vectorize -force-vector-width=16 -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=VF_165; REQUIRES: asserts6 7target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"8target triple = "armv8--linux-gnueabihf"9 10%i8.2 = type {i8, i8}11define void @i8_factor_2(ptr %data, i64 %n) {12entry:13 br label %for.body14 15; VF_8-LABEL: Checking a loop in 'i8_factor_2'16; VF_8: Found an estimated cost of 2 for VF 8 For instruction: %tmp2 = load i8, ptr %tmp0, align 117; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: %tmp3 = load i8, ptr %tmp1, align 118; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: store i8 %tmp2, ptr %tmp0, align 119; VF_8-NEXT: Found an estimated cost of 2 for VF 8 For instruction: store i8 %tmp3, ptr %tmp1, align 120; VF_16-LABEL: Checking a loop in 'i8_factor_2'21; VF_16: Found an estimated cost of 2 for VF 16 For instruction: %tmp2 = load i8, ptr %tmp0, align 122; VF_16-NEXT: Found an estimated cost of 0 for VF 16 For instruction: %tmp3 = load i8, ptr %tmp1, align 123; VF_16-NEXT: Found an estimated cost of 0 for VF 16 For instruction: store i8 %tmp2, ptr %tmp0, align 124; VF_16-NEXT: Found an estimated cost of 2 for VF 16 For instruction: store i8 %tmp3, ptr %tmp1, align 125for.body:26 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]27 %tmp0 = getelementptr inbounds %i8.2, ptr %data, i64 %i, i32 028 %tmp1 = getelementptr inbounds %i8.2, ptr %data, i64 %i, i32 129 %tmp2 = load i8, ptr %tmp0, align 130 %tmp3 = load i8, ptr %tmp1, align 131 store i8 %tmp2, ptr %tmp0, align 132 store i8 %tmp3, ptr %tmp1, align 133 %i.next = add nuw nsw i64 %i, 134 %cond = icmp slt i64 %i.next, %n35 br i1 %cond, label %for.body, label %for.end36 37for.end:38 ret void39}40 41%i16.2 = type {i16, i16}42define void @i16_factor_2(ptr %data, i64 %n) {43entry:44 br label %for.body45 46; VF_4-LABEL: Checking a loop in 'i16_factor_2'47; VF_4: Found an estimated cost of 2 for VF 4 For instruction: %tmp2 = load i16, ptr %tmp0, align 248; VF_4-NEXT: Found an estimated cost of 0 for VF 4 For instruction: %tmp3 = load i16, ptr %tmp1, align 249; VF_4-NEXT: Found an estimated cost of 0 for VF 4 For instruction: store i16 %tmp2, ptr %tmp0, align 250; VF_4-NEXT: Found an estimated cost of 2 for VF 4 For instruction: store i16 %tmp3, ptr %tmp1, align 251; VF_8-LABEL: Checking a loop in 'i16_factor_2'52; VF_8: Found an estimated cost of 2 for VF 8 For instruction: %tmp2 = load i16, ptr %tmp0, align 253; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: %tmp3 = load i16, ptr %tmp1, align 254; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: store i16 %tmp2, ptr %tmp0, align 255; VF_8-NEXT: Found an estimated cost of 2 for VF 8 For instruction: store i16 %tmp3, ptr %tmp1, align 256; VF_16-LABEL: Checking a loop in 'i16_factor_2'57; VF_16: Found an estimated cost of 4 for VF 16 For instruction: %tmp2 = load i16, ptr %tmp0, align 258; VF_16-NEXT: Found an estimated cost of 0 for VF 16 For instruction: %tmp3 = load i16, ptr %tmp1, align 259; VF_16-NEXT: Found an estimated cost of 0 for VF 16 For instruction: store i16 %tmp2, ptr %tmp0, align 260; VF_16-NEXT: Found an estimated cost of 4 for VF 16 For instruction: store i16 %tmp3, ptr %tmp1, align 261for.body:62 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]63 %tmp0 = getelementptr inbounds %i16.2, ptr %data, i64 %i, i32 064 %tmp1 = getelementptr inbounds %i16.2, ptr %data, i64 %i, i32 165 %tmp2 = load i16, ptr %tmp0, align 266 %tmp3 = load i16, ptr %tmp1, align 267 store i16 %tmp2, ptr %tmp0, align 268 store i16 %tmp3, ptr %tmp1, align 269 %i.next = add nuw nsw i64 %i, 170 %cond = icmp slt i64 %i.next, %n71 br i1 %cond, label %for.body, label %for.end72 73for.end:74 ret void75}76 77%i32.2 = type {i32, i32}78define void @i32_factor_2(ptr %data, i64 %n) {79entry:80 br label %for.body81 82; VF_2-LABEL: Checking a loop in 'i32_factor_2'83; VF_2: Found an estimated cost of 2 for VF 2 For instruction: %tmp2 = load i32, ptr %tmp0, align 484; VF_2-NEXT: Found an estimated cost of 0 for VF 2 For instruction: %tmp3 = load i32, ptr %tmp1, align 485; VF_2-NEXT: Found an estimated cost of 0 for VF 2 For instruction: store i32 %tmp2, ptr %tmp0, align 486; VF_2-NEXT: Found an estimated cost of 2 for VF 2 For instruction: store i32 %tmp3, ptr %tmp1, align 487; VF_4-LABEL: Checking a loop in 'i32_factor_2'88; VF_4: Found an estimated cost of 2 for VF 4 For instruction: %tmp2 = load i32, ptr %tmp0, align 489; VF_4-NEXT: Found an estimated cost of 0 for VF 4 For instruction: %tmp3 = load i32, ptr %tmp1, align 490; VF_4-NEXT: Found an estimated cost of 0 for VF 4 For instruction: store i32 %tmp2, ptr %tmp0, align 491; VF_4-NEXT: Found an estimated cost of 2 for VF 4 For instruction: store i32 %tmp3, ptr %tmp1, align 492; VF_8-LABEL: Checking a loop in 'i32_factor_2'93; VF_8: Found an estimated cost of 4 for VF 8 For instruction: %tmp2 = load i32, ptr %tmp0, align 494; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: %tmp3 = load i32, ptr %tmp1, align 495; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: store i32 %tmp2, ptr %tmp0, align 496; VF_8-NEXT: Found an estimated cost of 4 for VF 8 For instruction: store i32 %tmp3, ptr %tmp1, align 497; VF_16-LABEL: Checking a loop in 'i32_factor_2'98; VF_16: Found an estimated cost of 8 for VF 16 For instruction: %tmp2 = load i32, ptr %tmp0, align 499; VF_16-NEXT: Found an estimated cost of 0 for VF 16 For instruction: %tmp3 = load i32, ptr %tmp1, align 4100; VF_16-NEXT: Found an estimated cost of 0 for VF 16 For instruction: store i32 %tmp2, ptr %tmp0, align 4101; VF_16-NEXT: Found an estimated cost of 8 for VF 16 For instruction: store i32 %tmp3, ptr %tmp1, align 4102for.body:103 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]104 %tmp0 = getelementptr inbounds %i32.2, ptr %data, i64 %i, i32 0105 %tmp1 = getelementptr inbounds %i32.2, ptr %data, i64 %i, i32 1106 %tmp2 = load i32, ptr %tmp0, align 4107 %tmp3 = load i32, ptr %tmp1, align 4108 store i32 %tmp2, ptr %tmp0, align 4109 store i32 %tmp3, ptr %tmp1, align 4110 %i.next = add nuw nsw i64 %i, 1111 %cond = icmp slt i64 %i.next, %n112 br i1 %cond, label %for.body, label %for.end113 114for.end:115 ret void116}117 118%half.2 = type {half, half}119define void @half_factor_2(ptr %data, i64 %n) {120entry:121 br label %for.body122 123; VF_4-LABEL: Checking a loop in 'half_factor_2'124; VF_4: Found an estimated cost of 40 for VF 4 For instruction: %tmp2 = load half, ptr %tmp0, align 2125; VF_4-NEXT: Found an estimated cost of 0 for VF 4 For instruction: %tmp3 = load half, ptr %tmp1, align 2126; VF_4-NEXT: Found an estimated cost of 0 for VF 4 For instruction: store half %tmp2, ptr %tmp0, align 2127; VF_4-NEXT: Found an estimated cost of 40 for VF 4 For instruction: store half %tmp3, ptr %tmp1, align 2128; VF_8-LABEL: Checking a loop in 'half_factor_2'129; VF_8: Found an estimated cost of 80 for VF 8 For instruction: %tmp2 = load half, ptr %tmp0, align 2130; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: %tmp3 = load half, ptr %tmp1, align 2131; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: store half %tmp2, ptr %tmp0, align 2132; VF_8-NEXT: Found an estimated cost of 80 for VF 8 For instruction: store half %tmp3, ptr %tmp1, align 2133for.body:134 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]135 %tmp0 = getelementptr inbounds %half.2, ptr %data, i64 %i, i32 0136 %tmp1 = getelementptr inbounds %half.2, ptr %data, i64 %i, i32 1137 %tmp2 = load half, ptr %tmp0, align 2138 %tmp3 = load half, ptr %tmp1, align 2139 store half %tmp2, ptr %tmp0, align 2140 store half %tmp3, ptr %tmp1, align 2141 %i.next = add nuw nsw i64 %i, 1142 %cond = icmp slt i64 %i.next, %n143 br i1 %cond, label %for.body, label %for.end144 145for.end:146 ret void147}148