Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame^] | 1 | ; RUN: llc -mtriple=arm64-apple-ios < %s | FileCheck %s |
| 2 | ; RUN: llc -mtriple=arm64-linux-gnu -relocation-model=pic < %s | FileCheck %s --check-prefix=CHECK-LINUX |
| 3 | ; <rdar://problem/11392109> |
| 4 | |
| 5 | define hidden void @t() optsize ssp { |
| 6 | entry: |
| 7 | store i64 zext (i32 ptrtoint (i64 (i32)* @x to i32) to i64), i64* undef, align 8 |
| 8 | ; CHECK: adrp x{{[0-9]+}}, _x@GOTPAGE |
| 9 | ; CHECK: ldr x{{[0-9]+}}, [x{{[0-9]+}}, _x@GOTPAGEOFF] |
| 10 | ; CHECK-NEXT: and x{{[0-9]+}}, x{{[0-9]+}}, #0xffffffff |
| 11 | ; CHECK-NEXT: str x{{[0-9]+}}, [x{{[0-9]+}}] |
| 12 | unreachable |
| 13 | } |
| 14 | |
| 15 | declare i64 @x(i32) optsize |
| 16 | |
| 17 | ; Worth checking the Linux code is sensible too: only way to access |
| 18 | ; the GOT is via a 64-bit load. Just loading wN is unacceptable |
| 19 | ; (there's no ELF relocation to do that). |
| 20 | |
| 21 | ; CHECK-LINUX: adrp {{x[0-9]+}}, :got:x |
| 22 | ; CHECK-LINUX: ldr {{x[0-9]+}}, [{{x[0-9]+}}, :got_lo12:x] |