xref: /llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/load-scalarization-cost-0.ll (revision c8c0b18b5d58415b79ea13b62eee70c130c26a0a)
1; RUN: opt -mtriple=s390x-unknown-linux -mcpu=z13 -passes=loop-vectorize \
2; RUN:   -force-vector-width=2 -debug-only=loop-vectorize \
3; RUN:   -disable-output < %s 2>&1 | FileCheck %s
4; REQUIRES: asserts
5;
6; Check that a scalarized load does not get operands scalarization costs added.
7
8define void @fun(ptr %data, i64 %n, i64 %s, ptr %Src) {
9entry:
10  br label %for.body
11
12for.body:
13  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
14  %mul = mul nsw i64 %iv, %s
15  %gep.src = getelementptr inbounds double, ptr %Src, i64 %mul
16  %bct = bitcast ptr %gep.src to ptr
17  %ld = load i64, ptr %bct
18  %gep.data = getelementptr inbounds i64, ptr %data, i64 %iv
19  store i64 %ld, ptr %gep.data
20  %iv.next = add nuw nsw i64 %iv, 1
21  %cmp110.us = icmp slt i64 %iv.next, %n
22  br i1 %cmp110.us, label %for.body, label %for.end
23
24for.end:
25  ret void
26
27; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction:   %mul = mul nsw i64 %iv, %s
28; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction:   %ld = load i64, ptr %bct
29}
30