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=medium -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: move.l #dst, ptr
14 ; CHECK-NEXT: move.l src, dst
17 store i32* @dst, i32** @ptr
18 %tmp.s = load i32, i32* @src
19 store i32 %tmp.s, i32* @dst
23 @ptr2 = global i32* 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 i32* @dst2, i32** @ptr2
35 %tmp.s = load i32, i32* @src2
36 store i32 %tmp.s, i32* @dst2
40 declare i8* @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@PLT
48 ; CHECK-NEXT: adda.l #4, %sp
51 %ptr = call i8* @malloc(i32 40)
55 @pfoo = external global void(...)*
56 declare void(...)* @afoo(...)
59 define void @test3() nounwind {
61 ; CHECK: ; %bb.0: ; %entry
62 ; CHECK-NEXT: suba.l #4, %sp
63 ; CHECK-NEXT: jsr afoo@PLT
64 ; CHECK-NEXT: move.l %d0, %a0
65 ; CHECK-NEXT: move.l %a0, pfoo
66 ; CHECK-NEXT: jsr (%a0)
67 ; CHECK-NEXT: adda.l #4, %sp
70 %tmp = call void(...)*(...) @afoo()
71 store void(...)* %tmp, void(...)** @pfoo
72 %tmp1 = load void(...)*, void(...)** @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
83 ; CHECK-NEXT: jsr foo@PLT
84 ; CHECK-NEXT: adda.l #4, %sp
91 @ptr6 = internal global i32* 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: move.l #dst6, ptr6
99 ; CHECK-NEXT: move.l src6, dst6
102 store i32* @dst6, i32** @ptr6
103 %tmp.s = load i32, i32* @src6
104 store i32 %tmp.s, i32* @dst6
108 define void @test7(i32 %n.u) nounwind {
109 ; CHECK-LABEL: test7:
110 ; CHECK: ; %bb.0: ; %entry
111 ; CHECK-NEXT: move.l (4,%sp), %d0
112 ; CHECK-NEXT: add.l #-1, %d0
113 ; CHECK-NEXT: move.l %d0, %d1
114 ; CHECK-NEXT: sub.l #12, %d1
115 ; CHECK-NEXT: bhi .LBB6_12
116 ; CHECK-NEXT: ; %bb.1: ; %entry
117 ; CHECK-NEXT: lsl.l #2, %d0
118 ; CHECK-NEXT: move.l #.LJTI6_0, %a0
119 ; CHECK-NEXT: move.l (0,%a0,%d0), %a0
120 ; CHECK-NEXT: jmp (%a0)
121 ; CHECK-NEXT: .LBB6_12: ; %bb2
122 ; CHECK-NEXT: bra foo6@PLT ; TAILCALL
123 ; CHECK-NEXT: .LBB6_3: ; %bb6
124 ; CHECK-NEXT: bra foo1@PLT ; TAILCALL
125 ; CHECK-NEXT: .LBB6_8: ; %bb1
126 ; CHECK-NEXT: bra foo2@PLT ; TAILCALL
127 ; CHECK-NEXT: .LBB6_9: ; %bb3
128 ; CHECK-NEXT: bra foo3@PLT ; TAILCALL
129 ; CHECK-NEXT: .LBB6_10: ; %bb4
130 ; CHECK-NEXT: bra foo4@PLT ; TAILCALL
131 ; CHECK-NEXT: .LBB6_14: ; %bb11
132 ; CHECK-NEXT: bra foo5@PLT ; TAILCALL
134 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 ]
136 tail call void(...) @foo1()
139 tail call void(...) @foo2()
142 tail call void(...) @foo6()
145 tail call void(...) @foo3()
148 tail call void(...) @foo4()
151 tail call void(...) @foo5()
154 tail call void(...) @foo1()
157 tail call void(...) @foo2()
160 tail call void(...) @foo6()
163 tail call void(...) @foo3()
166 tail call void(...) @foo4()
169 tail call void(...) @foo5()
172 tail call void(...) @foo6()
176 declare void @foo1(...)
177 declare void @foo2(...)
178 declare void @foo6(...)
179 declare void @foo3(...)
180 declare void @foo4(...)
181 declare void @foo5(...)