blob: b4445c70cb57f1e5923aa140fa3ceaac06e64d3a [file] [log] [blame]
David Sherwood816663a2020-09-10 08:40:17 +01001; RUN: opt -loop-idiom -S <%s 2>%t | FileCheck %s
2; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t
3
4; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it.
5; WARN-NOT: warning
6
7define void @memcpy_fixed_vec(i64* noalias %a, i64* noalias %b) local_unnamed_addr #1 {
8; CHECK-LABEL: @memcpy_fixed_vec(
9; CHECK: entry:
10; CHECK: memcpy
11; CHECK: vector.body
12entry:
13 br label %vector.body
14
15vector.body: ; preds = %vector.body, %entry
16 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
17 %0 = getelementptr inbounds i64, i64* %a, i64 %index
18 %1 = bitcast i64* %0 to <2 x i64>*
19 %wide.load = load <2 x i64>, <2 x i64>* %1, align 8
20 %2 = getelementptr inbounds i64, i64* %b, i64 %index
21 %3 = bitcast i64* %2 to <2 x i64>*
22 store <2 x i64> %wide.load, <2 x i64>* %3, align 8
23 %index.next = add nuw nsw i64 %index, 2
24 %4 = icmp eq i64 %index.next, 1024
25 br i1 %4, label %for.cond.cleanup, label %vector.body
26
27for.cond.cleanup: ; preds = %vector.body
28 ret void
29}
30
31define void @memcpy_scalable_vec(i64* noalias %a, i64* noalias %b) local_unnamed_addr #1 {
32; CHECK-LABEL: @memcpy_scalable_vec(
33; CHECK: entry:
34; CHECK-NOT: memcpy
35; CHECK: vector.body
36entry:
37 br label %vector.body
38
39vector.body: ; preds = %vector.body, %entry
40 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
41 %0 = bitcast i64* %a to <vscale x 2 x i64>*
42 %1 = getelementptr inbounds <vscale x 2 x i64>, <vscale x 2 x i64>* %0, i64 %index
43 %wide.load = load <vscale x 2 x i64>, <vscale x 2 x i64>* %1, align 16
44 %2 = bitcast i64* %b to <vscale x 2 x i64>*
45 %3 = getelementptr inbounds <vscale x 2 x i64>, <vscale x 2 x i64>* %2, i64 %index
46 store <vscale x 2 x i64> %wide.load, <vscale x 2 x i64>* %3, align 16
47 %index.next = add nuw nsw i64 %index, 1
48 %4 = icmp eq i64 %index.next, 1024
49 br i1 %4, label %for.cond.cleanup, label %vector.body
50
51for.cond.cleanup: ; preds = %vector.body
52 ret void
53}