This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Add support for (V)PMOVSX* constant folding
ClosedPublic

Authored by RKSimon on Oct 21 2016, 10:55 AM.

Details

Summary

We already have (V)PMOVZX* combining support, this is the beginning of handling (V)PMOVSX* simililarly - other combines in combineVSZext can be generalized in future patches.

This unearthed an interesting bug in that we were generating illegal build vectors on 32-bit targets - it was proving difficult to create a test for it from PMOVZX, but it fired immediately with PMOVSX. I've created a more general form of the existing getConstVector to handle these cases - ideally this should be handled in non-target-specific code but I couldn't find an equivalent.

I have wondered whether we should not fold when OptSize=true?

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon updated this revision to Diff 75450.Oct 21 2016, 10:55 AM
RKSimon retitled this revision from to [X86][SSE] Add support for (V)PMOVSX* constant folding.
RKSimon updated this object.
RKSimon added reviewers: zvi, delena, spatel, andreadb.
RKSimon set the repository for this revision to rL LLVM.
RKSimon added a subscriber: llvm-commits.
zvi edited edge metadata.Oct 22 2016, 12:26 PM

LGTM

lib/Target/X86/X86ISelLowering.cpp
31809 ↗(On Diff #75450)

'i' and 'NumDstElts' are of different types, so the comparison fire a warning.

RKSimon updated this revision to Diff 75603.Oct 24 2016, 9:52 AM
RKSimon edited edge metadata.

Fixed signed/unsigned warning.

Does anybody have further comments?

RKSimon updated this revision to Diff 75686.Oct 25 2016, 5:45 AM

Minor tidyup - removed unnecessary variable

This revision was automatically updated to reflect the committed changes.