1 ; RUN: llc < %s -mtriple=x86_64-linux-unknown | FileCheck %s --check-prefix=CHECK-64
2 ; RUN: llc < %s -mtriple=i386-linux-unknown | FileCheck %s --check-prefix=CHECK-32
4 ; Test that a large stack offset uses a single add/sub instruction to
5 ; adjust the stack pointer.
7 define void @foo() nounwind {
9 ; CHECK-64: movabsq $50000000{{..}}, %rax
10 ; CHECK-64-NEXT: subq %rax, %rsp
11 ; CHECK-64-NOT: subq $2147483647, %rsp
12 ; CHECK-64: movabsq $50000000{{..}}, [[RAX:%r..]]
13 ; CHECK-64-NEXT: addq [[RAX]], %rsp
15 ; CHECK-32-LABEL: foo:
16 ; CHECK-32: movl $50000000{{..}}, %eax
17 ; CHECK-32-NEXT: subl %eax, %esp
18 ; CHECK-32-NOT: subl $2147483647, %esp
19 ; CHECK-32: movl $50000000{{..}}, [[EAX:%e..]]
20 ; CHECK-32-NEXT: addl [[EAX]], %esp
21 %1 = alloca [5000000000 x i8], align 16
22 call void @bar(ptr %1)
26 ; Verify that we do not clobber the return value.
28 define i32 @foo2() nounwind {
29 ; CHECK-64-LABEL: foo2:
30 ; CHECK-64: movl $10, %eax
31 ; CHECK-64-NOT: movabsq ${{.*}}, %rax
33 ; CHECK-32-LABEL: foo2:
34 ; CHECK-32: movl $10, %eax
35 ; CHECK-32-NOT: movl ${{.*}}, %eax
36 %1 = alloca [5000000000 x i8], align 16
37 call void @bar(ptr %1)
41 ; Verify that we do not clobber EAX when using inreg attribute
43 define i32 @foo3(i32 inreg %x) nounwind {
44 ; CHECK-64-LABEL: foo3:
45 ; CHECK-64: movabsq $50000000{{..}}, %rax
46 ; CHECK-64-NEXT: subq %rax, %rsp
48 ; CHECK-32-LABEL: foo3:
49 ; CHECK-32: subl $2147483647, %esp
50 ; CHECK-32-NOT: movl ${{.*}}, %eax
51 %1 = alloca [5000000000 x i8], align 16
52 call void @bar(ptr %1)
56 declare void @bar(ptr)