Page MenuHomePhabricator

[PowerPC] Fix vector_shuffle combines when inputs are scalar_to_vector of differing types.
Needs ReviewPublic

Authored by amyk on Jul 25 2022, 7:23 AM.

Details

Reviewers
power-llvm-team
nemanjai
stefanp
Group Reviewers
Restricted Project
Summary

This patch fixes the combines for vector_shuffles when either or both of its
left and right hand side inputs are scalar_to_vector nodes.

Previously, when both left and right side inputs are scalar_to_vector nodes,
the current combine could not handle this situation, as the shuffle mask was
updated incorrectly. https://reviews.llvm.org/D127818 was a temporary solution
to this issue. Now, not only does this patch aim to resolve the previous issue the
of incorrect shuffle mask adjustments respectively, it also updates any test cases
that are affected by this change.

Diff Detail

Event Timeline

amyk created this revision.Jul 25 2022, 7:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2022, 7:23 AM
amyk requested review of this revision.Jul 25 2022, 7:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2022, 7:23 AM
amyk updated this revision to Diff 452354.Aug 12 2022, 7:00 PM

Rebase patch based on new tests added within D130485.

Can you also comment on whether this was thoroughly tested on both little endian and big endian systems (bootstrap, test-suite, SPEC, additional internal tests).

llvm/lib/Target/PowerPC/PPCISelLowering.cpp
14917–14918

I don't follow why we need these here. They both seem to only be needed in the respective conditions (i.e. depending on whether the LHS/RHS are scalar_to_vector nodes). And within those conditional blocks, they are reset before they're used.

So why do we need to define them here and initialize them to the width of a vector?

llvm/test/CodeGen/PowerPC/v16i8_scalar_to_vector_shuffle.ll
267

The code for this one gets worse on big endian. Do we know why?

347

The code for this one gets worse on big endian. Do we know why?

578

The code for this one gets worse on big endian. Do we know why?

659

The code for this one gets worse on big endian. Do we know why?

1431

The code for this one gets worse on big endian. Do we know why?

1658

The code for this one gets worse on big endian. Do we know why?

There are probably a bunch of other places. Can you please review what is happening there? I'll stop adding further similar comments.

llvm/test/CodeGen/PowerPC/v4i32_scalar_to_vector_shuffle.ll
123 ↗(On Diff #452354)

The code generated for this one gets worse on all subtargets. Do we know why?