1 ; This test is attempting to detect when we request forced re-alignment of the
2 ; stack to an alignment greater than would be available due to the ABI. We
3 ; arbitrarily force alignment up to 32-bytes for i386 hoping that this will
4 ; exceed any ABI provisions.
6 ; RUN: llc < %s -force-align-stack -stack-alignment=32 | FileCheck %s
8 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
9 target triple = "i386-unknown-linux-gnu"
11 define i32 @f(i8* %p) nounwind {
14 %conv = sext i8 %0 to i32
18 define i64 @g(i32 %i) nounwind {
21 ; CHECK-NEXT: movl %esp, %ebp
23 ; CHECK-NEXT: subl $20, %esp
24 ; CHECK-NOT: {{[^ ,]*}}, %esp
26 ; The next adjustment of the stack is due to the alloca.
27 ; CHECK: movl %{{...}}, %esp
28 ; CHECK-NOT: {{[^ ,]*}}, %esp
30 ; Next we set up the memset call, and then undo it.
31 ; CHECK: subl $32, %esp
32 ; CHECK-NOT: {{[^ ,]*}}, %esp
34 ; CHECK-NEXT: addl $32, %esp
35 ; CHECK-NOT: {{[^ ,]*}}, %esp
37 ; Next we set up the call to 'f'.
38 ; CHECK: subl $32, %esp
39 ; CHECK-NOT: {{[^ ,]*}}, %esp
41 ; CHECK-NEXT: addl $32, %esp
42 ; CHECK-NOT: {{[^ ,]*}}, %esp
44 ; Finally we nede to restore %esp from %ebp, the alloca prevents us from
45 ; restoring it directly.
47 ; CHECK: leal -4(%ebp), %esp
56 %0 = alloca i8, i32 %i
57 call void @llvm.memset.p0i8.i32(i8* %0, i8 0, i32 %i, i32 1, i1 false)
58 %call = call i32 @f(i8* %0)
59 %conv = sext i32 %call to i64
63 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) nounwind