craig.topper created this revision.
craig.topper added reviewers: efriedma, rnk, echristo.

The backend can't lower this correctly and will try to split the return value 
into multiple registers.

This patches forces it to return via memory similar to what was already done 
for arguments.

Fixes PR39501.


Repository:
  rC Clang

https://reviews.llvm.org/D53919

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGen/x86_64-arguments.c


Index: test/CodeGen/x86_64-arguments.c
===================================================================
--- test/CodeGen/x86_64-arguments.c
+++ test/CodeGen/x86_64-arguments.c
@@ -545,3 +545,13 @@
 // AVX: @f65(<8 x float> %{{[^,)]+}})
 void f65(struct t65 a0) {
 }
+
+// SSE-LABEL: @f66(<32 x i8>* noalias sret %{{[^,)]+}})
+// AVX: <32 x i8> @f66()
+typedef char v66 __attribute__((vector_size (32))) ;
+v66 f66()
+{
+ v66 y = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
+          '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
+ return y;
+}
Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -2859,7 +2859,7 @@
 ABIArgInfo X86_64ABIInfo::getIndirectReturnResult(QualType Ty) const {
   // If this is a scalar LLVM value then assume LLVM will pass it in the right
   // place naturally.
-  if (!isAggregateTypeForABI(Ty)) {
+  if (!isAggregateTypeForABI(Ty) && !IsIllegalVectorType(Ty)) {
     // Treat an enum type as its underlying type.
     if (const EnumType *EnumTy = Ty->getAs<EnumType>())
       Ty = EnumTy->getDecl()->getIntegerType();


Index: test/CodeGen/x86_64-arguments.c
===================================================================
--- test/CodeGen/x86_64-arguments.c
+++ test/CodeGen/x86_64-arguments.c
@@ -545,3 +545,13 @@
 // AVX: @f65(<8 x float> %{{[^,)]+}})
 void f65(struct t65 a0) {
 }
+
+// SSE-LABEL: @f66(<32 x i8>* noalias sret %{{[^,)]+}})
+// AVX: <32 x i8> @f66()
+typedef char v66 __attribute__((vector_size (32))) ;
+v66 f66()
+{
+ v66 y = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
+          '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
+ return y;
+}
Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -2859,7 +2859,7 @@
 ABIArgInfo X86_64ABIInfo::getIndirectReturnResult(QualType Ty) const {
   // If this is a scalar LLVM value then assume LLVM will pass it in the right
   // place naturally.
-  if (!isAggregateTypeForABI(Ty)) {
+  if (!isAggregateTypeForABI(Ty) && !IsIllegalVectorType(Ty)) {
     // Treat an enum type as its underlying type.
     if (const EnumType *EnumTy = Ty->getAs<EnumType>())
       Ty = EnumTy->getDecl()->getIntegerType();
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to