This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add a dependency breaking xor before any gathers with an undef passthru value.
ClosedPublic

Authored by pengfei on Oct 25 2021, 8:04 PM.

Details

Summary

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.

Diff Detail

Event Timeline

pengfei created this revision.Oct 25 2021, 8:04 PM
pengfei requested review of this revision.Oct 25 2021, 8:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2021, 8:04 PM

LGTM, but wait a couple days.

lebedev.ri accepted this revision.Oct 26 2021, 1:26 AM
lebedev.ri added a subscriber: lebedev.ri.

This seems reasonable to me.
It's not *required* for the CPU to handle zero-idioms at register rename stage,
but it is reasonable to expect that to be the case in most modern CPU's.

This revision is now accepted and ready to land.Oct 26 2021, 1:26 AM