Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: test/NaCl/X86/nacl-calls.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/NaCl/X86/llc-malign-double.ll ('k') | test/NaCl/X86/nacl-read-tp-intrinsic.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; RUN: pnacl-llc -mtriple=i686-unknown-nacl -filetype=asm %s -o - \
2 ; RUN: | FileCheck %s --check-prefix=NACL32
3 ; RUN: pnacl-llc -mtriple=i686-unknown-nacl -filetype=asm -O0 %s -o - \
4 ; RUN: | FileCheck %s --check-prefix=NACL32O0
5 ; RUN: pnacl-llc -mtriple=x86_64-unknown-nacl -filetype=asm %s -o - \
6 ; RUN: | FileCheck %s --check-prefix=NACL64
7 ; RUN: pnacl-llc -mtriple=x86_64-unknown-nacl -filetype=asm -O0 %s -o - \
8 ; RUN: | FileCheck %s --check-prefix=NACL64
9
10 ;;;;
11 ; Call to a NaCl trampoline (specific addresses).
12 define i32 @call_address() {
13 entry:
14 call void inttoptr (i32 66496 to void ()*)()
15 ret i32 0
16 }
17 ; NACL32-LABEL: call_address
18 ; NACL32: calll 66496
19 ; NACL32O0-LABEL: call_address
20 ; NACL32O0: movl $66496, [[REG:%[a-z0-9]+]]
21 ; NACL32O0: naclcall {{.*}}[[REG]]
22 ; NACL64-LABEL: call_address
23 ; NACL64: movl $66496, %{{.*}}
24 ; NACL64: naclcall %{{.*}},%r15
25
26 define fastcc i32 @tail_call_address(i32 %arg) {
27 entry:
28 %call1 = tail call fastcc i32 inttoptr (i32 66496 to i32 (i32)*)(i32 %arg)
29 ret i32 %call1
30 }
31 ; NACL32-LABEL: tail_call_address
32 ; NACL32: movl $66496, [[REG:%[a-z0-9]+]]
33 ; NACL32: nacljmp {{.*}}[[REG]]
34 ; NACL32O0-LABEL: tail_call_address
35 ; NACL32O0: movl $66496, [[REG:%[a-z0-9]+]]
36 ; NACL32O0: nacljmp {{.*}}[[REG]]
37 ; NACL64-LABEL: tail_call_address
38 ; NACL64: movl $66496, %{{.*}}
39 ; NACL64: nacljmp %{{.*}}, %r15
40
41
42 ;;;;;
43 ; Call to another function (external/internal), directly.
44
45 declare void @other_function()
46
47 define internal void @call_other_function() {
48 call void @other_function()
49 ret void
50 }
51
52 define void @call_other_function2() {
53 call void @call_other_function()
54 ret void
55 }
56 ; NACL32-LABEL: call_other_function
57 ; NACL32: calll other_function
58 ; NACL32-LABEL: call_other_function2
59 ; NACL32: calll call_other_function
60 ; NACL32O0-LABEL: call_other_function
61 ; NACL32O0: calll other_function
62 ; NACL64-LABEL: call_other_function
63 ; NACL64: callq other_function
64 ; NACL64-LABEL: call_other_function2
65 ; NACL64: callq call_other_function
66
67
68 declare fastcc i32 @other_function_fast()
69
70 define internal fastcc i32 @tail_call_other_function() {
71 %i = tail call fastcc i32 @other_function_fast()
72 ret i32 %i
73 }
74
75 define fastcc i32 @tail_call_other_function2() {
76 %i = tail call fastcc i32 @tail_call_other_function()
77 ret i32 %i
78 }
79 ; NACL32-LABEL: tail_call_other_function
80 ; NACL32: jmp other_function_fast
81 ; NACL32-LABEL: tail_call_other_function2
82 ; NACL32: jmp tail_call_other_function
83 ; NACL32O0-LABEL: tail_call_other_function
84 ; NACL32O0: jmp other_function_fast
85 ; NACL32O0-LABEL: tail_call_other_function2
86 ; NACL32O0: jmp tail_call_other_function
87 ; NACL64-LABEL: tail_call_other_function
88 ; NACL64: jmp other_function_fast
89 ; NACL64-LABEL: tail_call_other_function2
90 ; NACL64: jmp tail_call_other_function
91
92 ;;;;;
93 ; Indirect call, but not a specific address.
94
95 @fp = external global i32 (i32)*
96
97 ; With a load.
98 define i32 @call_indirect() {
99 %1 = load i32 (i32)** @fp, align 4
100 %call1 = call i32 %1(i32 10)
101 ret i32 %call1
102 }
103 ; NACL32-LABEL: call_indirect
104 ; NACL32: movl fp, [[REG:%[a-z0-9]+]]
105 ; NACL32: naclcall {{.*}}[[REG]]
106 ; NACL32O0-LABEL: call_indirect
107 ; NACL32O0: movl fp, [[REG:%[a-z0-9]+]]
108 ; NACL32O0: naclcall {{.*}}[[REG]]
109 ; NACL64-LABEL: call_indirect
110 ; NACL64: movl fp({{.*}}), %{{.*}}
111 ; NACL64: naclcall %{{.*}},%r15
112
113 define fastcc i32 @tail_call_indirect() {
114 %1 = load i32 (i32)** @fp, align 4
115 %call1 = tail call fastcc i32 %1(i32 10)
116 ret i32 %call1
117 }
118 ; NACL32-LABEL: tail_call_indirect
119 ; NACL32: movl fp, [[REG:%[a-z0-9]+]]
120 ; NACL32: nacljmp {{.*}}[[REG]]
121 ; NACL32O0-LABEL: tail_call_indirect
122 ; NACL32O0: movl fp, [[REG:%[a-z0-9]+]]
123 ; NACL32O0: nacljmp {{.*}}[[REG]]
124 ; NACL64-LABEL: tail_call_indirect
125 ; NACL64: movl fp({{.*}}), %{{.*}}
126 ; NACL64: nacljmp %{{.*}}, %r15
127
128 ; "Without" a load (may load from stack on x86-32 still).
129 define i32 @call_indirect_arg(i32 ()* %argfp) {
130 %call1 = call i32 %argfp()
131 ret i32 %call1
132 }
133 ; NACL32-LABEL: call_indirect_arg
134 ; NACL32: naclcall {{%[a-z0-9]+}}
135 ; NACL32O0-LABEL: call_indirect_arg
136 ; NACL32O0: naclcall {{%[a-z0-9]+}}
137 ; NACL64-LABEL: call_indirect_arg
138 ; NACL64: naclcall {{%[a-z0-9]+}},%r15
139
140 define fastcc i32 @tail_call_indirect_arg(i32 ()* %argfp) {
141 %call1 = tail call fastcc i32 %argfp()
142 ret i32 %call1
143 }
144 ; NACL32-LABEL: tail_call_indirect_arg
145 ; NACL32: nacljmp {{%[a-z0-9]+}}
146 ; NACL32O0-LABEL: tail_call_indirect_arg
147 ; NACL32O0: nacljmp {{%[a-z0-9]+}}
148 ; NACL64-LABEL: tail_call_indirect_arg
149 ; NACL64: nacljmp {{%[a-z0-9]+}}, %r15
OLDNEW
« no previous file with comments | « test/NaCl/X86/llc-malign-double.ll ('k') | test/NaCl/X86/nacl-read-tp-intrinsic.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698