[llvm-commits] [llvm] r145573 - in /llvm/trunk: lib/Target/X86/X86CallingConv.td test/CodeGen/X86/avx-varargs-x86_64.ll

Eli Friedman eli.friedman at gmail.com
Wed Nov 30 20:49:21 PST 2011


Author: efriedma
Date: Wed Nov 30 22:49:21 2011
New Revision: 145573

URL: http://llvm.org/viewvc/llvm-project?rev=145573&view=rev
Log:
Pass AVX vectors which are arguments to varargs functions on the stack. <rdar://problem/10463281>.


Added:
    llvm/trunk/test/CodeGen/X86/avx-varargs-x86_64.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=145573&r1=145572&r2=145573&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Wed Nov 30 22:49:21 2011
@@ -158,10 +158,15 @@
             CCIfSubtarget<"hasXMM()",
             CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>,
 
-  // The first 8 256-bit vector arguments are passed in YMM registers.
-  CCIfType<[v32i8, v16i16, v8i32, v4i64, v8f32, v4f64],
-            CCIfSubtarget<"hasAVX()",
-            CCAssignToReg<[YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7]>>>,
+  // The first 8 256-bit vector arguments are passed in YMM registers, unless
+  // this is a vararg function.
+  // FIXME: This isn't precisely correct; the x86-64 ABI document says that
+  // fixed arguments to vararg functions are supposed to be passed in
+  // registers.  Actually modeling that would be a lot of work, though.
+  CCIfNotVarArg<CCIfType<[v32i8, v16i16, v8i32, v4i64, v8f32, v4f64],
+                          CCIfSubtarget<"hasAVX()",
+                          CCAssignToReg<[YMM0, YMM1, YMM2, YMM3,
+                                         YMM4, YMM5, YMM6, YMM7]>>>>,
 
   // Integer/FP values get stored in stack slots that are 8 bytes in size and
   // 8-byte aligned if there are no more registers to hold them.

Added: llvm/trunk/test/CodeGen/X86/avx-varargs-x86_64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-varargs-x86_64.ll?rev=145573&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-varargs-x86_64.ll (added)
+++ llvm/trunk/test/CodeGen/X86/avx-varargs-x86_64.ll Wed Nov 30 22:49:21 2011
@@ -0,0 +1,15 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
+; <rdar://problem/10463281>
+; Check that the <8 x float> is passed on the stack.
+
+ at x = common global <8 x float> zeroinitializer, align 32
+declare i32 @f(i32, ...)
+
+; CHECK: test1:
+; CHECK: vmovaps	%ymm0, (%rsp)
+define void @test1() nounwind uwtable ssp {
+entry:
+  %0 = load <8 x float>* @x, align 32
+  %call = call i32 (i32, ...)* @f(i32 1, <8 x float> %0)
+  ret void
+}





More information about the llvm-commits mailing list