mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +00:00
[x86, AVX] allow explicit calls to VZERO* to modify state in VZeroUpperInserter pass (PR27823)
As noted in the review, there are still problems, so this doesn't the bug completely. Differential Revision: http://reviews.llvm.org/D20529 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270718 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
45400ad477
commit
efe6410a4b
@ -188,16 +188,17 @@ void VZeroUpperInserter::processBasicBlock(MachineBasicBlock &MBB) {
|
||||
bool IsReturnFromX86INTR = IsX86INTR && MI->isReturn();
|
||||
bool IsControlFlow = MI->isCall() || MI->isReturn();
|
||||
|
||||
// An existing VZERO* instruction resets the state.
|
||||
if (MI->getOpcode() == X86::VZEROALL ||
|
||||
MI->getOpcode() == X86::VZEROUPPER) {
|
||||
CurState = EXITS_CLEAN;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Shortcut: don't need to check regular instructions in dirty state.
|
||||
if ((!IsControlFlow || IsReturnFromX86INTR) && CurState == EXITS_DIRTY)
|
||||
continue;
|
||||
|
||||
// Ignore existing VZERO* instructions.
|
||||
// FIXME: The existence of these instructions should be used to modify the
|
||||
// current state and/or used when deciding whether we need to create a VZU.
|
||||
if (MI->getOpcode() == X86::VZEROALL || MI->getOpcode() == X86::VZEROUPPER)
|
||||
continue;
|
||||
|
||||
if (hasYmmReg(MI)) {
|
||||
// We found a ymm-using instruction; this could be an AVX instruction,
|
||||
// or it could be control flow.
|
||||
|
@ -1,7 +1,8 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s
|
||||
|
||||
; FIXME: The vzeroupper added by the VZeroUpperInserter pass is unnecessary in these tests.
|
||||
; In the following 4 tests, the existing call to VZU/VZA ensures clean state before
|
||||
; the call to the unknown, so we don't need to insert a second VZU at that point.
|
||||
|
||||
define <4 x float> @zeroupper_v4f32(<8 x float> *%x, <8 x float> %y) nounwind {
|
||||
; CHECK-LABEL: zeroupper_v4f32:
|
||||
@ -11,7 +12,6 @@ define <4 x float> @zeroupper_v4f32(<8 x float> *%x, <8 x float> %y) nounwind {
|
||||
; CHECK-NEXT: vmovups %ymm0, (%rsp) # 32-byte Spill
|
||||
; CHECK-NEXT: movq %rdi, %rbx
|
||||
; CHECK-NEXT: vzeroupper
|
||||
; CHECK-NEXT: vzeroupper
|
||||
; CHECK-NEXT: callq the_unknown
|
||||
; CHECK-NEXT: vmovups (%rsp), %ymm0 # 32-byte Reload
|
||||
; CHECK-NEXT: vaddps (%rbx), %ymm0, %ymm0
|
||||
@ -37,7 +37,6 @@ define <8 x float> @zeroupper_v8f32(<8 x float> %x) nounwind {
|
||||
; CHECK-NEXT: subq $56, %rsp
|
||||
; CHECK-NEXT: vmovups %ymm0, (%rsp) # 32-byte Spill
|
||||
; CHECK-NEXT: vzeroupper
|
||||
; CHECK-NEXT: vzeroupper
|
||||
; CHECK-NEXT: callq the_unknown
|
||||
; CHECK-NEXT: vmovups (%rsp), %ymm0 # 32-byte Reload
|
||||
; CHECK-NEXT: addq $56, %rsp
|
||||
@ -55,7 +54,6 @@ define <4 x float> @zeroall_v4f32(<8 x float> *%x, <8 x float> %y) nounwind {
|
||||
; CHECK-NEXT: vmovups %ymm0, (%rsp) # 32-byte Spill
|
||||
; CHECK-NEXT: movq %rdi, %rbx
|
||||
; CHECK-NEXT: vzeroall
|
||||
; CHECK-NEXT: vzeroupper
|
||||
; CHECK-NEXT: callq the_unknown
|
||||
; CHECK-NEXT: vmovups (%rsp), %ymm0 # 32-byte Reload
|
||||
; CHECK-NEXT: vaddps (%rbx), %ymm0, %ymm0
|
||||
@ -81,7 +79,6 @@ define <8 x float> @zeroall_v8f32(<8 x float> %x) nounwind {
|
||||
; CHECK-NEXT: subq $56, %rsp
|
||||
; CHECK-NEXT: vmovups %ymm0, (%rsp) # 32-byte Spill
|
||||
; CHECK-NEXT: vzeroall
|
||||
; CHECK-NEXT: vzeroupper
|
||||
; CHECK-NEXT: callq the_unknown
|
||||
; CHECK-NEXT: vmovups (%rsp), %ymm0 # 32-byte Reload
|
||||
; CHECK-NEXT: addq $56, %rsp
|
||||
|
Loading…
Reference in New Issue
Block a user