1 ; RUN: llc < %s -O0 -fast-isel-abort=1 -mtriple=i686-apple-darwin8 2>/dev/null | FileCheck %s
2 ; RUN: llc < %s -O0 -fast-isel-abort=1 -mtriple=i686-apple-darwin8 2>&1 >/dev/null | FileCheck -check-prefix=STDERR -allow-empty %s
3 ; RUN: llc < %s -O0 -fast-isel-abort=1 -mtriple=i686 2>/dev/null | FileCheck %s --check-prefix=ELF
5 %struct.s = type {i32, i32, i32}
7 define i32 @test1() nounwind {
10 br i1 %tmp, label %BB1, label %BB2
17 ; CHECK-NEXT: testb $1
19 declare zeroext i1 @foo() nounwind
21 declare void @foo2(ptr byval(%struct.s))
23 define void @test2(ptr %d) nounwind {
24 call void @foo2(ptr byval(%struct.s) %d )
27 ; CHECK: movl (%eax), %ecx
28 ; CHECK: movl %ecx, (%esp)
29 ; CHECK: movl 4(%eax), %ecx
30 ; CHECK: movl %ecx, 4(%esp)
31 ; CHECK: movl 8(%eax), %eax
32 ; CHECK: movl %eax, 8(%esp)
35 declare void @llvm.memset.p0.i32(ptr nocapture, i8, i32, i1) nounwind
37 define void @test3(ptr %a) {
38 call void @llvm.memset.p0.i32(ptr %a, i8 0, i32 100, i1 false)
41 ; CHECK: movl {{.*}}, (%esp)
42 ; CHECK: movl $0, 4(%esp)
43 ; CHECK: movl $100, 8(%esp)
44 ; CHECK: calll {{.*}}memset
47 ; ELF: calll memset{{$}}
50 declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
52 define void @test4(ptr %a, ptr %b) {
53 call void @llvm.memcpy.p0.p0.i32(ptr %a, ptr %b, i32 100, i1 false)
56 ; CHECK: movl {{.*}}, (%esp)
57 ; CHECK: movl {{.*}}, 4(%esp)
58 ; CHECK: movl $100, 8(%esp)
59 ; CHECK: calll {{.*}}memcpy
62 ; ELF: calll memcpy{{$}}
65 ; STDERR-NOT: FastISel missed call: call x86_thiscallcc void @thiscallfun
66 %struct.S = type { i8 }
67 define void @test5() {
69 %s = alloca %struct.S, align 8
71 ; CHECK: subl $12, %esp
72 ; CHECK: leal 8(%esp), %ecx
73 ; CHECK: movl $43, (%esp)
74 ; CHECK: calll {{.*}}thiscallfun
75 ; CHECK: addl $8, %esp
76 call x86_thiscallcc void @thiscallfun(ptr %s, i32 43)
79 declare x86_thiscallcc void @thiscallfun(ptr, i32) #1
81 ; STDERR-NOT: FastISel missed call: call x86_stdcallcc void @stdcallfun
82 define void @test6() {
85 ; CHECK: subl $12, %esp
86 ; CHECK: movl $43, (%esp)
87 ; CHECK: calll {{.*}}stdcallfun
88 ; CHECK: addl $8, %esp
89 call x86_stdcallcc void @stdcallfun(i32 43)
92 declare x86_stdcallcc void @stdcallfun(i32) #1