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=medium -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: move.l #dst, ptr
14 ; CHECK-NEXT: move.l src, dst
17 store ptr @dst, ptr @ptr
18 %tmp.s = load i32, ptr @src
19 store i32 %tmp.s, ptr @dst
23 @ptr2 = global ptr null
27 define void @test1() nounwind {
29 ; CHECK: ; %bb.0: ; %entry
30 ; CHECK-NEXT: move.l #dst2, ptr2
31 ; CHECK-NEXT: move.l src2, dst2
34 store ptr @dst2, ptr @ptr2
35 %tmp.s = load i32, ptr @src2
36 store i32 %tmp.s, ptr @dst2
40 declare ptr @malloc(i32)
42 define void @test2() nounwind {
44 ; CHECK: ; %bb.0: ; %entry
45 ; CHECK-NEXT: suba.l #4, %sp
46 ; CHECK-NEXT: move.l #40, (%sp)
47 ; CHECK-NEXT: jsr malloc
48 ; CHECK-NEXT: adda.l #4, %sp
51 %ptr = call ptr @malloc(i32 40)
55 @pfoo = external global ptr
56 declare ptr @afoo(...)
59 define void @test3() nounwind {
61 ; CHECK: ; %bb.0: ; %entry
62 ; CHECK-NEXT: suba.l #4, %sp
63 ; CHECK-NEXT: jsr afoo
64 ; CHECK-NEXT: move.l %a0, pfoo
65 ; CHECK-NEXT: jsr (%a0)
66 ; CHECK-NEXT: adda.l #4, %sp
69 %tmp = call ptr(...) @afoo()
70 store ptr %tmp, ptr @pfoo
71 %tmp1 = load ptr, ptr @pfoo
72 call void(...) %tmp1()
76 declare void @foo(...)
78 define void @test4() nounwind {
80 ; CHECK: ; %bb.0: ; %entry
81 ; CHECK-NEXT: suba.l #4, %sp
83 ; CHECK-NEXT: adda.l #4, %sp
90 @ptr6 = internal global ptr null
91 @dst6 = internal global i32 0
92 @src6 = internal global i32 0
94 define void @test5() nounwind {
96 ; CHECK: ; %bb.0: ; %entry
97 ; CHECK-NEXT: move.l #dst6, ptr6
98 ; CHECK-NEXT: move.l src6, dst6
101 store ptr @dst6, ptr @ptr6
102 %tmp.s = load i32, ptr @src6
103 store i32 %tmp.s, ptr @dst6
107 define void @test7(i32 %n.u) nounwind {
108 ; CHECK-LABEL: test7:
109 ; CHECK: ; %bb.0: ; %entry
110 ; CHECK-NEXT: move.l (4,%sp), %d0
111 ; CHECK-NEXT: add.l #-1, %d0
112 ; CHECK-NEXT: move.l %d0, %d1
113 ; CHECK-NEXT: sub.l #12, %d1
114 ; CHECK-NEXT: bhi .LBB6_12
115 ; CHECK-NEXT: ; %bb.1: ; %entry
116 ; CHECK-NEXT: lsl.l #2, %d0
117 ; CHECK-NEXT: move.l #.LJTI6_0, %a0
118 ; CHECK-NEXT: move.l (0,%a0,%d0), %a0
119 ; CHECK-NEXT: jmp (%a0)
120 ; CHECK-NEXT: .LBB6_12: ; %bb2
121 ; CHECK-NEXT: bra foo6 ; TAILCALL
122 ; CHECK-NEXT: .LBB6_3: ; %bb5
123 ; CHECK-NEXT: bra foo5 ; TAILCALL
124 ; CHECK-NEXT: .LBB6_5: ; %bb1
125 ; CHECK-NEXT: bra foo2 ; TAILCALL
126 ; CHECK-NEXT: .LBB6_2: ; %bb
127 ; CHECK-NEXT: bra foo1 ; TAILCALL
128 ; CHECK-NEXT: .LBB6_9: ; %bb4
129 ; CHECK-NEXT: bra foo4 ; TAILCALL
130 ; CHECK-NEXT: .LBB6_8: ; %bb3
131 ; CHECK-NEXT: bra foo3 ; TAILCALL
133 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 ]
135 tail call void(...) @foo1()
138 tail call void(...) @foo2()
141 tail call void(...) @foo6()
144 tail call void(...) @foo3()
147 tail call void(...) @foo4()
150 tail call void(...) @foo5()
153 tail call void(...) @foo1()
156 tail call void(...) @foo2()
159 tail call void(...) @foo6()
162 tail call void(...) @foo3()
165 tail call void(...) @foo4()
168 tail call void(...) @foo5()
171 tail call void(...) @foo6()
175 declare void @foo1(...)
176 declare void @foo2(...)
177 declare void @foo6(...)
178 declare void @foo3(...)
179 declare void @foo4(...)
180 declare void @foo5(...)