llvm.org GIT mirror llvm / 46d061d
merge all the basic linux/32 pic tests together into one test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80902 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
6 changed file(s) with 114 addition(s) and 97 deletion(s). Raw diff Collapse all Expand all
+0
-18
test/CodeGen/X86/pic-2.ll less more
None ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic \
1 ; RUN: -o %t
2 ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t
3 ; RUN: grep piclabel %t | count 3
4 ; RUN: grep GOTOFF %t | count 4
5
6 @ptr = internal global i32* null
7 @dst = internal global i32 0
8 @src = internal global i32 0
9
10 define void @foo() {
11 entry:
12 store i32* @dst, i32** @ptr
13 %tmp.s = load i32* @src
14 store i32 %tmp.s, i32* @dst
15 ret void
16 }
17
+0
-18
test/CodeGen/X86/pic-3.ll less more
None ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | FileCheck %s
1
2 ; CHECK: bar:
3 ; CHECK: call .Lllvm$1.$piclabel
4 ; CHECK: popl %ebx
5 ; CHECK: addl $_GLOBAL_OFFSET_TABLE_ + [.-.Lllvm$1.$piclabel], %ebx
6 ; CHECK: call foo@PLT
7
8
9 define void @bar() nounwind {
10 entry:
11 call void(...)* @foo()
12 br label %return
13 return:
14 ret void
15 }
16
17 declare void @foo(...)
+0
-22
test/CodeGen/X86/pic-4.ll less more
None ; RUN: llvm-as < %s | \
1 ; RUN: llc -mtriple=i686-pc-linux-gnu -relocation-model=pic -o %t
2 ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t
3 ; RUN: grep piclabel %t | count 3
4 ; RUN: grep PLT %t | count 1
5 ; RUN: grep GOT %t | count 1
6 ; RUN: not grep GOTOFF %t
7
8 @pfoo = external global void(...)*
9
10 define void @bar() {
11 entry:
12 %tmp = call void(...)*(...)* @afoo()
13 store void(...)* %tmp, void(...)** @pfoo
14 %tmp1 = load void(...)** @pfoo
15 call void(...)* %tmp1()
16 br label %return
17 return:
18 ret void
19 }
20
21 declare void(...)* @afoo(...)
+0
-14
test/CodeGen/X86/pic-5.ll less more
None ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic \
1 ; RUN: -o %t
2 ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t
3 ; RUN: grep piclabel %t | count 3
4 ; RUN: grep PLT %t | count 1
5
6 @ptr = external global i32*
7
8 define void @foo() {
9 entry:
10 %ptr = malloc i32, i32 10
11 ret void
12 }
13
+0
-18
test/CodeGen/X86/pic-6.ll less more
None ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic \
1 ; RUN: -o %t
2 ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t
3 ; RUN: grep piclabel %t | count 3
4 ; RUN: grep GOT %t | count 3
5
6 @ptr = global i32* null
7 @dst = global i32 0
8 @src = global i32 0
9
10 define void @foo() {
11 entry:
12 store i32* @dst, i32** @ptr
13 %tmp.s = load i32* @src
14 store i32 %tmp.s, i32* @dst
15 ret void
16 }
17
None ; RUN: llvm-as < %s | \
1 ; RUN: llc -mtriple=i686-pc-linux-gnu -relocation-model=pic -o %t
2 ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t
3 ; RUN: grep piclabel %t | count 3
4 ; RUN: grep GOT %t | count 3
5 ; RUN: not grep GOTOFF %t
0 ; RUN: llc < %s -mtriple=i686-pc-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=LINUX
61
72 @ptr = external global i32*
83 @dst = external global i32
94 @src = external global i32
105
11 define void @foo() nounwind {
6 define void @test1() nounwind {
127 entry:
138 store i32* @dst, i32** @ptr
149 %tmp.s = load i32* @src
1510 store i32 %tmp.s, i32* @dst
1611 ret void
12
13 ; LINUX: test1:
14 ; LINUX: .LBB1_0:
15 ; LINUX: call .Lllvm$1.$piclabel
16 ; LINUX-NEXT: .Lllvm$1.$piclabel:
17 ; LINUX-NEXT: popl
18 ; LINUX: addl $_GLOBAL_OFFSET_TABLE_ + [.-.Lllvm$1.$piclabel],
19 ; LINUX: movl dst@GOT(%eax),
20 ; LINUX: movl ptr@GOT(%eax),
21 ; LINUX: movl src@GOT(%eax),
22 ; LINUX: ret
1723 }
1824
25 @ptr2 = global i32* null
26 @dst2 = global i32 0
27 @src2 = global i32 0
28
29 define void @test2() nounwind {
30 entry:
31 store i32* @dst2, i32** @ptr2
32 %tmp.s = load i32* @src2
33 store i32 %tmp.s, i32* @dst2
34 ret void
35
36 ; LINUX: test2:
37 ; LINUX: call .Lllvm$2.$piclabel
38 ; LINUX-NEXT: .Lllvm$2.$piclabel:
39 ; LINUX-NEXT: popl
40 ; LINUX: addl $_GLOBAL_OFFSET_TABLE_ + [.-.Lllvm$2.$piclabel], %eax
41 ; LINUX: movl dst2@GOT(%eax),
42 ; LINUX: movl ptr2@GOT(%eax),
43 ; LINUX: movl src2@GOT(%eax),
44 ; LINUX: ret
45
46 }
47
48 declare i8* @malloc(i32)
49
50 define void @test3() nounwind {
51 entry:
52 %ptr = call i8* @malloc(i32 40)
53 ret void
54 ; LINUX: test3:
55 ; LINUX: pushl %ebx
56 ; LINUX-NEXT: subl $8, %esp
57 ; LINUX-NEXT: call .Lllvm$3.$piclabel
58 ; LINUX-NEXT: .Lllvm$3.$piclabel:
59 ; LINUX-NEXT: popl %ebx
60 ; LINUX: addl $_GLOBAL_OFFSET_TABLE_ + [.-.Lllvm$3.$piclabel], %ebx
61 ; LINUX: movl $40, (%esp)
62 ; LINUX: call malloc@PLT
63 ; LINUX: addl $8, %esp
64 ; LINUX: popl %ebx
65 ; LINUX: ret
66 }
67
68 @pfoo = external global void(...)*
69
70 define void @test4() nounwind {
71 entry:
72 %tmp = call void(...)*(...)* @afoo()
73 store void(...)* %tmp, void(...)** @pfoo
74 %tmp1 = load void(...)** @pfoo
75 call void(...)* %tmp1()
76 ret void
77 ; LINUX: test4:
78 ; LINUX: call .Lllvm$4.$piclabel
79 ; LINUX-NEXT: .Lllvm$4.$piclabel:
80 ; LINUX: popl
81 ; LINUX: addl $_GLOBAL_OFFSET_TABLE_ + [.-.Lllvm$4.$piclabel],
82 ; LINUX: movl pfoo@GOT(%esi),
83 ; LINUX: call afoo@PLT
84 ; LINUX: call *
85 }
86
87 declare void(...)* @afoo(...)
88
89 define void @test5() nounwind {
90 entry:
91 call void(...)* @foo()
92 ret void
93 ; LINUX: test5:
94 ; LINUX: call .Lllvm$5.$piclabel
95 ; LINUX: popl %ebx
96 ; LINUX: addl $_GLOBAL_OFFSET_TABLE_ + [.-.Lllvm$5.$piclabel], %ebx
97 ; LINUX: call foo@PLT
98 }
99
100 declare void @foo(...)
101
102
103 @ptr6 = internal global i32* null
104 @dst6 = internal global i32 0
105 @src6 = internal global i32 0
106
107 define void @test6() nounwind {
108 entry:
109 store i32* @dst6, i32** @ptr6
110 %tmp.s = load i32* @src6
111 store i32 %tmp.s, i32* @dst6
112 ret void
113
114 ; LINUX: test6:
115 ; LINUX: call .Lllvm$6.$piclabel
116 ; LINUX-NEXT: .Lllvm$6.$piclabel:
117 ; LINUX-NEXT: popl %eax
118 ; LINUX: addl $_GLOBAL_OFFSET_TABLE_ + [.-.Lllvm$6.$piclabel], %eax
119 ; LINUX: leal dst6@GOTOFF(%eax), %ecx
120 ; LINUX: movl %ecx, ptr6@GOTOFF(%eax)
121 ; LINUX: movl src6@GOTOFF(%eax), %ecx
122 ; LINUX: movl %ecx, dst6@GOTOFF(%eax)
123 ; LINUX: ret
124 }
125