blob: 2120b2a3bfe70b2b45f4d5044830b8ec6e454ec6 [file] [log] [blame]
NAKAMURA Takumi4cf1a3b2014-03-30 05:01:04 +00001; RUN: llc -mtriple=arm64-unknown-unknown -mcpu=cyclone -pre-RA-sched=list-hybrid < %s | FileCheck %s
Tim Northover00ed9962014-03-29 10:18:08 +00002; rdar://10232252
3; Prevent LSR of doing poor choice that cannot be folded in addressing mode
4
5; Remove the -pre-RA-sched=list-hybrid option after fixing:
6; <rdar://problem/12702735> [ARM64][coalescer] need better register
7; coalescing for simple unit tests.
8
9; CHECK: testCase
10; CHECK: %while.body{{$}}
11; CHECK: ldr [[STREG:x[0-9]+]], [{{x[0-9]+}}], #8
12; CHECK-NEXT: str [[STREG]], [{{x[0-9]+}}], #8
13; CHECK: %while.end
14define i32 @testCase() nounwind ssp {
15entry:
16 br label %while.body
17
18while.body: ; preds = %while.body, %entry
19 %len.06 = phi i64 [ 1288, %entry ], [ %sub, %while.body ]
20 %pDst.05 = phi i64* [ inttoptr (i64 6442450944 to i64*), %entry ], [ %incdec.ptr1, %while.body ]
21 %pSrc.04 = phi i64* [ inttoptr (i64 4294967296 to i64*), %entry ], [ %incdec.ptr, %while.body ]
David Blaikie79e6c742015-02-27 19:29:02 +000022 %incdec.ptr = getelementptr inbounds i64, i64* %pSrc.04, i64 1
David Blaikiea79ac142015-02-27 21:17:42 +000023 %tmp = load volatile i64, i64* %pSrc.04, align 8
David Blaikie79e6c742015-02-27 19:29:02 +000024 %incdec.ptr1 = getelementptr inbounds i64, i64* %pDst.05, i64 1
Tim Northover00ed9962014-03-29 10:18:08 +000025 store volatile i64 %tmp, i64* %pDst.05, align 8
26 %sub = add i64 %len.06, -8
27 %cmp = icmp sgt i64 %sub, -1
28 br i1 %cmp, label %while.body, label %while.end
29
30while.end: ; preds = %while.body
31 tail call void inttoptr (i64 6442450944 to void ()*)() nounwind
32 ret i32 0
33}