[SelectionDAG] Teach simplifyDemandedBits to handle shifts by constant splat vectors
Needs ReviewPublic

Authored by craig.topper on Sat, Sep 9, 11:41 AM.

Details

Summary

This teach simplifyDemandedBits to handle constant splat vector shifts.

This required changing all the uses of getZExtValue to getLimitedValue since we can't rely on legalization using getShiftAmountTy for the shift amount.

I believe there may have been a bug in the ((X << C1) >>u ShAmt) handling where we didn't check if the inner shift was too large. I've fixed that here, but maybe I should split that out.

I had to add new patterns to ARM because the zext/sext the patterns were trying to look for got turned into an any_extend with this patch. Happy to split that out too, but not sure how to test without this change.

Diff Detail

craig.topper created this revision.Sat, Sep 9, 11:41 AM

Missed one ARM test change.

Adding ARM specialists

RKSimon added inline comments.Sat, Sep 9, 1:06 PM
lib/CodeGen/SelectionDAG/TargetLowering.cpp
784

Which do you think is better - getLimitedValue or using APInt::uge() which we do in other places?

Change to use APInt::uge in most places. There was one place where getLimitedValue was still convenient for a compound if condition.

LGTM - @t.p.northover @rengolin are you alright with the ARMInstrNEON.td fixes?

Any ARM specialist wanting to comment on the ARMInstrNEON.td change?