29 lines · plain
1; RUN: opt -mtriple=s390x-unknown-linux -mcpu=z13 -passes=loop-vectorize \2; RUN: -force-vector-width=4 -debug-only=loop-vectorize \3; RUN: -enable-interleaved-mem-accesses=false -disable-output < %s 2>&1 \4; RUN: | FileCheck %s5; REQUIRES: asserts6;7; Check that a scalarized load does not get a zero cost in a vectorized8; loop. It can only be folded into the add operand in the scalar loop.9 10define i32 @fun(ptr %data, i64 %n, i64 %s, ptr %Src) {11entry:12 br label %for.body13 14for.body:15 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]16 %acc = phi i32 [ 0, %entry ], [ %acc_next, %for.body ]17 %gep = getelementptr inbounds i32, ptr %Src, i64 %iv18 %ld = load i32, ptr %gep19 %acc_next = add i32 %acc, %ld20 %iv.next = add nuw nsw i64 %iv, 221 %cmp110.us = icmp slt i64 %iv.next, %n22 br i1 %cmp110.us, label %for.body, label %for.end23 24for.end:25 ret i32 %acc_next26 27; CHECK: Found an estimated cost of 4 for VF 4 For instruction: %ld = load i32, ptr %gep28}29