summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-03-04 22:56:17 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-03-04 22:56:17 +0000
commitd2f767d2f6832e5d6bf13ff7f3a309bcd2b8f502 (patch)
tree64f1583e8232461c32ab0557e66ffda8a39c4320 /llvm/test
parent5c3701c621cf480070de72bf244939b6440be33d (diff)
downloadbcm5719-llvm-d2f767d2f6832e5d6bf13ff7f3a309bcd2b8f502.tar.gz
bcm5719-llvm-d2f767d2f6832e5d6bf13ff7f3a309bcd2b8f502.zip
[X86] Support cleaning more than 2**16 bytes of stack
The x86 ret instruction has a 16 bit immediate indicating how many bytes to pop off of the stack beyond the return address. There is a problem when extremely large structs are passed by value: we might not be able to fit the number of bytes to pop into the return instruction. To fix this, expand RET_FLAG a little later and use a special sequence to clean the stack: pop %ecx ; return address is now in %ecx add $n, %esp ; clean the stack push %ecx ; bring the return address back on the stack ret ; pop the return address and jmp to it's value llvm-svn: 262755
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/X86/x86-big-ret.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/x86-big-ret.ll b/llvm/test/CodeGen/X86/x86-big-ret.ll
new file mode 100644
index 00000000000..b7fed33f396
--- /dev/null
+++ b/llvm/test/CodeGen/X86/x86-big-ret.ll
@@ -0,0 +1,22 @@
+; RUN: llc < %s | FileCheck %s
+target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
+target triple = "i386-pc-windows-msvc"
+
+define x86_fastcallcc i32 @test1(i32 inreg %V, [65533 x i8]* byval %p_arg) {
+ ret i32 %V
+}
+; CHECK-LABEL: @test1@65540:
+; CHECK: movl %ecx, %eax
+; CHECK-NEXT: popl %ecx
+; CHECK-NEXT: addl $65536, %esp
+; CHECK-NEXT: pushl %ecx
+; CHECK-NEXT: retl
+
+define x86_stdcallcc void @test2([65533 x i8]* byval %p_arg) {
+ ret void
+}
+; CHECK-LABEL: _test2@65536:
+; CHECK: popl %ecx
+; CHECK-NEXT: addl $65536, %esp
+; CHECK-NEXT: pushl %ecx
+; CHECK-NEXT: retl
OpenPOWER on IntegriCloud