Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -O0 -fast-isel-abort=1 -march=x86 -mtriple=i686-apple-darwin8 2>/dev/null | FileCheck %s
      2 ; RUN: llc < %s -O0 -fast-isel-abort=1 -march=x86 -mtriple=i686-apple-darwin8 2>&1 >/dev/null | FileCheck -check-prefix=STDERR -allow-empty %s
      3 
      4 %struct.s = type {i32, i32, i32}
      5 
      6 define i32 @test1() nounwind {
      7 tak:
      8 	%tmp = call i1 @foo()
      9 	br i1 %tmp, label %BB1, label %BB2
     10 BB1:
     11 	ret i32 1
     12 BB2:
     13 	ret i32 0
     14 ; CHECK-LABEL: test1:
     15 ; CHECK: calll
     16 ; CHECK-NEXT: testb	$1
     17 }
     18 declare zeroext i1 @foo()  nounwind
     19 
     20 declare void @foo2(%struct.s* byval)
     21 
     22 define void @test2(%struct.s* %d) nounwind {
     23   call void @foo2(%struct.s* byval %d )
     24   ret void
     25 ; CHECK-LABEL: test2:
     26 ; CHECK: movl	(%eax), %ecx
     27 ; CHECK: movl	%ecx, (%esp)
     28 ; CHECK: movl	4(%eax), %ecx
     29 ; CHECK: movl	%ecx, 4(%esp)
     30 ; CHECK: movl	8(%eax), %eax
     31 ; CHECK: movl	%eax, 8(%esp)
     32 }
     33 
     34 declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
     35 
     36 define void @test3(i8* %a) {
     37   call void @llvm.memset.p0i8.i32(i8* %a, i8 0, i32 100, i32 1, i1 false)
     38   ret void
     39 ; CHECK-LABEL: test3:
     40 ; CHECK:   movl	{{.*}}, (%esp)
     41 ; CHECK:   movl	$0, 4(%esp)
     42 ; CHECK:   movl	$100, 8(%esp)
     43 ; CHECK:   calll {{.*}}memset
     44 }
     45 
     46 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
     47 
     48 define void @test4(i8* %a, i8* %b) {
     49   call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %b, i32 100, i32 1, i1 false)
     50   ret void
     51 ; CHECK-LABEL: test4:
     52 ; CHECK:   movl	{{.*}}, (%esp)
     53 ; CHECK:   movl	{{.*}}, 4(%esp)
     54 ; CHECK:   movl	$100, 8(%esp)
     55 ; CHECK:   calll {{.*}}memcpy
     56 }
     57 
     58 ; STDERR-NOT: FastISel missed call:   call x86_thiscallcc void @thiscallfun
     59 %struct.S = type { i8 }
     60 define void @test5() {
     61 entry:
     62   %s = alloca %struct.S, align 1
     63 ; CHECK-LABEL: test5:
     64 ; CHECK: subl $12, %esp
     65 ; CHECK: leal 8(%esp), %ecx
     66 ; CHECK: movl $43, (%esp)
     67 ; CHECK: calll {{.*}}thiscallfun
     68 ; CHECK: addl $8, %esp
     69   call x86_thiscallcc void @thiscallfun(%struct.S* %s, i32 43)
     70   ret void
     71 }
     72 declare x86_thiscallcc void @thiscallfun(%struct.S*, i32) #1
     73 
     74 ; STDERR-NOT: FastISel missed call:   call x86_stdcallcc void @stdcallfun
     75 define void @test6() {
     76 entry:
     77 ; CHECK-LABEL: test6:
     78 ; CHECK: subl $12, %esp
     79 ; CHECK: movl $43, (%esp)
     80 ; CHECK: calll {{.*}}stdcallfun
     81 ; CHECK: addl $8, %esp
     82   call x86_stdcallcc void @stdcallfun(i32 43)
     83   ret void
     84 }
     85 declare x86_stdcallcc void @stdcallfun(i32) #1
     86