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