source: icGREP/icgrep-devel/llvm-3.8.0.src/test/CodeGen/AArch64/arm64-fast-isel-addr-offset.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 1.6 KB
Line 
1; RUN: llc -O0 -fast-isel-abort=1 -verify-machineinstrs -mtriple=arm64-apple-darwin < %s | FileCheck %s
2
3@sortlist = common global [5001 x i32] zeroinitializer, align 16
4@sortlist2 = common global [5001 x i64] zeroinitializer, align 16
5
6; Load an address with an offset larget then LDR imm can handle
7define i32 @foo() nounwind {
8entry:
9; CHECK: @foo
10; CHECK: adrp x[[REG:[0-9]+]], _sortlist@GOTPAGE
11; CHECK: ldr x[[REG1:[0-9]+]], [x[[REG]], _sortlist@GOTPAGEOFF]
12; CHECK: movz x[[REG2:[0-9]+]], #0x4e20
13; CHECK: add x[[REG3:[0-9]+]], x[[REG1]], x[[REG2]]
14; CHECK: ldr w0, [x[[REG3]]]
15; CHECK: ret
16  %0 = load i32, i32* getelementptr inbounds ([5001 x i32], [5001 x i32]* @sortlist, i32 0, i64 5000), align 4
17  ret i32 %0
18}
19
20define i64 @foo2() nounwind {
21entry:
22; CHECK: @foo2
23; CHECK: adrp x[[REG:[0-9]+]], _sortlist2@GOTPAGE
24; CHECK: ldr x[[REG1:[0-9]+]], [x[[REG]], _sortlist2@GOTPAGEOFF]
25; CHECK: movz x[[REG2:[0-9]+]], #0x9c40
26; CHECK: add x[[REG3:[0-9]+]], x[[REG1]], x[[REG2]]
27; CHECK: ldr x0, [x[[REG3]]]
28; CHECK: ret
29  %0 = load i64, i64* getelementptr inbounds ([5001 x i64], [5001 x i64]* @sortlist2, i32 0, i64 5000), align 4
30  ret i64 %0
31}
32
33; Load an address with a ridiculously large offset.
34; rdar://12505553
35@pd2 = common global i8* null, align 8
36
37define signext i8 @foo3() nounwind ssp {
38entry:
39; CHECK: @foo3
40; CHECK: movz x[[REG:[0-9]+]], #0xb3a, lsl #32
41; CHECK: movk x[[REG]], #0x73ce, lsl #16
42; CHECK: movk x[[REG]], #0x2ff2
43  %0 = load i8*, i8** @pd2, align 8
44  %arrayidx = getelementptr inbounds i8, i8* %0, i64 12345678901234
45  %1 = load i8, i8* %arrayidx, align 1
46  ret i8 %1
47}
Note: See TracBrowser for help on using the repository browser.