1 ; RUN: llc -fast-isel -O0 -mcpu=generic -mtriple=i386-apple-darwin10 -relocation-model=pic < %s | FileCheck %s
2 ; RUN: llc -fast-isel -O0 -mcpu=generic -mtriple=i386-apple-darwin10 -relocation-model=pic < %s -pass-remarks-missed=isel 2>&1 >/dev/null | FileCheck -check-prefix=STDERR -allow-empty %s
4 ; This should use flds to set the return value.
8 @G = external global float
9 define float @test0() nounwind {
10 %t = load float, float* @G
14 ; This should pop 4 bytes on return.
17 define void @test1({i32, i32, i32, i32}* sret %p) nounwind {
18 store {i32, i32, i32, i32} zeroinitializer, {i32, i32, i32, i32}* %p
22 ; This should pop 8 bytes on return.
23 ; CHECK-LABEL: thiscallfun:
25 define x86_thiscallcc i32 @thiscallfun(i32* %this, i32 %a, i32 %b) nounwind {
26 ; STDERR-NOT: FastISel missed terminator: ret i32 12345
30 ; Here, the callee pop doesn't fit the 16 bit immediate -- see x86-big-ret.ll
31 ; This checks that -fast-isel doesn't miscompile this.
32 ; CHECK-LABEL: thiscall_large:
34 ; CHECK-NEXT: addl $65536, %esp
35 ; CHECK-NEXT: pushl %ecx
37 define x86_thiscallcc void @thiscall_large(i32* %this, [65533 x i8]* byval %b) nounwind {
41 ; This should pop 4 bytes on return.
42 ; CHECK-LABEL: stdcallfun:
44 define x86_stdcallcc i32 @stdcallfun(i32 %a) nounwind {
45 ; STDERR-NOT: FastISel missed terminator: ret i32 54321
49 ; Properly initialize the pic base.
52 ; CHECK: call{{.*}}L5$pb
57 @HHH = external global i32
58 define i32 @test2() nounwind {
59 %t = load i32, i32* @HHH
63 ; Check that we fast-isel sret, and handle the callee-pops behavior correctly.
64 %struct.a = type { i64, i64, i64 }
65 define void @test3() nounwind ssp {
67 %tmp = alloca %struct.a, align 8
68 call void @test3sret(%struct.a* sret %tmp)
72 ; CHECK: leal 16(%esp)
73 ; CHECK: calll _test3sret
76 declare void @test3sret(%struct.a* sret)
78 ; Check that fast-isel sret works with fastcc (and does not callee-pop)
79 define void @test4() nounwind ssp {
81 %tmp = alloca %struct.a, align 8
82 call fastcc void @test4fastccsret(%struct.a* sret %tmp)
86 ; CHECK: movl %esp, %ecx
87 ; CHECK: calll _test4fastccsret
90 declare fastcc void @test4fastccsret(%struct.a* sret)