This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Implement miscellaneous vector logical operations introduced in POWER8
ClosedPublic

Authored by kbarton on Feb 6 2015, 8:27 AM.

Details

Summary

This change implements the following three logical vector operations:

  • veqv (vector equivalence)
  • vnand
  • vorc

I increased the AddedComplexity for these instructions to 500 to ensure they are generated instead of issuing other VSX instructions.

Diff Detail

Event Timeline

kbarton updated this revision to Diff 19485.Feb 6 2015, 8:27 AM
kbarton retitled this revision from to [PowerPC] Implement miscellaneous vector logical operations introduced in POWER8.
kbarton updated this object.
kbarton edited the test plan for this revision. (Show Details)
kbarton added reviewers: hfinkel, wschmidt, seurer, nemanjai.
kbarton added a subscriber: Unknown Object (MLST).
wschmidt edited edge metadata.Feb 6 2015, 8:53 AM

This LGTM -- could you expand on the FIXME to indicate what we discussed the other day? I.e., that the patterns should be differentiated by HasVSX and !HasVSX so that uses of AddedComplexity are minimized?

hfinkel accepted this revision.Feb 6 2015, 9:00 AM
hfinkel edited edge metadata.

This LGTM -- could you expand on the FIXME to indicate what we discussed the other day? I.e., that the patterns should be differentiated by HasVSX and !HasVSX so that uses of AddedComplexity are minimized?

LGTM too. My hope is that if we disable competing Altivec patterns when VSX is enabled (thus allowing the VSX patterns to be selected, which reduces register pressure), then we won't need the added complexity for the VSX patterns at all. Another option might be to treat the added complexity for VSX patterns in a more principled way (adding only 1 or 2 under the theory that using VSX over Altivec could save one or two extra copies from the register allocator).

This revision is now accepted and ready to land.Feb 6 2015, 9:00 AM

How is the following:

FIXME: Use AddedComplexity > 400 to ensure these patterns match before the
VSX equivalents. We need to fix this up at some point. Two possible
solutions for this problem:
1. Disable Altivec patterns that compete with VSX patterns using the
!HasVSX predicate. This essentially favours VSX over Altivec, in
hopes of reducing register pressure (larger register set using VSX
instructions then VMX instructions)
2. Employ a more disciplined use of AddedComplexity, which would provide
more fine-grained control then option 1. This would be beneficial
if we find situations where Altivec is really preferred over VSX.

How is the following:

FIXME: Use AddedComplexity > 400 to ensure these patterns match before the
VSX equivalents. We need to fix this up at some point. Two possible
solutions for this problem:
1. Disable Altivec patterns that compete with VSX patterns using the
!HasVSX predicate. This essentially favours VSX over Altivec, in
hopes of reducing register pressure (larger register set using VSX
instructions then VMX instructions)
2. Employ a more disciplined use of AddedComplexity, which would provide
// more fine-grained control then option 1. This would be beneficial

then -> than

// if we find situations where Altivec is really preferred over VSX.

LGTM, thanks!

kbarton closed this revision.Feb 10 2015, 8:47 AM

Patch submitted in r228580.