[llvm] r272005 - [PowerPC] Support multiple return values with fast isel
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 05:48:23 PDT 2016
Author: uweigand
Date: Tue Jun 7 07:48:22 2016
New Revision: 272005
URL: http://llvm.org/viewvc/llvm-project?rev=272005&view=rev
Log:
[PowerPC] Support multiple return values with fast isel
Using an LLVM IR aggregate return value type containing three
or more integer values causes an abort in the fast isel pass.
This patch adds two more registers to RetCC_PPC64_ELF_FIS to
allow returning up to four integers with fast isel, just the
same as is currently supported with regular isel (RetCC_PPC).
This is needed for Swift and (possibly) other non-clang frontends.
Fixes PR26190.
Added:
llvm/trunk/test/CodeGen/PowerPC/multi-return.ll
Modified:
llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td
Modified: llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td?rev=272005&r1=272004&r2=272005&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td Tue Jun 7 07:48:22 2016
@@ -112,7 +112,7 @@ def RetCC_PPC64_ELF_FIS : CallingConv<[
CCIfType<[i8], CCPromoteToType<i64>>,
CCIfType<[i16], CCPromoteToType<i64>>,
CCIfType<[i32], CCPromoteToType<i64>>,
- CCIfType<[i64], CCAssignToReg<[X3, X4]>>,
+ CCIfType<[i64], CCAssignToReg<[X3, X4, X5, X6]>>,
CCIfType<[i128], CCAssignToReg<[X3, X4, X5, X6]>>,
CCIfType<[f32], CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>,
CCIfType<[f64], CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>,
Added: llvm/trunk/test/CodeGen/PowerPC/multi-return.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/multi-return.ll?rev=272005&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/multi-return.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/multi-return.ll Tue Jun 7 07:48:22 2016
@@ -0,0 +1,21 @@
+; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -O0 < %s | FileCheck %s
+; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -O2 < %s | FileCheck %s
+
+; Verify that returning multiple return values in registers works,
+; both with fast-isel and regular isel.
+
+define { i32, i32, i32, i32 } @foo() nounwind {
+ %A1 = insertvalue { i32, i32, i32, i32 } undef, i32 1, 0
+ %A2 = insertvalue { i32, i32, i32, i32 } %A1, i32 2, 1
+ %A3 = insertvalue { i32, i32, i32, i32 } %A2, i32 3, 2
+ %A4 = insertvalue { i32, i32, i32, i32 } %A3, i32 4, 3
+ ret { i32, i32, i32, i32 } %A4
+}
+
+; CHECK-LABEL: foo:
+; CHECK: li 3, 1
+; CHECK: li 4, 2
+; CHECK: li 5, 3
+; CHECK: li 6, 4
+; CHECK: blr
+
More information about the llvm-commits
mailing list