Page MenuHomePhabricator

Implement the vpopcnt instructions for POWER8

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



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. 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).


Don't you need to add FeatureP8Altivec here too?


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


Same here (no { } ).


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 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.


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.