1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -O2 -mtriple=m68k -verify-machineinstrs \
3 ; RUN: -code-model=small -relocation-model=static \
6 @ptr = external global ptr
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: move.l %a0, (ptr,%pc)
15 ; CHECK-NEXT: move.l (src,%pc), (dst,%pc)
18 store ptr @dst, ptr @ptr
19 %tmp.s = load i32, ptr @src
20 store i32 %tmp.s, ptr @dst
24 @ptr2 = global ptr null
28 define void @test1() nounwind {
30 ; CHECK: ; %bb.0: ; %entry
31 ; CHECK-NEXT: lea (dst2,%pc), %a0
32 ; CHECK-NEXT: move.l %a0, (ptr2,%pc)
33 ; CHECK-NEXT: move.l (src2,%pc), (dst2,%pc)
36 store ptr @dst2, ptr @ptr2
37 %tmp.s = load i32, ptr @src2
38 store i32 %tmp.s, ptr @dst2
42 declare ptr @malloc(i32)
44 define void @test2() nounwind {
46 ; CHECK: ; %bb.0: ; %entry
47 ; CHECK-NEXT: suba.l #4, %sp
48 ; CHECK-NEXT: move.l #40, (%sp)
49 ; CHECK-NEXT: jsr malloc
50 ; CHECK-NEXT: adda.l #4, %sp
53 %ptr = call ptr @malloc(i32 40)
57 @pfoo = external global ptr
58 declare ptr @afoo(...)
60 define void @test3() nounwind {
62 ; CHECK: ; %bb.0: ; %entry
63 ; CHECK-NEXT: suba.l #4, %sp
64 ; CHECK-NEXT: jsr afoo
65 ; CHECK-NEXT: move.l %a0, (pfoo,%pc)
66 ; CHECK-NEXT: jsr (%a0)
67 ; CHECK-NEXT: adda.l #4, %sp
70 %tmp = call ptr(...) @afoo()
71 store ptr %tmp, ptr @pfoo
72 %tmp1 = load ptr, ptr @pfoo
73 call void(...) %tmp1()
77 declare void @foo(...)
79 define void @test4() nounwind {
81 ; CHECK: ; %bb.0: ; %entry
82 ; CHECK-NEXT: suba.l #4, %sp
84 ; CHECK-NEXT: adda.l #4, %sp
91 @ptr6 = internal global ptr null
92 @dst6 = internal global i32 0
93 @src6 = internal global i32 0
95 define void @test5() nounwind {
97 ; CHECK: ; %bb.0: ; %entry
98 ; CHECK-NEXT: lea (dst6,%pc), %a0
99 ; CHECK-NEXT: move.l %a0, (ptr6,%pc)
100 ; CHECK-NEXT: move.l (src6,%pc), (dst6,%pc)
103 store ptr @dst6, ptr @ptr6
104 %tmp.s = load i32, ptr @src6
105 store i32 %tmp.s, ptr @dst6
109 define void @test7(i32 %n.u) nounwind {
110 ; CHECK-LABEL: test7:
111 ; CHECK: ; %bb.0: ; %entry
112 ; CHECK-NEXT: move.l (4,%sp), %d0
113 ; CHECK-NEXT: add.l #-1, %d0
114 ; CHECK-NEXT: move.l %d0, %d1
115 ; CHECK-NEXT: sub.l #12, %d1
116 ; CHECK-NEXT: bhi .LBB6_12
117 ; CHECK-NEXT: ; %bb.1: ; %entry
118 ; CHECK-NEXT: lsl.l #2, %d0
119 ; CHECK-NEXT: lea (.LJTI6_0,%pc), %a0
120 ; CHECK-NEXT: move.l (0,%a0,%d0), %a0
121 ; CHECK-NEXT: jmp (%a0)
122 ; CHECK-NEXT: .LBB6_12: ; %bb2
123 ; CHECK-NEXT: bra foo6 ; TAILCALL
124 ; CHECK-NEXT: .LBB6_3: ; %bb5
125 ; CHECK-NEXT: bra foo5 ; TAILCALL
126 ; CHECK-NEXT: .LBB6_5: ; %bb1
127 ; CHECK-NEXT: bra foo2 ; TAILCALL
128 ; CHECK-NEXT: .LBB6_2: ; %bb
129 ; CHECK-NEXT: bra foo1 ; TAILCALL
130 ; CHECK-NEXT: .LBB6_9: ; %bb4
131 ; CHECK-NEXT: bra foo4 ; TAILCALL
132 ; CHECK-NEXT: .LBB6_8: ; %bb3
133 ; CHECK-NEXT: bra foo3 ; TAILCALL
135 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 ]
137 tail call void(...) @foo1()
140 tail call void(...) @foo2()
143 tail call void(...) @foo6()
146 tail call void(...) @foo3()
149 tail call void(...) @foo4()
152 tail call void(...) @foo5()
155 tail call void(...) @foo1()
158 tail call void(...) @foo2()
161 tail call void(...) @foo6()
164 tail call void(...) @foo3()
167 tail call void(...) @foo4()
170 tail call void(...) @foo5()
173 tail call void(...) @foo6()
177 declare void @foo1(...)
178 declare void @foo2(...)
179 declare void @foo6(...)
180 declare void @foo3(...)
181 declare void @foo4(...)
182 declare void @foo5(...)