[X86] Add a dependency breaking xor before any gathers with an undef passthru value.
authorPhoebe Wang <pengfei.wang@intel.com>
Thu, 28 Oct 2021 02:56:04 +0000 (10:56 +0800)
committerPhoebe Wang <pengfei.wang@intel.com>
Thu, 28 Oct 2021 03:44:52 +0000 (11:44 +0800)
commit2bc28c6f825ec7b33854288970c6646e17425d62
tree7c8f2f5f600bde77e310df93d546841a5e0e3aae
parent0a9b82960c9b002370f11915eb3fdfc910c21405
[X86] Add a dependency breaking xor before any gathers with an undef passthru value.

In the instruction encoding, the passthru register is always
tied to the destination register. The CPU scheduler has to wait
for the last writer of this register to finish executing before
the gather can start. This is true even if the initial mask is
all ones so that the passthru will never be used.

By explicitly zeroing the register we can break the false
dependency. The zero idiom is executed completing by the
register renamer and so is immedately considered ready.

Authored by Craig.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D112505
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/masked_gather.ll
llvm/test/CodeGen/X86/masked_gather_scatter.ll
llvm/test/CodeGen/X86/masked_gather_scatter_widen.ll
llvm/test/CodeGen/X86/pr45067.ll