This is an archive of the discontinued LLVM Phabricator instance.

[X86] Teach X86TargetLowering::targetShrinkDemandedConstant to set non-demanded bits if it helps created an and mask that can be matched as a zero extend.
ClosedPublic

Authored by craig.topper on Mar 13 2018, 10:47 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Mar 13 2018, 10:47 AM
craig.topper edited the summary of this revision. (Show Details)Mar 13 2018, 10:50 AM
niravd accepted this revision.Mar 14 2018, 8:21 AM

Is there any chance of the right shift needing this case as well?

In any case, this LGTM modulo nit.

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
4404 ↗(On Diff #138228)

I think we should put this case right after the 0xFF00 case.

This revision is now accepted and ready to land.Mar 14 2018, 8:21 AM

The pattern matching detects (and (shift)) and (shift (and)) since we canonicalize the order of shifts and ands. This patch handles 0xffff for (and (srl)) and (shl (and))

This revision was automatically updated to reflect the committed changes.