This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Add partial BITCAST support to computeKnownBits
ClosedPublic

Authored by RKSimon on Nov 25 2016, 6:46 AM.

Details

Summary

Adds support for bitcasting a 'small element' vector to 'large element' scalar/vector (e.g. v16i8 to v4i32 or v2i32 to i64), which is required for PR30845. We extract the knownbits for each 'small element' part and concatenate the results together.

I have the code ready for 'large element' scalar/vector to 'small element' vector bitcasting as well if you think it worth adding to this patch now before we have any useful test cases.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon updated this revision to Diff 79300.Nov 25 2016, 6:46 AM
RKSimon retitled this revision from to [SelectionDAG] Add partial BITCAST support to computeKnownBits.
RKSimon updated this object.
RKSimon set the repository for this revision to rL LLVM.
RKSimon added a subscriber: llvm-commits.
efriedma added inline comments.
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
2174

(Phabricator won't let me delete this.)

2176

No testcase for a big-endian target?

2179

You're calling computeKnownBits multiple times with different SubDemandedElts to try and get more resolution out of it? Does that actually do anything useful in practice, as opposed to calling it once? If it does, please put the explanation in a comment.

RKSimon updated this revision to Diff 80584.Dec 7 2016, 5:56 AM

Updated based on Eli's comments.

lib/CodeGen/SelectionDAG/SelectionDAG.cpp
2176

I'm struggling to create a big-endian test case for this (its only happening on x86 with use of a particular 'extending' intrinsic). So I'm proposing we don't do this for non little endian targets for now.

efriedma accepted this revision.Dec 7 2016, 12:02 PM
efriedma added a reviewer: efriedma.

LGTM.

This revision is now accepted and ready to land.Dec 7 2016, 12:02 PM
This revision was automatically updated to reflect the committed changes.