1 ; RUN: llc < %s -mtriple=i686-windows -stackrealign | FileCheck %s
3 declare void @good(i32 %a, i32 %b, i32 %c, i32 %d)
4 declare void @oneparam(i32 %a)
5 declare void @eightparams(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h)
7 ; When there is no reserved call frame, check that additional alignment
8 ; is added when the pushes don't add up to the required alignment.
10 ; CHECK: subl $16, %esp
11 ; CHECK-NEXT: pushl $4
12 ; CHECK-NEXT: pushl $3
13 ; CHECK-NEXT: pushl $2
14 ; CHECK-NEXT: pushl $1
16 define void @test5(i32 %k) {
18 %a = alloca i32, i32 %k
19 call void @good(i32 1, i32 2, i32 3, i32 4)
23 ; When the alignment adds up, do the transformation
24 ; CHECK-LABEL: test5b:
26 ; CHECK-NEXT: pushl $7
27 ; CHECK-NEXT: pushl $6
28 ; CHECK-NEXT: pushl $5
29 ; CHECK-NEXT: pushl $4
30 ; CHECK-NEXT: pushl $3
31 ; CHECK-NEXT: pushl $2
32 ; CHECK-NEXT: pushl $1
34 define void @test5b() optsize {
36 call void @eightparams(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8)
40 ; When having to compensate for the alignment isn't worth it,
42 ; CHECK-LABEL: test5c:
43 ; CHECK: movl $1, (%esp)
45 define void @test5c() optsize {
47 call void @oneparam(i32 1)
51 !llvm.module.flags = !{!0}
52 !0 = !{i32 2, !"override-stack-alignment", i32 32}