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
4
5@ptr = external global i32*		; <i32**> [#uses=1]
6@src = external global [0 x i32]		; <[0 x i32]*> [#uses=1]
7@dst = external global [0 x i32]		; <[0 x i32]*> [#uses=1]
8@lptr = internal global i32* null		; <i32**> [#uses=1]
9@ldst = internal global [500 x i32] zeroinitializer, align 32		; <[500 x i32]*> [#uses=1]
10@lsrc = internal global [500 x i32] zeroinitializer, align 32		; <[500 x i32]*> [#uses=0]
11@bsrc = internal global [500000 x i32] zeroinitializer, align 32		; <[500000 x i32]*> [#uses=0]
12@bdst = internal global [500000 x i32] zeroinitializer, align 32		; <[500000 x i32]*> [#uses=0]
13
14define void @test1() nounwind {
15; DARWIN-LABEL: test1:
16; DARWIN:       ## %bb.0:
17; DARWIN-NEXT:    movq _src@{{.*}}(%rip), %rax
18; DARWIN-NEXT:    movl (%rax), %eax
19; DARWIN-NEXT:    movq _dst@{{.*}}(%rip), %rcx
20; DARWIN-NEXT:    movl %eax, (%rcx)
21; DARWIN-NEXT:    retq
22;
23; LINUX-LABEL: test1:
24; LINUX:       # %bb.0:
25; LINUX-NEXT:    movq src@{{.*}}(%rip), %rax
26; LINUX-NEXT:    movl (%rax), %eax
27; LINUX-NEXT:    movq dst@{{.*}}(%rip), %rcx
28; LINUX-NEXT:    movl %eax, (%rcx)
29; LINUX-NEXT:    retq
30	%tmp = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @src, i32 0, i32 0)		; <i32> [#uses=1]
31	store i32 %tmp, i32* getelementptr ([0 x i32], [0 x i32]* @dst, i32 0, i32 0)
32	ret void
33}
34
35define void @test2() nounwind {
36; DARWIN-LABEL: test2:
37; DARWIN:       ## %bb.0:
38; DARWIN-NEXT:    movq _dst@{{.*}}(%rip), %rax
39; DARWIN-NEXT:    movq _ptr@{{.*}}(%rip), %rcx
40; DARWIN-NEXT:    movq %rax, (%rcx)
41; DARWIN-NEXT:    retq
42;
43; LINUX-LABEL: test2:
44; LINUX:       # %bb.0:
45; LINUX-NEXT:    movq dst@{{.*}}(%rip), %rax
46; LINUX-NEXT:    movq ptr@{{.*}}(%rip), %rcx
47; LINUX-NEXT:    movq %rax, (%rcx)
48; LINUX-NEXT:    retq
49	store i32* getelementptr ([0 x i32], [0 x i32]* @dst, i32 0, i32 0), i32** @ptr
50	ret void
51}
52
53define void @test3() nounwind {
54; DARWIN-LABEL: test3:
55; DARWIN:       ## %bb.0:
56; DARWIN-NEXT:    leaq {{.*}}(%rip), %rax
57; DARWIN-NEXT:    movq %rax, {{.*}}(%rip)
58; DARWIN-NEXT:    retq
59;
60; LINUX-LABEL: test3:
61; LINUX:       # %bb.0:
62; LINUX-NEXT:    movq $ldst, {{.*}}(%rip)
63; LINUX-NEXT:    retq
64	store i32* getelementptr ([500 x i32], [500 x i32]* @ldst, i32 0, i32 0), i32** @lptr
65	br label %return
66
67return:		; preds = %0
68	ret void
69}
70