Passing AVX 256-bit structures in Win64 was wrong.
authorElena Demikhovsky <elena.demikhovsky@intel.com>
Wed, 1 Feb 2012 10:46:14 +0000 (10:46 +0000)
committerElena Demikhovsky <elena.demikhovsky@intel.com>
Wed, 1 Feb 2012 10:46:14 +0000 (10:46 +0000)
Fixed Win64 calling conventions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149494 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86CallingConv.td
test/CodeGen/X86/avx-win64-args.ll [new file with mode: 0755]
test/CodeGen/X86/avx-win64.ll

index ed389a03a4c2c2d999e522f686c99db5b010f56f..1e48deee409d14e5989705307dfebe0431cadff6 100644 (file)
@@ -198,6 +198,10 @@ def CC_X86_Win64_C : CallingConv<[
   // 128 bit vectors are passed by pointer
   CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCPassIndirect<i64>>,
 
+
+  // 256 bit vectors are passed by pointer
+  CCIfType<[v32i8, v16i16, v8i32, v4i64, v8f32, v4f64], CCPassIndirect<i64>>,
+
   // The first 4 MMX vector arguments are passed in GPRs.
   CCIfType<[x86mmx], CCBitConvertToType<i64>>,
 
diff --git a/test/CodeGen/X86/avx-win64-args.ll b/test/CodeGen/X86/avx-win64-args.ll
new file mode 100755 (executable)
index 0000000..8b52417
--- /dev/null
@@ -0,0 +1,18 @@
+; RUN: llc < %s -mcpu=corei7-avx -mattr=+avx | FileCheck %s\r
+target triple = "x86_64-pc-win32"\r
+\r
+declare <8 x float> @foo(<8 x float>, i32)\r
+\r
+define <8 x float> @test1(<8 x float> %x, <8 x float> %y) nounwind uwtable readnone ssp {\r
+entry:\r
+; CHECK: test1\r
+; CHECK: leaq {{.*}}, %rcx\r
+; CHECK: movl {{.*}}, %edx\r
+; CHECK: call\r
+; CHECK: ret\r
+  %x1 = fadd  <8 x float>  %x, %y\r
+  %call = call  <8 x float> @foo(<8 x float> %x1, i32 1) nounwind\r
+  %y1 = fsub  <8 x float>  %call, %y\r
+  ret <8 x float> %y1\r
+}\r
+\r
index 511f94944b6d1c243bbdca3266424ce121aa6ba8..dc6bd594450f44fe07cd9eed6b3e9bed768545c1 100644 (file)
@@ -9,7 +9,6 @@ target triple = "x86_64-pc-win32"
 
 ; CHECK: f___vyf
 ; CHECK: pushq %rbp
-; CHECK-NOT: vmovaps{{.*}}(%r
 ; CHECK: vmovmsk
 ; CHECK: vmovaps %ymm{{.*}}(%r
 ; CHECK: vmovaps %ymm{{.*}}(%r