File: fast-isel-call.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (85 lines) | stat: -rw-r--r-- 2,264 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
; RUN: llc < %s -O0 -fast-isel-abort=1 -mtriple=i686-apple-darwin8 2>/dev/null | FileCheck %s
; RUN: llc < %s -O0 -fast-isel-abort=1 -mtriple=i686-apple-darwin8 2>&1 >/dev/null | FileCheck -check-prefix=STDERR -allow-empty %s

%struct.s = type {i32, i32, i32}

define i32 @test1() nounwind {
tak:
	%tmp = call i1 @foo()
	br i1 %tmp, label %BB1, label %BB2
BB1:
	ret i32 1
BB2:
	ret i32 0
; CHECK-LABEL: test1:
; CHECK: calll
; CHECK-NEXT: testb	$1
}
declare zeroext i1 @foo()  nounwind

declare void @foo2(ptr byval(%struct.s))

define void @test2(ptr %d) nounwind {
  call void @foo2(ptr byval(%struct.s) %d )
  ret void
; CHECK-LABEL: test2:
; CHECK: movl	(%eax), %ecx
; CHECK: movl	%ecx, (%esp)
; CHECK: movl	4(%eax), %ecx
; CHECK: movl	%ecx, 4(%esp)
; CHECK: movl	8(%eax), %eax
; CHECK: movl	%eax, 8(%esp)
}

declare void @llvm.memset.p0.i32(ptr nocapture, i8, i32, i1) nounwind

define void @test3(ptr %a) {
  call void @llvm.memset.p0.i32(ptr %a, i8 0, i32 100, i1 false)
  ret void
; CHECK-LABEL: test3:
; CHECK:   movl	{{.*}}, (%esp)
; CHECK:   movl	$0, 4(%esp)
; CHECK:   movl	$100, 8(%esp)
; CHECK:   calll {{.*}}memset
}

declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind

define void @test4(ptr %a, ptr %b) {
  call void @llvm.memcpy.p0.p0.i32(ptr %a, ptr %b, i32 100, i1 false)
  ret void
; CHECK-LABEL: test4:
; CHECK:   movl	{{.*}}, (%esp)
; CHECK:   movl	{{.*}}, 4(%esp)
; CHECK:   movl	$100, 8(%esp)
; CHECK:   calll {{.*}}memcpy
}

; STDERR-NOT: FastISel missed call:   call x86_thiscallcc void @thiscallfun
%struct.S = type { i8 }
define void @test5() {
entry:
  %s = alloca %struct.S, align 8
; CHECK-LABEL: test5:
; CHECK: subl $12, %esp
; CHECK: leal 8(%esp), %ecx
; CHECK: movl $43, (%esp)
; CHECK: calll {{.*}}thiscallfun
; CHECK: addl $8, %esp
  call x86_thiscallcc void @thiscallfun(ptr %s, i32 43)
  ret void
}
declare x86_thiscallcc void @thiscallfun(ptr, i32) #1

; STDERR-NOT: FastISel missed call:   call x86_stdcallcc void @stdcallfun
define void @test6() {
entry:
; CHECK-LABEL: test6:
; CHECK: subl $12, %esp
; CHECK: movl $43, (%esp)
; CHECK: calll {{.*}}stdcallfun
; CHECK: addl $8, %esp
  call x86_stdcallcc void @stdcallfun(i32 43)
  ret void
}
declare x86_stdcallcc void @stdcallfun(i32) #1