2009-10-19 03:57:27 +08:00
|
|
|
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -relocation-model=pic -asm-verbose=false -post-RA-scheduler=false | FileCheck %s -check-prefix=LINUX
|
2007-01-13 03:20:47 +08:00
|
|
|
|
2007-01-26 16:25:06 +08:00
|
|
|
@ptr = external global i32*
|
|
|
|
@dst = external global i32
|
|
|
|
@src = external global i32
|
2007-01-13 03:20:47 +08:00
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
define void @test0() nounwind {
|
2007-01-13 03:20:47 +08:00
|
|
|
entry:
|
2007-01-26 16:25:06 +08:00
|
|
|
store i32* @dst, i32** @ptr
|
|
|
|
%tmp.s = load i32* @src
|
|
|
|
store i32 %tmp.s, i32* @dst
|
2007-01-13 03:20:47 +08:00
|
|
|
ret void
|
2009-09-03 14:29:23 +08:00
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: test0:
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll .L0$pb
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX-NEXT: .L0$pb:
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX-NEXT: popl
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L0$pb),
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX: movl dst@GOT(%eax),
|
|
|
|
; LINUX: movl ptr@GOT(%eax),
|
|
|
|
; LINUX: movl src@GOT(%eax),
|
|
|
|
; LINUX: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
@ptr2 = global i32* null
|
|
|
|
@dst2 = global i32 0
|
|
|
|
@src2 = global i32 0
|
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
define void @test1() nounwind {
|
2009-09-03 14:29:23 +08:00
|
|
|
entry:
|
|
|
|
store i32* @dst2, i32** @ptr2
|
|
|
|
%tmp.s = load i32* @src2
|
|
|
|
store i32 %tmp.s, i32* @dst2
|
|
|
|
ret void
|
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: test1:
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll .L1$pb
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX-NEXT: .L1$pb:
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX-NEXT: popl
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L1$pb), %eax
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX: movl dst2@GOT(%eax),
|
|
|
|
; LINUX: movl ptr2@GOT(%eax),
|
|
|
|
; LINUX: movl src2@GOT(%eax),
|
|
|
|
; LINUX: ret
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i8* @malloc(i32)
|
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
define void @test2() nounwind {
|
2009-09-03 14:29:23 +08:00
|
|
|
entry:
|
|
|
|
%ptr = call i8* @malloc(i32 40)
|
|
|
|
ret void
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: test2:
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX: pushl %ebx
|
|
|
|
; LINUX-NEXT: subl $8, %esp
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX-NEXT: calll .L2$pb
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX-NEXT: .L2$pb:
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX-NEXT: popl %ebx
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L2$pb), %ebx
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX: movl $40, (%esp)
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll malloc@PLT
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX: addl $8, %esp
|
|
|
|
; LINUX: popl %ebx
|
|
|
|
; LINUX: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
@pfoo = external global void(...)*
|
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
define void @test3() nounwind {
|
2009-09-03 14:29:23 +08:00
|
|
|
entry:
|
|
|
|
%tmp = call void(...)*(...)* @afoo()
|
|
|
|
store void(...)* %tmp, void(...)** @pfoo
|
|
|
|
%tmp1 = load void(...)** @pfoo
|
|
|
|
call void(...)* %tmp1()
|
|
|
|
ret void
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: test3:
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll .L3$pb
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX-NEXT: .L3$pb:
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX: popl
|
2010-07-07 04:31:51 +08:00
|
|
|
; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L3$pb), %[[REG3:e..]]
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll afoo@PLT
|
2011-04-27 05:31:35 +08:00
|
|
|
; LINUX: movl pfoo@GOT(%[[REG3]]),
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll *
|
2009-09-03 14:29:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare void(...)* @afoo(...)
|
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
define void @test4() nounwind {
|
2009-09-03 14:29:23 +08:00
|
|
|
entry:
|
|
|
|
call void(...)* @foo()
|
|
|
|
ret void
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: test4:
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll .L4$pb
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX: popl %ebx
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L4$pb), %ebx
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll foo@PLT
|
2009-09-03 14:29:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare void @foo(...)
|
|
|
|
|
|
|
|
|
|
|
|
@ptr6 = internal global i32* null
|
|
|
|
@dst6 = internal global i32 0
|
|
|
|
@src6 = internal global i32 0
|
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
define void @test5() nounwind {
|
2009-09-03 14:29:23 +08:00
|
|
|
entry:
|
|
|
|
store i32* @dst6, i32** @ptr6
|
|
|
|
%tmp.s = load i32* @src6
|
|
|
|
store i32 %tmp.s, i32* @dst6
|
|
|
|
ret void
|
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: test5:
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll .L5$pb
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX-NEXT: .L5$pb:
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX-NEXT: popl %eax
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L5$pb), %eax
|
2009-09-03 14:29:23 +08:00
|
|
|
; LINUX: leal dst6@GOTOFF(%eax), %ecx
|
|
|
|
; LINUX: movl %ecx, ptr6@GOTOFF(%eax)
|
|
|
|
; LINUX: movl src6@GOTOFF(%eax), %ecx
|
|
|
|
; LINUX: movl %ecx, dst6@GOTOFF(%eax)
|
|
|
|
; LINUX: ret
|
2007-01-13 03:20:47 +08:00
|
|
|
}
|
|
|
|
|
2009-09-14 02:46:37 +08:00
|
|
|
|
|
|
|
;; Test constant pool references.
|
2010-04-18 00:29:15 +08:00
|
|
|
define double @test6(i32 %a.u) nounwind {
|
2009-09-14 02:46:37 +08:00
|
|
|
entry:
|
|
|
|
%tmp = icmp eq i32 %a.u,0
|
|
|
|
%retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02
|
|
|
|
ret double %retval
|
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: .LCPI6_0:
|
2009-09-14 02:46:37 +08:00
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: test6:
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll .L6$pb
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: .L6$pb:
|
|
|
|
; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L6$pb),
|
|
|
|
; LINUX: fldl .LCPI6_0@GOTOFF(
|
2009-09-14 02:46:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
;; Test jump table references.
|
2010-04-18 00:29:15 +08:00
|
|
|
define void @test7(i32 %n.u) nounwind {
|
2009-09-14 02:46:37 +08:00
|
|
|
entry:
|
|
|
|
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 ]
|
|
|
|
bb:
|
|
|
|
tail call void(...)* @foo1()
|
|
|
|
ret void
|
|
|
|
bb1:
|
|
|
|
tail call void(...)* @foo2()
|
|
|
|
ret void
|
|
|
|
bb2:
|
|
|
|
tail call void(...)* @foo6()
|
|
|
|
ret void
|
|
|
|
bb3:
|
|
|
|
tail call void(...)* @foo3()
|
|
|
|
ret void
|
|
|
|
bb4:
|
|
|
|
tail call void(...)* @foo4()
|
|
|
|
ret void
|
|
|
|
bb5:
|
|
|
|
tail call void(...)* @foo5()
|
|
|
|
ret void
|
|
|
|
bb6:
|
|
|
|
tail call void(...)* @foo1()
|
|
|
|
ret void
|
|
|
|
bb7:
|
|
|
|
tail call void(...)* @foo2()
|
|
|
|
ret void
|
|
|
|
bb8:
|
|
|
|
tail call void(...)* @foo6()
|
|
|
|
ret void
|
|
|
|
bb9:
|
|
|
|
tail call void(...)* @foo3()
|
|
|
|
ret void
|
|
|
|
bb10:
|
|
|
|
tail call void(...)* @foo4()
|
|
|
|
ret void
|
|
|
|
bb11:
|
|
|
|
tail call void(...)* @foo5()
|
|
|
|
ret void
|
|
|
|
bb12:
|
|
|
|
tail call void(...)* @foo6()
|
|
|
|
ret void
|
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: test7:
|
2010-09-22 13:49:14 +08:00
|
|
|
; LINUX: calll .L7$pb
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: .L7$pb:
|
|
|
|
; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L7$pb),
|
2010-06-22 06:17:20 +08:00
|
|
|
; LINUX: .LJTI7_0@GOTOFF(
|
2010-01-27 14:25:16 +08:00
|
|
|
; LINUX: jmpl *
|
2009-09-14 02:46:37 +08:00
|
|
|
|
2010-04-18 00:29:15 +08:00
|
|
|
; LINUX: .LJTI7_0:
|
|
|
|
; LINUX: .long .LBB7_2@GOTOFF
|
|
|
|
; LINUX: .long .LBB7_8@GOTOFF
|
|
|
|
; LINUX: .long .LBB7_14@GOTOFF
|
|
|
|
; LINUX: .long .LBB7_9@GOTOFF
|
|
|
|
; LINUX: .long .LBB7_10@GOTOFF
|
2009-09-14 02:46:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare void @foo1(...)
|
|
|
|
declare void @foo2(...)
|
|
|
|
declare void @foo6(...)
|
|
|
|
declare void @foo3(...)
|
|
|
|
declare void @foo4(...)
|
|
|
|
declare void @foo5(...)
|