1 ; RUN: llc < %s -mtriple=i686-windows | FileCheck %s -check-prefix=NORMAL
2 ; RUN: llc < %s -mtriple=i686-windows -force-align-stack -stack-alignment=32 | FileCheck %s -check-prefix=ALIGNED
3 declare void @good(i32 %a, i32 %b, i32 %c, i32 %d)
4 declare void @inreg(i32 %a, i32 inreg %b, i32 %c, i32 %d)
6 ; Here, we should have a reserved frame, so we don't expect pushes
8 ; NORMAL: subl $16, %esp
9 ; NORMAL-NEXT: movl $4, 12(%esp)
10 ; NORMAL-NEXT: movl $3, 8(%esp)
11 ; NORMAL-NEXT: movl $2, 4(%esp)
12 ; NORMAL-NEXT: movl $1, (%esp)
14 define void @test1() {
16 call void @good(i32 1, i32 2, i32 3, i32 4)
20 ; Here, we expect a sequence of 4 immediate pushes
22 ; NORMAL-NOT: subl {{.*}} %esp
24 ; NORMAL-NEXT: pushl $3
25 ; NORMAL-NEXT: pushl $2
26 ; NORMAL-NEXT: pushl $1
28 define void @test2(i32 %k) {
30 %a = alloca i32, i32 %k
31 call void @good(i32 1, i32 2, i32 3, i32 4)
35 ; Again, we expect a sequence of 4 immediate pushes
36 ; Checks that we generate the right pushes for >8bit immediates
37 ; NORMAL-LABEL: test2b
38 ; NORMAL-NOT: subl {{.*}} %esp
40 ; NORMAL-NEXT: pushl $3072
41 ; NORMAL-NEXT: pushl $2048
42 ; NORMAL-NEXT: pushl $1024
44 define void @test2b(i32 %k) {
46 %a = alloca i32, i32 %k
47 call void @good(i32 1024, i32 2048, i32 3072, i32 4096)
51 ; The first push should push a register
53 ; NORMAL-NOT: subl {{.*}} %esp
55 ; NORMAL-NEXT: pushl $3
56 ; NORMAL-NEXT: pushl $2
57 ; NORMAL-NEXT: pushl %e{{..}}
59 define void @test3(i32 %k) {
61 %a = alloca i32, i32 %k
62 call void @good(i32 %k, i32 2, i32 3, i32 4)
66 ; We don't support weird calling conventions
68 ; NORMAL: subl $12, %esp
69 ; NORMAL-NEXT: movl $4, 8(%esp)
70 ; NORMAL-NEXT: movl $3, 4(%esp)
71 ; NORMAL-NEXT: movl $1, (%esp)
72 ; NORMAL-NEXT: movl $2, %eax
74 define void @test4(i32 %k) {
76 %a = alloca i32, i32 %k
77 call void @inreg(i32 1, i32 2, i32 3, i32 4)
81 ; Check that additional alignment is added when the pushes
82 ; don't add up to the required alignment.
83 ; ALIGNED-LABEL: test5
84 ; ALIGNED: subl $16, %esp
85 ; ALIGNED-NEXT: pushl $4
86 ; ALIGNED-NEXT: pushl $3
87 ; ALIGNED-NEXT: pushl $2
88 ; ALIGNED-NEXT: pushl $1
90 define void @test5(i32 %k) {
92 %a = alloca i32, i32 %k
93 call void @good(i32 1, i32 2, i32 3, i32 4)
97 ; Check that pushing the addresses of globals (Or generally, things that
98 ; aren't exactly immediates) isn't broken.
100 ; NORMAL-LABEL: test6
101 ; NORMAL: pushl $_ext
104 @ext = external constant i8
106 define void @test6() {
107 call void @f(i8* @ext)