This is an archive of the discontinued LLVM Phabricator instance.

[AVX-512] Add support for changing the element size of PALIGNR/VALIGND/VALIGNQ shuffles if they feed a vselect with a different type
ClosedPublic

Authored by craig.topper on Nov 20 2016, 4:44 PM.

Details

Summary

Shuffle lowering widens the element size of a shuffle if elements are contiguous. This is sometimes help because wider element types have more shuffle options. If the shuffle is one of the arguments to a vselect this shuffle widening can introduce a bitcast between the vselect and the shuffle. This will prevent isel from selecting a masked operation. If the shuffle can be written equally efficiently with a different element size to match the vselect type we should change the shuffle type to allow masking.

This patch does this conversion for all VALIGND/VALIGNQ sizes. It also supports turning 128-bit PALIGNR into VALIGND/VALIGNQ.

I plan to add support for more operations in future patches.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper retitled this revision from to [AVX-512] Add support for changing the element size of PALIGNR/VALIGND/VALIGNQ shuffles if they feed a vselect with a different type.
craig.topper updated this object.
craig.topper added reviewers: RKSimon, delena, zvi.
craig.topper added a subscriber: llvm-commits.
delena added inline comments.Nov 20 2016, 11:25 PM
lib/Target/X86/X86ISelLowering.cpp
27803 ↗(On Diff #78675)

What happens with FP types? Can we do the same?

craig.topper added inline comments.Nov 20 2016, 11:36 PM
lib/Target/X86/X86ISelLowering.cpp
27803 ↗(On Diff #78675)

That would result in making the VALIGN node have floating point type which we don't have patterns for today.

delena accepted this revision.Nov 20 2016, 11:44 PM
delena edited edge metadata.
delena added inline comments.
lib/Target/X86/X86ISelLowering.cpp
27803 ↗(On Diff #78675)

I think we can add FP types to VALIGN.

This revision is now accepted and ready to land.Nov 20 2016, 11:44 PM
This revision was automatically updated to reflect the committed changes.