1 ; RUN: opt -passes=loop-idiom -S <%s | FileCheck %s
3 define void @memcpy_fixed_vec(ptr noalias %a, ptr noalias %b) local_unnamed_addr #1 {
4 ; CHECK-LABEL: @memcpy_fixed_vec(
11 vector.body: ; preds = %vector.body, %entry
12 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
13 %0 = getelementptr inbounds i64, ptr %a, i64 %index
14 %wide.load = load <2 x i64>, ptr %0, align 8
15 %1 = getelementptr inbounds i64, ptr %b, i64 %index
16 store <2 x i64> %wide.load, ptr %1, align 8
17 %index.next = add nuw nsw i64 %index, 2
18 %2 = icmp eq i64 %index.next, 1024
19 br i1 %2, label %for.cond.cleanup, label %vector.body
21 for.cond.cleanup: ; preds = %vector.body
25 define void @memcpy_scalable_vec(ptr noalias %a, ptr noalias %b) local_unnamed_addr #1 {
26 ; CHECK-LABEL: @memcpy_scalable_vec(
33 vector.body: ; preds = %vector.body, %entry
34 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
35 %0 = getelementptr inbounds <vscale x 2 x i64>, ptr %a, i64 %index
36 %wide.load = load <vscale x 2 x i64>, ptr %0, align 16
37 %1 = getelementptr inbounds <vscale x 2 x i64>, ptr %b, i64 %index
38 store <vscale x 2 x i64> %wide.load, ptr %1, align 16
39 %index.next = add nuw nsw i64 %index, 1
40 %2 = icmp eq i64 %index.next, 1024
41 br i1 %2, label %for.cond.cleanup, label %vector.body
43 for.cond.cleanup: ; preds = %vector.body