Author: mkuper Date: Tue Feb 24 03:35:58 2015 New Revision: 230315 URL: http://llvm.org/viewvc/llvm-project?rev=230315&view=rev Log: [WinX86_64 ABI] Treat C99 _Complex as a struct
MSVC does not support C99 _Complex. ICC, however, does support it on windows x86_64, and treats it, for purposes of parameter passing, as equivalent to a struct containing two fields (for the real and imaginary part). Differential Revision: http://reviews.llvm.org/D7825 Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/test/CodeGen/x86_64-arguments-win32.c Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=230315&r1=230314&r2=230315&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Tue Feb 24 03:35:58 2015 @@ -3041,7 +3041,7 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu return ABIArgInfo::getDirect(); } - if (RT || Ty->isMemberPointerType()) { + if (RT || Ty->isAnyComplexType() || Ty->isMemberPointerType()) { // MS x64 ABI requirement: "Any argument that doesn't fit in 8 bytes, or is // not 1, 2, 4, or 8 bytes, must be passed by reference." if (Width > 64 || !llvm::isPowerOf2_64(Width)) Modified: cfe/trunk/test/CodeGen/x86_64-arguments-win32.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-arguments-win32.c?rev=230315&r1=230314&r2=230315&view=diff ============================================================================== --- cfe/trunk/test/CodeGen/x86_64-arguments-win32.c (original) +++ cfe/trunk/test/CodeGen/x86_64-arguments-win32.c Tue Feb 24 03:35:58 2015 @@ -14,3 +14,18 @@ void f3(short a) {} // CHECK-LABEL: define void @f4(i16 %a) void f4(unsigned short a) {} + +// For ABI compatibility with ICC, _Complex should be passed/returned +// as if it were a struct with two elements. + +// CHECK-LABEL: define void @f5(i64 %a.coerce) +void f5(_Complex float a) {} + +// CHECK-LABEL: define void @f6({ double, double }* %a) +void f6(_Complex double a) {} + +// CHECK-LABEL: define i64 @f7() +_Complex float f7() { return 1.0; } + +// CHECK-LABEL: define void @f8({ double, double }* noalias sret %agg.result) +_Complex double f8() { return 1.0; } _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
