diff options
| author | Reid Kleckner <reid@kleckner.net> | 2015-05-12 20:56:32 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2015-05-12 20:56:32 +0000 |
| commit | b465563b46ac9ebbbe3c6993a010a17b79d460be (patch) | |
| tree | 5113bc0d3a710c1d5a4592d35f29a40faa90dce8 /llvm/test/CodeGen/X86/sret-implicit.ll | |
| parent | 121fa77e9287c71ed8587c2708b15ed3235d2860 (diff) | |
| download | bcm5719-llvm-b465563b46ac9ebbbe3c6993a010a17b79d460be.tar.gz bcm5719-llvm-b465563b46ac9ebbbe3c6993a010a17b79d460be.zip | |
[X86] Always return the sret parameter in eax/rax, even on 32-bit
Summary:
This rule was always in the old SysV i386 ABI docs and the new ones that
H.J. Lu has put together, but we never noticed:
EAX scratch register; also used to return integer and pointer values
from functions; also stores the address of a returned struct or union
Fixes PR23491.
Reviewers: majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9715
llvm-svn: 237175
Diffstat (limited to 'llvm/test/CodeGen/X86/sret-implicit.ll')
| -rw-r--r-- | llvm/test/CodeGen/X86/sret-implicit.ll | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/llvm/test/CodeGen/X86/sret-implicit.ll b/llvm/test/CodeGen/X86/sret-implicit.ll index 56809525407..2a998fc6b6c 100644 --- a/llvm/test/CodeGen/X86/sret-implicit.ll +++ b/llvm/test/CodeGen/X86/sret-implicit.ll @@ -1,12 +1,34 @@ -; RUN: llc -mtriple=x86_64-apple-darwin8 < %s | FileCheck %s -; RUN: llc -mtriple=x86_64-pc-linux < %s | FileCheck %s -; RUN: llc -mtriple=x86_64-apple-darwin8 -terminal-rule < %s | FileCheck %s -; RUN: llc -mtriple=x86_64-pc-linux -terminal-rule < %s | FileCheck %s - -; CHECK-LABEL: return32 -; CHECK-DAG: movq $0, (%rdi) -; CHECK-DAG: movq %rdi, %rax -; CHECK: retq -define i256 @return32() { +; RUN: llc -mtriple=x86_64-apple-darwin8 < %s | FileCheck %s --check-prefix=X64 +; RUN: llc -mtriple=x86_64-pc-linux < %s | FileCheck %s --check-prefix=X64 +; RUN: llc -mtriple=i686-pc-linux < %s | FileCheck %s --check-prefix=X86 +; RUN: llc -mtriple=x86_64-apple-darwin8 -terminal-rule < %s | FileCheck %s --check-prefix=X64 +; RUN: llc -mtriple=x86_64-pc-linux -terminal-rule < %s | FileCheck %s --check-prefix=X64 + +define void @sret_void(i32* sret %p) { + store i32 0, i32* %p + ret void +} + +; X64-LABEL: sret_void +; X64-DAG: movl $0, (%rdi) +; X64-DAG: movq %rdi, %rax +; X64: retq + +; X86-LABEL: sret_void +; X86: movl 4(%esp), %eax +; X86: movl $0, (%eax) +; X86: retl + +define i256 @sret_demoted() { ret i256 0 } + +; X64-LABEL: sret_demoted +; X64-DAG: movq $0, (%rdi) +; X64-DAG: movq %rdi, %rax +; X64: retq + +; X86-LABEL: sret_demoted +; X86: movl 4(%esp), %eax +; X86: movl $0, (%eax) +; X86: retl |

