This is an archive of the discontinued LLVM Phabricator instance.

[X86] matchAddressRecursively - support zext(and(shl(x,c1)),c2) -> shl(zext(and(x, c2 >> c1),c1)
ClosedPublic

Authored by RKSimon on Mar 11 2023, 12:28 PM.

Details

Summary

This came about while investigating ways to handle D145468 in a more generic manner, which involves trying harder to fold and(zext(x),c) -> zext(and(x,c))

Alive2: https://alive2.llvm.org/ce/z/7fXtDt (generic fold)

Diff Detail

Event Timeline

RKSimon created this revision.Mar 11 2023, 12:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2023, 12:28 PM
RKSimon requested review of this revision.Mar 11 2023, 12:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2023, 12:28 PM
pengfei accepted this revision.Mar 11 2023, 6:09 PM

LGTM.

llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
2516–2517

Nit: this should also be common out e.g., unsigned ShAmtV = ShAmtC->getZExtValue().

This revision is now accepted and ready to land.Mar 11 2023, 6:09 PM