llvm.org GIT mirror llvm / 1b1a4b8
Merge r322521 - just regenerates the CHECK lines using the script. Will allow subsequent cherrypicks to be much cleaner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@332928 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 1 year, 5 months ago
1 changed file(s) with 249 addition(s) and 127 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s --check-prefix=CHECK --check-prefix=PUSHF
1 ; RUN: llc < %s -mtriple=x86_64-pc-win32 -mattr=+sahf | FileCheck %s --check-prefix=SAHF
0 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1 ; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s --check-prefix=ALL --check-prefix=PUSHF
2 ; RUN: llc < %s -mtriple=x86_64-pc-win32 -mattr=+sahf | FileCheck %s --check-prefix=ALL --check-prefix=SAHF
23
34 define i32 @f1(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5) "no-frame-pointer-elim"="true" {
4 ; CHECK-LABEL: f1:
5 ; CHECK: movl 48(%rbp), %eax
5 ; ALL-LABEL: f1:
6 ; ALL: # %bb.0:
7 ; ALL-NEXT: pushq %rbp
8 ; ALL-NEXT: .seh_pushreg 5
9 ; ALL-NEXT: movq %rsp, %rbp
10 ; ALL-NEXT: .seh_setframe 5, 0
11 ; ALL-NEXT: .seh_endprologue
12 ; ALL-NEXT: movl 48(%rbp), %eax
13 ; ALL-NEXT: popq %rbp
14 ; ALL-NEXT: retq
15 ; ALL-NEXT: .seh_handlerdata
16 ; ALL-NEXT: .text
17 ; ALL-NEXT: .seh_endproc
618 ret i32 %p5
719 }
820
921 define void @f2(i32 %p, ...) "no-frame-pointer-elim"="true" {
10 ; CHECK-LABEL: f2:
11 ; CHECK: .seh_stackalloc 8
12 ; CHECK: movq %rsp, %rbp
13 ; CHECK: .seh_setframe 5, 0
14 ; CHECK: movq %rdx, 32(%rbp)
15 ; CHECK: leaq 32(%rbp), %rax
22 ; ALL-LABEL: f2:
23 ; ALL: # %bb.0:
24 ; ALL-NEXT: pushq %rbp
25 ; ALL-NEXT: .seh_pushreg 5
26 ; ALL-NEXT: pushq %rax
27 ; ALL-NEXT: .seh_stackalloc 8
28 ; ALL-NEXT: movq %rsp, %rbp
29 ; ALL-NEXT: .seh_setframe 5, 0
30 ; ALL-NEXT: .seh_endprologue
31 ; ALL-NEXT: movq %r9, 48(%rbp)
32 ; ALL-NEXT: movq %r8, 40(%rbp)
33 ; ALL-NEXT: movq %rdx, 32(%rbp)
34 ; ALL-NEXT: leaq 32(%rbp), %rax
35 ; ALL-NEXT: movq %rax, (%rbp)
36 ; ALL-NEXT: addq $8, %rsp
37 ; ALL-NEXT: popq %rbp
38 ; ALL-NEXT: retq
39 ; ALL-NEXT: .seh_handlerdata
40 ; ALL-NEXT: .text
41 ; ALL-NEXT: .seh_endproc
1642 %ap = alloca i8, align 8
1743 call void @llvm.va_start(i8* %ap)
1844 ret void
1945 }
2046
2147 define i8* @f3() "no-frame-pointer-elim"="true" {
22 ; CHECK-LABEL: f3:
23 ; CHECK: movq %rsp, %rbp
24 ; CHECK: .seh_setframe 5, 0
25 ; CHECK: movq 8(%rbp), %rax
48 ; ALL-LABEL: f3:
49 ; ALL: # %bb.0:
50 ; ALL-NEXT: pushq %rbp
51 ; ALL-NEXT: .seh_pushreg 5
52 ; ALL-NEXT: movq %rsp, %rbp
53 ; ALL-NEXT: .seh_setframe 5, 0
54 ; ALL-NEXT: .seh_endprologue
55 ; ALL-NEXT: movq 8(%rbp), %rax
56 ; ALL-NEXT: popq %rbp
57 ; ALL-NEXT: retq
58 ; ALL-NEXT: .seh_handlerdata
59 ; ALL-NEXT: .text
60 ; ALL-NEXT: .seh_endproc
2661 %ra = call i8* @llvm.returnaddress(i32 0)
2762 ret i8* %ra
2863 }
2964
3065 define i8* @f4() "no-frame-pointer-elim"="true" {
31 ; CHECK-LABEL: f4:
32 ; CHECK: pushq %rbp
33 ; CHECK: .seh_pushreg 5
34 ; CHECK: subq $304, %rsp
35 ; CHECK: .seh_stackalloc 304
36 ; CHECK: leaq 128(%rsp), %rbp
37 ; CHECK: .seh_setframe 5, 128
38 ; CHECK: .seh_endprologue
39 ; CHECK: movq 184(%rbp), %rax
66 ; ALL-LABEL: f4:
67 ; ALL: # %bb.0:
68 ; ALL-NEXT: pushq %rbp
69 ; ALL-NEXT: .seh_pushreg 5
70 ; ALL-NEXT: subq $304, %rsp # imm = 0x130
71 ; ALL-NEXT: .seh_stackalloc 304
72 ; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
73 ; ALL-NEXT: .seh_setframe 5, 128
74 ; ALL-NEXT: .seh_endprologue
75 ; ALL-NEXT: movq 184(%rbp), %rax
76 ; ALL-NEXT: addq $304, %rsp # imm = 0x130
77 ; ALL-NEXT: popq %rbp
78 ; ALL-NEXT: retq
79 ; ALL-NEXT: .seh_handlerdata
80 ; ALL-NEXT: .text
81 ; ALL-NEXT: .seh_endproc
4082 alloca [300 x i8]
4183 %ra = call i8* @llvm.returnaddress(i32 0)
4284 ret i8* %ra
4587 declare void @external(i8*)
4688
4789 define void @f5() "no-frame-pointer-elim"="true" {
48 ; CHECK-LABEL: f5:
49 ; CHECK: subq $336, %rsp
50 ; CHECK: .seh_stackalloc 336
51 ; CHECK: leaq 128(%rsp), %rbp
52 ; CHECK: .seh_setframe 5, 128
53 ; CHECK: leaq -92(%rbp), %rcx
54 ; CHECK: callq external
90 ; ALL-LABEL: f5:
91 ; ALL: # %bb.0:
92 ; ALL-NEXT: pushq %rbp
93 ; ALL-NEXT: .seh_pushreg 5
94 ; ALL-NEXT: subq $336, %rsp # imm = 0x150
95 ; ALL-NEXT: .seh_stackalloc 336
96 ; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
97 ; ALL-NEXT: .seh_setframe 5, 128
98 ; ALL-NEXT: .seh_endprologue
99 ; ALL-NEXT: leaq -92(%rbp), %rcx
100 ; ALL-NEXT: callq external
101 ; ALL-NEXT: nop
102 ; ALL-NEXT: addq $336, %rsp # imm = 0x150
103 ; ALL-NEXT: popq %rbp
104 ; ALL-NEXT: retq
105 ; ALL-NEXT: .seh_handlerdata
106 ; ALL-NEXT: .text
107 ; ALL-NEXT: .seh_endproc
55108 %a = alloca [300 x i8]
56109 %gep = getelementptr [300 x i8], [300 x i8]* %a, i32 0, i32 0
57110 call void @external(i8* %gep)
59112 }
60113
61114 define void @f6(i32 %p, ...) "no-frame-pointer-elim"="true" {
62 ; CHECK-LABEL: f6:
63 ; CHECK: subq $336, %rsp
64 ; CHECK: .seh_stackalloc 336
65 ; CHECK: leaq 128(%rsp), %rbp
66 ; CHECK: .seh_setframe 5, 128
67 ; CHECK: leaq -92(%rbp), %rcx
68 ; CHECK: callq external
115 ; ALL-LABEL: f6:
116 ; ALL: # %bb.0:
117 ; ALL-NEXT: pushq %rbp
118 ; ALL-NEXT: .seh_pushreg 5
119 ; ALL-NEXT: subq $336, %rsp # imm = 0x150
120 ; ALL-NEXT: .seh_stackalloc 336
121 ; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
122 ; ALL-NEXT: .seh_setframe 5, 128
123 ; ALL-NEXT: .seh_endprologue
124 ; ALL-NEXT: leaq -92(%rbp), %rcx
125 ; ALL-NEXT: callq external
126 ; ALL-NEXT: nop
127 ; ALL-NEXT: addq $336, %rsp # imm = 0x150
128 ; ALL-NEXT: popq %rbp
129 ; ALL-NEXT: retq
130 ; ALL-NEXT: .seh_handlerdata
131 ; ALL-NEXT: .text
132 ; ALL-NEXT: .seh_endproc
69133 %a = alloca [300 x i8]
70134 %gep = getelementptr [300 x i8], [300 x i8]* %a, i32 0, i32 0
71135 call void @external(i8* %gep)
73137 }
74138
75139 define i32 @f7(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) "no-frame-pointer-elim"="true" {
76 ; CHECK-LABEL: f7:
77 ; CHECK: pushq %rbp
78 ; CHECK: .seh_pushreg 5
79 ; CHECK: subq $304, %rsp
80 ; CHECK: .seh_stackalloc 304
81 ; CHECK: leaq 128(%rsp), %rbp
82 ; CHECK: .seh_setframe 5, 128
83 ; CHECK: andq $-64, %rsp
84 ; CHECK: movl 224(%rbp), %eax
85 ; CHECK: leaq 176(%rbp), %rsp
140 ; ALL-LABEL: f7:
141 ; ALL: # %bb.0:
142 ; ALL-NEXT: pushq %rbp
143 ; ALL-NEXT: .seh_pushreg 5
144 ; ALL-NEXT: subq $304, %rsp # imm = 0x130
145 ; ALL-NEXT: .seh_stackalloc 304
146 ; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
147 ; ALL-NEXT: .seh_setframe 5, 128
148 ; ALL-NEXT: .seh_endprologue
149 ; ALL-NEXT: andq $-64, %rsp
150 ; ALL-NEXT: movl 224(%rbp), %eax
151 ; ALL-NEXT: leaq 176(%rbp), %rsp
152 ; ALL-NEXT: popq %rbp
153 ; ALL-NEXT: retq
154 ; ALL-NEXT: .seh_handlerdata
155 ; ALL-NEXT: .text
156 ; ALL-NEXT: .seh_endproc
86157 alloca [300 x i8], align 64
87158 ret i32 %e
88159 }
89160
90161 define i32 @f8(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) "no-frame-pointer-elim"="true" {
91 ; CHECK-LABEL: f8:
92 ; CHECK: subq $352, %rsp
93 ; CHECK: .seh_stackalloc 352
94 ; CHECK: leaq 128(%rsp), %rbp
95 ; CHECK: .seh_setframe 5, 128
96
162 ; ALL-LABEL: f8:
163 ; ALL: # %bb.0:
164 ; ALL-NEXT: pushq %rbp
165 ; ALL-NEXT: .seh_pushreg 5
166 ; ALL-NEXT: pushq %rsi
167 ; ALL-NEXT: .seh_pushreg 6
168 ; ALL-NEXT: pushq %rbx
169 ; ALL-NEXT: .seh_pushreg 3
170 ; ALL-NEXT: subq $352, %rsp # imm = 0x160
171 ; ALL-NEXT: .seh_stackalloc 352
172 ; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
173 ; ALL-NEXT: .seh_setframe 5, 128
174 ; ALL-NEXT: .seh_endprologue
175 ; ALL-NEXT: andq $-64, %rsp
176 ; ALL-NEXT: movq %rsp, %rbx
177 ; ALL-NEXT: movl 288(%rbp), %esi
178 ; ALL-NEXT: movl %ecx, %eax
179 ; ALL-NEXT: leaq 15(,%rax,4), %rcx
180 ; ALL-NEXT: movabsq $34359738352, %rax # imm = 0x7FFFFFFF0
181 ; ALL-NEXT: andq %rcx, %rax
182 ; ALL-NEXT: callq __chkstk
183 ; ALL-NEXT: subq %rax, %rsp
184 ; ALL-NEXT: subq $32, %rsp
185 ; ALL-NEXT: movq %rbx, %rcx
186 ; ALL-NEXT: callq external
187 ; ALL-NEXT: addq $32, %rsp
188 ; ALL-NEXT: movl %esi, %eax
189 ; ALL-NEXT: leaq 224(%rbp), %rsp
190 ; ALL-NEXT: popq %rbx
191 ; ALL-NEXT: popq %rsi
192 ; ALL-NEXT: popq %rbp
193 ; ALL-NEXT: retq
194 ; ALL-NEXT: .seh_handlerdata
195 ; ALL-NEXT: .text
196 ; ALL-NEXT: .seh_endproc
97197 %alloca = alloca [300 x i8], align 64
98 ; CHECK: andq $-64, %rsp
99 ; CHECK: movq %rsp, %rbx
100
101198 alloca i32, i32 %a
102 ; CHECK: movl %ecx, %eax
103 ; CHECK: leaq 15(,%rax,4), %rcx
104 ; CHECK: movabsq $34359738352, %rax
105 ; CHECK: andq %rcx, %rax
106 ; CHECK: callq __chkstk
107 ; CHECK: subq %rax, %rsp
108
109199 %gep = getelementptr [300 x i8], [300 x i8]* %alloca, i32 0, i32 0
110200 call void @external(i8* %gep)
111 ; CHECK: subq $32, %rsp
112 ; CHECK: movq %rbx, %rcx
113 ; CHECK: callq external
114 ; CHECK: addq $32, %rsp
115
116201 ret i32 %e
117 ; CHECK: movl %esi, %eax
118 ; CHECK: leaq 224(%rbp), %rsp
119202 }
120203
121204 define i64 @f9() {
205 ; ALL-LABEL: f9:
206 ; ALL: # %bb.0: # %entry
207 ; ALL-NEXT: pushq %rbp
208 ; ALL-NEXT: .seh_pushreg 5
209 ; ALL-NEXT: movq %rsp, %rbp
210 ; ALL-NEXT: .seh_setframe 5, 0
211 ; ALL-NEXT: .seh_endprologue
212 ; ALL-NEXT: pushfq
213 ; ALL-NEXT: popq %rax
214 ; ALL-NEXT: popq %rbp
215 ; ALL-NEXT: retq
216 ; ALL-NEXT: .seh_handlerdata
217 ; ALL-NEXT: .text
218 ; ALL-NEXT: .seh_endproc
122219 entry:
123 ; CHECK-LABEL: f9:
124 ; CHECK: pushq %rbp
125 ; CHECK: .seh_pushreg 5
126 ; CHECK-NEXT: movq %rsp, %rbp
127 ; CHECK: .seh_setframe 5, 0
128 ; CHECK: .seh_endprologue
129
130220 %call = call i64 @llvm.x86.flags.read.u64()
131 ; CHECK-NEXT: pushfq
132 ; CHECK-NEXT: popq %rax
133
134221 ret i64 %call
135 ; CHECK-NEXT: popq %rbp
136 ; CHECK-NEXT: retq
137222 }
138223
139224 declare i64 @dummy()
140225
141226 define i64 @f10(i64* %foo, i64 %bar, i64 %baz) {
142 ; CHECK-LABEL: f10:
143 ; CHECK: pushq %rbp
144 ; CHECK: .seh_pushreg 5
145 ; CHECK: pushq %rsi
146 ; CHECK: .seh_pushreg 6
147 ; CHECK: pushq %rdi
148 ; CHECK: .seh_pushreg 7
149 ; CHECK: subq $32, %rsp
150 ; CHECK: .seh_stackalloc 32
151 ; CHECK: leaq 32(%rsp), %rbp
152 ; CHECK: .seh_setframe 5, 32
153 ; CHECK: .seh_endprologue
154
227 ; PUSHF-LABEL: f10:
228 ; PUSHF: # %bb.0:
229 ; PUSHF-NEXT: pushq %rbp
230 ; PUSHF-NEXT: .seh_pushreg 5
231 ; PUSHF-NEXT: pushq %rsi
232 ; PUSHF-NEXT: .seh_pushreg 6
233 ; PUSHF-NEXT: pushq %rdi
234 ; PUSHF-NEXT: .seh_pushreg 7
235 ; PUSHF-NEXT: subq $32, %rsp
236 ; PUSHF-NEXT: .seh_stackalloc 32
237 ; PUSHF-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
238 ; PUSHF-NEXT: .seh_setframe 5, 32
239 ; PUSHF-NEXT: .seh_endprologue
240 ; PUSHF-NEXT: movq %rdx, %rsi
241 ; PUSHF-NEXT: movq %rsi, %rax
242 ; PUSHF-NEXT: lock cmpxchgq %r8, (%rcx)
243 ; PUSHF-NEXT: pushfq
244 ; PUSHF-NEXT: popq %rdi
245 ; PUSHF-NEXT: callq dummy
246 ; PUSHF-NEXT: pushq %rdi
247 ; PUSHF-NEXT: popfq
248 ; PUSHF-NEXT: cmovneq %rsi, %rax
249 ; PUSHF-NEXT: addq $32, %rsp
250 ; PUSHF-NEXT: popq %rdi
251 ; PUSHF-NEXT: popq %rsi
252 ; PUSHF-NEXT: popq %rbp
253 ; PUSHF-NEXT: retq
254 ; PUSHF-NEXT: .seh_handlerdata
255 ; PUSHF-NEXT: .text
256 ; PUSHF-NEXT: .seh_endproc
257 ;
258 ; SAHF-LABEL: f10:
259 ; SAHF: # %bb.0:
260 ; SAHF-NEXT: pushq %rbp
261 ; SAHF-NEXT: .seh_pushreg 5
262 ; SAHF-NEXT: pushq %rsi
263 ; SAHF-NEXT: .seh_pushreg 6
264 ; SAHF-NEXT: pushq %rdi
265 ; SAHF-NEXT: .seh_pushreg 7
266 ; SAHF-NEXT: subq $32, %rsp
267 ; SAHF-NEXT: .seh_stackalloc 32
268 ; SAHF-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
269 ; SAHF-NEXT: .seh_setframe 5, 32
270 ; SAHF-NEXT: .seh_endprologue
271 ; SAHF-NEXT: movq %rdx, %rsi
272 ; SAHF-NEXT: movq %rsi, %rax
273 ; SAHF-NEXT: lock cmpxchgq %r8, (%rcx)
274 ; SAHF-NEXT: seto %al
275 ; SAHF-NEXT: lahf
276 ; SAHF-NEXT: movq %rax, %rdi
277 ; SAHF-NEXT: callq dummy
278 ; SAHF-NEXT: pushq %rax
279 ; SAHF-NEXT: movq %rdi, %rax
280 ; SAHF-NEXT: addb $127, %al
281 ; SAHF-NEXT: sahf
282 ; SAHF-NEXT: popq %rax
283 ; SAHF-NEXT: cmovneq %rsi, %rax
284 ; SAHF-NEXT: addq $32, %rsp
285 ; SAHF-NEXT: popq %rdi
286 ; SAHF-NEXT: popq %rsi
287 ; SAHF-NEXT: popq %rbp
288 ; SAHF-NEXT: retq
289 ; SAHF-NEXT: .seh_handlerdata
290 ; SAHF-NEXT: .text
291 ; SAHF-NEXT: .seh_endproc
155292 %cx = cmpxchg i64* %foo, i64 %bar, i64 %baz seq_cst seq_cst
156 ; PUSHF: lock cmpxchgq
157 ; PUSHF-NEXT: pushfq
158 ; PUSHF-NEXT: popq %[[REG:.*]]
159 ; SAHF: lock cmpxchgq
160 ; SAHF-NEXT: seto %al
161 ; SAHF-NEXT: lahf
162
163293 %v = extractvalue { i64, i1 } %cx, 0
164294 %p = extractvalue { i64, i1 } %cx, 1
165
166295 %call = call i64 @dummy()
167 ; PUSHF: callq dummy
168 ; PUSHF-NEXT: pushq %[[REG]]
169 ; PUSHF-NEXT: popfq
170 ; SAHF: callq dummy
171 ; SAHF-NEXT: pushq
172 ; SAHF: addb $127, %al
173 ; SAHF-NEXT: sahf
174 ; SAHF-NEXT: popq
175
176296 %sel = select i1 %p, i64 %call, i64 %bar
177 ; CHECK-NEXT: cmovneq
178
179297 ret i64 %sel
180 ; CHECK-NEXT: addq $32, %rsp
181 ; CHECK-NEXT: popq %rdi
182 ; CHECK-NEXT: popq %rsi
183 ; CHECK-NEXT: popq %rbp
184298 }
185299
186300 define i8* @f11() "no-frame-pointer-elim"="true" {
187 ; CHECK-LABEL: f11:
188 ; CHECK: pushq %rbp
189 ; CHECK: movq %rsp, %rbp
190 ; CHECK: .seh_setframe 5, 0
191 ; CHECK: leaq 8(%rbp), %rax
301 ; ALL-LABEL: f11:
302 ; ALL: # %bb.0:
303 ; ALL-NEXT: pushq %rbp
304 ; ALL-NEXT: .seh_pushreg 5
305 ; ALL-NEXT: movq %rsp, %rbp
306 ; ALL-NEXT: .seh_setframe 5, 0
307 ; ALL-NEXT: .seh_endprologue
308 ; ALL-NEXT: leaq 8(%rbp), %rax
309 ; ALL-NEXT: popq %rbp
310 ; ALL-NEXT: retq
311 ; ALL-NEXT: .seh_handlerdata
312 ; ALL-NEXT: .text
313 ; ALL-NEXT: .seh_endproc
192314 %aora = call i8* @llvm.addressofreturnaddress()
193315 ret i8* %aora
194316 }
195317
196318 define i8* @f12() {
197 ; CHECK-LABEL: f12:
198 ; CHECK-NOT: push
199 ; CHECK: movq %rsp, %rax
319 ; ALL-LABEL: f12:
320 ; ALL: # %bb.0:
321 ; ALL-NEXT: movq %rsp, %rax
322 ; ALL-NEXT: retq
200323 %aora = call i8* @llvm.addressofreturnaddress()
201324 ret i8* %aora
202325 }
204327 declare i8* @llvm.returnaddress(i32) nounwind readnone
205328 declare i8* @llvm.addressofreturnaddress() nounwind readnone
206329 declare i64 @llvm.x86.flags.read.u64()
207
208330 declare void @llvm.va_start(i8*) nounwind