OSDN Git Service

[X86] Bring back the MOV64r0 pseudo instruction
authorCraig Topper <craig.topper@intel.com>
Wed, 24 Oct 2018 17:32:09 +0000 (17:32 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 24 Oct 2018 17:32:09 +0000 (17:32 +0000)
commita1d58c653729783e0f5e20c3c093f3789dccd8b4
treed9e45f3c77d5bf1092aded688c68272bc37384cc
parentb3b0836b9b35c7ae99ffa242a55e2d7bb97d106f
[X86] Bring back the MOV64r0 pseudo instruction

This patch brings back the MOV64r0 pseudo instruction for zeroing a 64-bit register. This replaces the SUBREG_TO_REG MOV32r0 sequence we use today. Post register allocation we will rewrite the MOV64r0 to a 32-bit xor with an implicit def of the 64-bit register similar to what we do for the various XMM/YMM/ZMM zeroing pseudos.

My main motivation is to enable the spill optimization in foldMemoryOperandImpl. As we were seeing some code that repeatedly did "xor eax, eax; store eax;" to spill several registers with a new xor for each store. With this optimization enabled we get a store of a 0 immediate instead of an xor. Though I admit the ideal solution would be one xor where there are multiple spills. I don't believe we have a test case that shows this optimization in here. I'll see if I can try to reduce one from the code were looking at.

There's definitely some other machine CSE(and maybe other passes) behavior changes exposed by this patch. So it seems like there might be some other deficiencies in SUBREG_TO_REG handling.

Differential Revision: https://reviews.llvm.org/D52757

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345165 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
lib/Target/X86/X86FastISel.cpp
lib/Target/X86/X86ISelDAGToDAG.cpp
lib/Target/X86/X86InstrCompiler.td
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86SpeculativeLoadHardening.cpp
test/CodeGen/X86/GlobalISel/constant.ll
test/CodeGen/X86/avg.ll
test/CodeGen/X86/crash-O0.ll
test/CodeGen/X86/hoist-spill.ll
test/CodeGen/X86/machine-cse.ll
test/CodeGen/X86/madd.ll
test/CodeGen/X86/mmx-arith.ll
test/CodeGen/X86/pr32284.ll
test/CodeGen/X86/pr32340.ll
test/CodeGen/X86/scheduler-backtracking.ll
test/CodeGen/X86/spill-zero-x86_64.ll [new file with mode: 0644]
test/CodeGen/X86/swifterror.ll