summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Uildriks <kennethuil@gmail.com>2009-12-15 03:27:52 +0000
committerKenneth Uildriks <kennethuil@gmail.com>2009-12-15 03:27:52 +0000
commit792f0913ee1161d92f12412c03cc8930967dfd75 (patch)
tree76305a7c96a0df7c115cf889ecb4f5e22cf94d51
parent8d838427610bc215eaa9191b73ee2d73024b7ee8 (diff)
downloadbcm5719-llvm-792f0913ee1161d92f12412c03cc8930967dfd75.tar.gz
bcm5719-llvm-792f0913ee1161d92f12412c03cc8930967dfd75.zip
For fastcc on x86, let ECX be used as a return register after EAX and EDX
llvm-svn: 91410
-rw-r--r--llvm/lib/Target/X86/X86CallingConv.td9
-rw-r--r--llvm/test/CodeGen/X86/fastcc3struct.ll15
2 files changed, 23 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86CallingConv.td b/llvm/lib/Target/X86/X86CallingConv.td
index d77f0390b10..12d3d04eb6b 100644
--- a/llvm/lib/Target/X86/X86CallingConv.td
+++ b/llvm/lib/Target/X86/X86CallingConv.td
@@ -64,11 +64,18 @@ def RetCC_X86_32_C : CallingConv<[
// X86-32 FastCC return-value convention.
def RetCC_X86_32_Fast : CallingConv<[
// The X86-32 fastcc returns 1, 2, or 3 FP values in XMM0-2 if the target has
- // SSE2, otherwise it is the the C calling conventions.
+ // SSE2.
// This can happen when a float, 2 x float, or 3 x float vector is split by
// target lowering, and is returned in 1-3 sse regs.
CCIfType<[f32], CCIfSubtarget<"hasSSE2()", CCAssignToReg<[XMM0,XMM1,XMM2]>>>,
CCIfType<[f64], CCIfSubtarget<"hasSSE2()", CCAssignToReg<[XMM0,XMM1,XMM2]>>>,
+
+ // For integers, ECX can be used as an extra return register
+ CCIfType<[i8], CCAssignToReg<[AL, DL, CL]>>,
+ CCIfType<[i16], CCAssignToReg<[AX, DX, CX]>>,
+ CCIfType<[i32], CCAssignToReg<[EAX, EDX, ECX]>>,
+
+ // Otherwise, it is the same as the common X86 calling convention.
CCDelegateTo<RetCC_X86Common>
]>;
diff --git a/llvm/test/CodeGen/X86/fastcc3struct.ll b/llvm/test/CodeGen/X86/fastcc3struct.ll
new file mode 100644
index 00000000000..84f8ef6cf36
--- /dev/null
+++ b/llvm/test/CodeGen/X86/fastcc3struct.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -march=x86 -o %t
+; RUN: grep "movl .48, %ecx" %t
+; RUN: grep "movl .24, %edx" %t
+; RUN: grep "movl .12, %eax" %t
+
+%0 = type { i32, i32, i32 }
+
+define internal fastcc %0 @ReturnBigStruct() nounwind readnone {
+entry:
+ %0 = insertvalue %0 zeroinitializer, i32 12, 0
+ %1 = insertvalue %0 %0, i32 24, 1
+ %2 = insertvalue %0 %1, i32 48, 2
+ ret %0 %2
+}
+
OpenPOWER on IntegriCloud