From 7c6f3ffeace0656773333cf35807e7e0bd2bf1ab Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 24 Nov 2014 20:14:29 +0000 Subject: [PATCH] CodeGen: make i686-windows-itanium more similar to msvc The itanium environment follows the system calling convention for structures. Pass small aggregates via registers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222680 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetInfo.cpp | 1 + test/CodeGen/windows-struct-abi.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 3ad8bd950c..422feef84e 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -1307,6 +1307,7 @@ bool X86_32TargetCodeGenInfo::isStructReturnInRegABI( case llvm::Triple::UnknownEnvironment: case llvm::Triple::Cygnus: case llvm::Triple::GNU: + case llvm::Triple::Itanium: case llvm::Triple::MSVC: return true; default: diff --git a/test/CodeGen/windows-struct-abi.c b/test/CodeGen/windows-struct-abi.c index ec4bab6b47..4b4a6f1b5d 100644 --- a/test/CodeGen/windows-struct-abi.c +++ b/test/CodeGen/windows-struct-abi.c @@ -6,7 +6,7 @@ struct f1 { struct f1 return_f1(void) { while (1); } -// CHECK: define void @return_f1(%struct.f1* noalias sret %agg.result) +// CHECK: define i32 @return_f1() void receive_f1(struct f1 a0) { } @@ -19,9 +19,24 @@ struct f2 { struct f2 return_f2(void) { while (1); } -// CHECK: define void @return_f2(%struct.f2* noalias sret %agg.result) +// CHECK: define i64 @return_f2() void receive_f2(struct f2 a0) { } // CHECK: define void @receive_f2(%struct.f2* byval align 4 %a0) +struct f4 { + float f; + float g; + float h; + float i; +}; + +struct f4 return_f4(void) { while (1); } + +// CHECK: define void @return_f4(%struct.f4* noalias sret %agg.result) + +void receive_f4(struct f4 a0) { } + +// CHECK: define void @receive_f4(%struct.f4* byval align 4 %a0) + -- 2.40.0