[llvm-commits] [llvm] r91410 - in /llvm/trunk: lib/Target/X86/X86CallingConv.td test/CodeGen/X86/fastcc3struct.ll
Kenneth Uildriks
kennethuil at gmail.com
Mon Dec 14 19:27:52 PST 2009
Author: kennethuil
Date: Mon Dec 14 21:27:52 2009
New Revision: 91410
URL: http://llvm.org/viewvc/llvm-project?rev=91410&view=rev
Log:
For fastcc on x86, let ECX be used as a return register after EAX and EDX
Added:
llvm/trunk/test/CodeGen/X86/fastcc3struct.ll
Modified:
llvm/trunk/lib/Target/X86/X86CallingConv.td
Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=91410&r1=91409&r2=91410&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon Dec 14 21:27:52 2009
@@ -64,11 +64,18 @@
// 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>
]>;
Added: llvm/trunk/test/CodeGen/X86/fastcc3struct.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fastcc3struct.ll?rev=91410&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fastcc3struct.ll (added)
+++ llvm/trunk/test/CodeGen/X86/fastcc3struct.ll Mon Dec 14 21:27:52 2009
@@ -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
+}
+
More information about the llvm-commits
mailing list