This is an archive of the discontinued LLVM Phabricator instance.

[X86] Teach shouldSinkOperands to recognize pmuldq/pmuludq patterns.
ClosedPublic

Authored by craig.topper on Aug 6 2021, 11:13 PM.

Details

Summary

The IR for pmuldq/pmuludq intrinsics uses a sext_inreg/zext_inreg
pattern on the inputs. Ideally we pattern match these away during
isel. It is possible for LICM or other middle end optimizations
to separate the extend from the mul. This prevents SelectionDAG
from removing it or depending on how the extend is lowered, we
may not be able to generate an AssertSExt/AssertZExt in the
mul basic block. This will prevent pmuldq/pmuludq from being
formed at all.

This patch teaches shouldSinkOperands to recognize this so
that CodeGenPrepare will clone the extend into the same basic
block as the mul.

Fixes PR51371.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 6 2021, 11:13 PM
craig.topper requested review of this revision.Aug 6 2021, 11:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 6 2021, 11:13 PM
spatel accepted this revision.Aug 7 2021, 7:30 AM

LGTM - pre-commit the baseline tests, so we have a reference of what the poor asm looked like?

This revision is now accepted and ready to land.Aug 7 2021, 7:30 AM
This revision was landed with ongoing or failed builds.Aug 7 2021, 8:49 AM
This revision was automatically updated to reflect the committed changes.