1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -O2 -mtriple=m68k-linux-gnu -verify-machineinstrs \
3 ; RUN: -code-model=small -relocation-model=static \
6 @ptr = external global i32*
7 @dst = external global i32
8 @src = external global i32
10 define void @test0() nounwind {
12 ; CHECK: ; %bb.0: ; %entry
13 ; CHECK-NEXT: lea (dst,%pc), %a0
14 ; CHECK-NEXT: lea (ptr,%pc), %a1
15 ; CHECK-NEXT: move.l %a0, (%a1)
16 ; CHECK-NEXT: move.l (src,%pc), (%a0)
19 store i32* @dst, i32** @ptr
20 %tmp.s = load i32, i32* @src
21 store i32 %tmp.s, i32* @dst
25 @ptr2 = global i32* null
29 define void @test1() nounwind {
31 ; CHECK: ; %bb.0: ; %entry
32 ; CHECK-NEXT: lea (dst2,%pc), %a0
33 ; CHECK-NEXT: lea (ptr2,%pc), %a1
34 ; CHECK-NEXT: move.l %a0, (%a1)
35 ; CHECK-NEXT: move.l (src2,%pc), (%a0)
38 store i32* @dst2, i32** @ptr2
39 %tmp.s = load i32, i32* @src2
40 store i32 %tmp.s, i32* @dst2
44 declare i8* @malloc(i32)
46 define void @test2() nounwind {
48 ; CHECK: ; %bb.0: ; %entry
49 ; CHECK-NEXT: suba.l #4, %sp
50 ; CHECK-NEXT: move.l #40, (%sp)
51 ; CHECK-NEXT: jsr malloc@PLT
52 ; CHECK-NEXT: adda.l #4, %sp
55 %ptr = call i8* @malloc(i32 40)
59 @pfoo = external global void(...)*
60 declare void(...)* @afoo(...)
62 define void @test3() nounwind {
64 ; CHECK: ; %bb.0: ; %entry
65 ; CHECK-NEXT: suba.l #4, %sp
66 ; CHECK-NEXT: jsr afoo@PLT
67 ; CHECK-NEXT: move.l %d0, %a0
68 ; CHECK-NEXT: lea (pfoo,%pc), %a1
69 ; CHECK-NEXT: move.l %a0, (%a1)
70 ; CHECK-NEXT: jsr (%a0)
71 ; CHECK-NEXT: adda.l #4, %sp
74 %tmp = call void(...)*(...) @afoo()
75 store void(...)* %tmp, void(...)** @pfoo
76 %tmp1 = load void(...)*, void(...)** @pfoo
77 call void(...) %tmp1()
81 declare void @foo(...)
83 define void @test4() nounwind {
85 ; CHECK: ; %bb.0: ; %entry
86 ; CHECK-NEXT: suba.l #4, %sp
87 ; CHECK-NEXT: jsr foo@PLT
88 ; CHECK-NEXT: adda.l #4, %sp
95 @ptr6 = internal global i32* null
96 @dst6 = internal global i32 0
97 @src6 = internal global i32 0
99 define void @test5() nounwind {
100 ; CHECK-LABEL: test5:
101 ; CHECK: ; %bb.0: ; %entry
102 ; CHECK-NEXT: lea (dst6,%pc), %a0
103 ; CHECK-NEXT: lea (ptr6,%pc), %a1
104 ; CHECK-NEXT: move.l %a0, (%a1)
105 ; CHECK-NEXT: move.l (src6,%pc), (%a0)
108 store i32* @dst6, i32** @ptr6
109 %tmp.s = load i32, i32* @src6
110 store i32 %tmp.s, i32* @dst6
114 define void @test7(i32 %n.u) nounwind {
115 ; CHECK-LABEL: test7:
116 ; CHECK: ; %bb.0: ; %entry
117 ; CHECK-NEXT: move.l (4,%sp), %d0
118 ; CHECK-NEXT: add.l #-1, %d0
119 ; CHECK-NEXT: move.l %d0, %d1
120 ; CHECK-NEXT: sub.l #12, %d1
121 ; CHECK-NEXT: bhi .LBB6_12
122 ; CHECK-NEXT: ; %bb.1: ; %entry
123 ; CHECK-NEXT: lsl.l #2, %d0
124 ; CHECK-NEXT: lea (.LJTI6_0,%pc), %a0
125 ; CHECK-NEXT: move.l (0,%a0,%d0), %a0
126 ; CHECK-NEXT: jmp (%a0)
127 ; CHECK-NEXT: .LBB6_12: ; %bb2
128 ; CHECK-NEXT: bra foo6@PLT ; TAILCALL
129 ; CHECK-NEXT: .LBB6_3: ; %bb6
130 ; CHECK-NEXT: bra foo1@PLT ; TAILCALL
131 ; CHECK-NEXT: .LBB6_8: ; %bb1
132 ; CHECK-NEXT: bra foo2@PLT ; TAILCALL
133 ; CHECK-NEXT: .LBB6_9: ; %bb3
134 ; CHECK-NEXT: bra foo3@PLT ; TAILCALL
135 ; CHECK-NEXT: .LBB6_10: ; %bb4
136 ; CHECK-NEXT: bra foo4@PLT ; TAILCALL
137 ; CHECK-NEXT: .LBB6_14: ; %bb11
138 ; CHECK-NEXT: bra foo5@PLT ; TAILCALL
140 switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ]
142 tail call void(...) @foo1()
145 tail call void(...) @foo2()
148 tail call void(...) @foo6()
151 tail call void(...) @foo3()
154 tail call void(...) @foo4()
157 tail call void(...) @foo5()
160 tail call void(...) @foo1()
163 tail call void(...) @foo2()
166 tail call void(...) @foo6()
169 tail call void(...) @foo3()
172 tail call void(...) @foo4()
175 tail call void(...) @foo5()
178 tail call void(...) @foo6()
182 declare void @foo1(...)
183 declare void @foo2(...)
184 declare void @foo6(...)
185 declare void @foo3(...)
186 declare void @foo4(...)
187 declare void @foo5(...)