Page MenuHomePhabricator

Implement the vpopcnt instructions for POWER8
ClosedPublic

Authored by kbarton on Jan 29 2015, 2:45 PM.

Details

Summary

Add the vector population count instructions for byte, halfword, word, and doubleword sizes.
There are two major changes here:

  1. PPCISelLowering.cpp: Make CTPOP legal for vector types.
  2. PPCRegisterInfo.td: Added v2i64 to the VRRC register definition. This is needed for the doubleword variations of the integer ops that were added in P8.

Diff Detail

Event Timeline

kbarton updated this revision to Diff 18991.Jan 29 2015, 2:45 PM
kbarton retitled this revision from to Implement the vpopcnt instructions for 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).
kbarton updated this revision to Diff 18997.Jan 29 2015, 3:10 PM

Replaced tabs with spaces in some of the modified lines.

hfinkel edited edge metadata.Jan 30 2015, 4:41 AM

This look pretty good, a few minor things below...

You're missing the disassembler tests (test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt).

lib/Target/PowerPC/PPC.td
321–322

Don't you need to add FeatureP8Altivec here too?

lib/Target/PowerPC/PPCISelLowering.cpp
405

We don't need the { } here, please remove them (this is the general LLVM style preference).

602

Same here (no { } ).

test/CodeGen/PowerPC/vec_popcnt.ll
17

For all of these tests, please check the register numbers on the vpopcnt* instructions. They're fixed by the calling convention, and specifically, I want to make sure that there are no extra moves being generated around them.

kbarton updated this revision to Diff 19160.Feb 2 2015, 8:23 AM
kbarton edited edge metadata.

Addressed Hal's comments.
One additional change - I realized the vpopcnt instructions were predicated on HasAltivec, so it would be possible to generate them when they are not available. I added a new HasP8Altivec predicate at the end of PPCInstrAltivec.td and moved the definitions of the vpopcnt* instructions to there.

I realized this afternoon that this patch conflicts slightly with a patch Nemanja put in next week. Specifically, the FeatureP8Altivec needs to be added in a slightly different place now. This doesn't change the behaviour of the patch in any way, just a slight change in the location of the update.

hfinkel accepted this revision.Feb 2 2015, 7:52 PM
hfinkel edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Feb 2 2015, 7:52 PM
wschmidt closed this revision.Feb 3 2015, 2:03 PM
wschmidt edited edge metadata.

Committed on Kit's behalf as r228046.