[PowerPC] Implement the vpopcnt instructions for POWER8
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Tue, 3 Feb 2015 21:58:23 +0000 (21:58 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Tue, 3 Feb 2015 21:58:23 +0000 (21:58 +0000)
commitfe88b189905e95027a747a653bf77ed03869208b
tree7c60410622c68e07b53c787f53f0e5a69dba3c37
parentcf9fdd58763580af4c3ef851dac8016883350480
[PowerPC] Implement the vpopcnt instructions for POWER8

Patch by Kit Barton.

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

    PPCISelLowering.cpp: Make CTPOP legal for vector types.
    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.

Test Plan

Test the instruction vpcnt* encoding/decoding in ppc64-encoding-vmx.s

Test the generation of the vpopcnt instructions for various vector
data types.  When adding the v2i64 type to the Vector Register set, I
also needed to add the appropriate bit conversion patterns between
v2i64 and the existing vector types.  Testing for these conversions
were also added in the test case by passing a different vector type as
a parameter into the test functions.  There is also a run step that
will ensure the vpopcnt instructions are generated when the vsx
feature is disabled.

llvm-svn: 228046
llvm/lib/Target/PowerPC/PPC.td
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCInstrAltivec.td
llvm/lib/Target/PowerPC/PPCRegisterInfo.td
llvm/lib/Target/PowerPC/PPCSubtarget.cpp
llvm/lib/Target/PowerPC/PPCSubtarget.h
llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt
llvm/test/MC/PowerPC/ppc64-encoding-vmx.s