1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefix=DARWIN
3 ; RUN: llc < %s -mtriple=x86_64-pc-linux -relocation-model=static | FileCheck %s --check-prefix=LINUX
5 @ptr = external global ptr ; <ptr> [#uses=1]
6 @src = external global [0 x i32] ; <ptr> [#uses=1]
7 @dst = external global [0 x i32] ; <ptr> [#uses=1]
8 @lptr = internal global ptr null ; <ptr> [#uses=1]
9 @ldst = internal global [500 x i32] zeroinitializer, align 32 ; <ptr> [#uses=1]
10 @lsrc = internal global [500 x i32] zeroinitializer, align 32 ; <ptr> [#uses=0]
11 @bsrc = internal global [500000 x i32] zeroinitializer, align 32 ; <ptr> [#uses=0]
12 @bdst = internal global [500000 x i32] zeroinitializer, align 32 ; <ptr> [#uses=0]
14 define void @test1() nounwind {
15 ; DARWIN-LABEL: test1:
17 ; DARWIN-NEXT: movq _src@GOTPCREL(%rip), %rax
18 ; DARWIN-NEXT: movl (%rax), %eax
19 ; DARWIN-NEXT: movq _dst@GOTPCREL(%rip), %rcx
20 ; DARWIN-NEXT: movl %eax, (%rcx)
25 ; LINUX-NEXT: movq src@GOTPCREL(%rip), %rax
26 ; LINUX-NEXT: movl (%rax), %eax
27 ; LINUX-NEXT: movq dst@GOTPCREL(%rip), %rcx
28 ; LINUX-NEXT: movl %eax, (%rcx)
30 %tmp = load i32, ptr @src ; <i32> [#uses=1]
31 store i32 %tmp, ptr @dst
35 define void @test2() nounwind {
36 ; DARWIN-LABEL: test2:
38 ; DARWIN-NEXT: movq _dst@GOTPCREL(%rip), %rax
39 ; DARWIN-NEXT: movq _ptr@GOTPCREL(%rip), %rcx
40 ; DARWIN-NEXT: movq %rax, (%rcx)
45 ; LINUX-NEXT: movq dst@GOTPCREL(%rip), %rax
46 ; LINUX-NEXT: movq ptr@GOTPCREL(%rip), %rcx
47 ; LINUX-NEXT: movq %rax, (%rcx)
49 store ptr @dst, ptr @ptr
53 define void @test3() nounwind {
54 ; DARWIN-LABEL: test3:
56 ; DARWIN-NEXT: leaq _ldst(%rip), %rax
57 ; DARWIN-NEXT: movq %rax, _lptr(%rip)
62 ; LINUX-NEXT: movq $ldst, lptr(%rip)
64 store ptr @ldst, ptr @lptr