Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[X86] Fix bug in vectorcall calling convention
Original implementation can't correctly handle __m256 and __m512 types passed by reference through stack. This patch fixes it. Patch by Wei Xiao! Differential Revision: https://reviews.llvm.org/D57643 llvm-svn: 354921
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s | ||
|
||
; Test 1st and 2nd arguments passed in XMM0 and XMM1. | ||
; Test 7nd argument passed by reference in stack: 56(%rsp). | ||
define x86_vectorcallcc <4 x float> @test_m128_7(<4 x float> %a, <4 x float> %b, <4 x float> %c, <4 x float> %d, <4 x float> %e, <4 x float> %f, <4 x float> %g) #0 { | ||
; CHECK-LABEL: test_m128_7@@112: | ||
; CHECK: movq 56(%rsp), %rax | ||
; CHECK: vaddps %xmm1, %xmm0, %xmm0 | ||
; CHECK: vsubps (%rax), %xmm0, %xmm0 | ||
%add.i = fadd <4 x float> %a, %b | ||
%sub.i = fsub <4 x float> %add.i, %g | ||
ret <4 x float> %sub.i | ||
} | ||
|
||
; Test 1st and 2nd arguments passed in YMM0 and YMM1. | ||
; Test 7nd argument passed by reference in stack: 56(%rsp). | ||
define x86_vectorcallcc <8 x float> @test_m256_7(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float> %d, <8 x float> %e, <8 x float> %f, <8 x float> %g) #0 { | ||
; CHECK-LABEL: test_m256_7@@224: | ||
; CHECK: movq 56(%rsp), %rax | ||
; CHECK: vaddps %ymm1, %ymm0, %ymm0 | ||
; CHECK: vsubps (%rax), %ymm0, %ymm0 | ||
%add.i = fadd <8 x float> %a, %b | ||
%sub.i = fsub <8 x float> %add.i, %g | ||
ret <8 x float> %sub.i | ||
} | ||
|
||
attributes #0 = { nounwind "target-cpu"="core-avx2" } |