Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[X86] [ABI] Fix i386 ABI "__m64" type bug
According to System V i386 ABI: the __m64 type paramater and return value are passed by MMX registers. But current implementation treats __m64 as i64 which results in parameter passing by stack and returning by EDX and EAX. This patch fixes the bug (https://bugs.llvm.org/show_bug.cgi?id=41029) for Linux and NetBSD. Patch by Wei Xiao (wxiao3) Differential Revision: https://reviews.llvm.org/D59744 llvm-svn: 363116
- Loading branch information
1 parent
dd4bed3
commit fbfee60
Showing
3 changed files
with
67 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %clang_cc1 -w -O2 -fblocks -triple i386-pc-linux-gnu -target-cpu pentium4 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,LINUX | ||
// RUN: %clang_cc1 -w -O2 -fblocks -triple i386-netbsd -target-cpu pentium4 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,NETBSD | ||
// RUN: %clang_cc1 -w -O2 -fblocks -triple i386-apple-darwin9 -target-cpu yonah -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,DARWIN | ||
// RUN: %clang_cc1 -w -O2 -fblocks -triple i386-pc-elfiamcu -mfloat-abi soft -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,IAMCU | ||
// RUN: %clang_cc1 -w -O2 -fblocks -triple i386-pc-win32 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,WIN32 | ||
|
||
#include <mmintrin.h> | ||
__m64 m64; | ||
void callee(__m64 __m1, __m64 __m2); | ||
__m64 caller(__m64 __m1, __m64 __m2) | ||
{ | ||
// LINUX-LABEL: define x86_mmx @caller(x86_mmx %__m1.coerce, x86_mmx %__m2.coerce) | ||
// LINUX: tail call void @callee(x86_mmx %__m2.coerce, x86_mmx %__m1.coerce) | ||
// LINUX: ret x86_mmx | ||
// NETBSD-LABEL: define x86_mmx @caller(x86_mmx %__m1.coerce, x86_mmx %__m2.coerce) | ||
// NETBSD: tail call void @callee(x86_mmx %__m2.coerce, x86_mmx %__m1.coerce) | ||
// NETBSD: ret x86_mmx | ||
// DARWIN-LABEL: define i64 @caller(i64 %__m1.coerce, i64 %__m2.coerce) | ||
// DARWIN: tail call void @callee(i64 %__m2.coerce, i64 %__m1.coerce) | ||
// DARWIN: ret i64 | ||
// IAMCU-LABEL: define <1 x i64> @caller(i64 %__m1.coerce, i64 %__m2.coerce) | ||
// IAMCU: tail call void @callee(i64 %__m2.coerce, i64 %__m1.coerce) | ||
// IAMCU: ret <1 x i64> | ||
// WIN32-LABEL: define dso_local <1 x i64> @caller(i64 %__m1.coerce, i64 %__m2.coerce) | ||
// WIN32: call void @callee(i64 %__m2.coerce, i64 %__m1.coerce) | ||
// WIN32: ret <1 x i64> | ||
callee(__m2, __m1); | ||
return m64; | ||
} |