This is an archive of the discontinued LLVM Phabricator instance.

[Power9] Implement new altivec instructions: permute, count zero, extend sign, negate, parity, shift/rotate, mul10
ClosedPublic

Authored by cycheng on Jan 5 2016, 3:45 AM.

Details

Summary

This change implements the following vector operations:

  • vclzlsbb vctzlsbb vctzb vctzd vctzh vctzw
  • vextsb2w vextsh2w vextsb2d vextsh2d vextsw2d
  • vnegd vnegw
  • vprtybd vprtybq vprtybw
  • vbpermd vpermr
  • vrlwnm vrlwmi vrldnm vrldmi vslv vsrv
  • vmul10cuq vmul10uq vmul10ecuq vmul10euq

28 instructions

Diff Detail

Event Timeline

cycheng updated this revision to Diff 43979.Jan 5 2016, 3:45 AM
cycheng retitled this revision from to [Power9] Implement new vector permute, count zero instructions.
cycheng updated this object.
cycheng added reviewers: hfinkel, kbarton, tjablin.
cycheng added a subscriber: llvm-commits.
nemanjai added inline comments.
lib/Target/PowerPC/PPCInstrAltivec.td
1217

Since P9 has fewer optional features, do we need P9Altivec, P9Vector, etc.? Or perhaps we would like a single predicate and a single feature that will give us everything? I suppose that AES and DFP are still optional, but any additions therein can use the P9 predicate along with the respective predicate.

1220

Should we have a test that @llvm.ppc.altivec.vbpermd emits the correct instruction? I suppose we can't really do that at this time unless we have the target feature implemented (see comment below).

lib/Target/PowerPC/PPCSubtarget.h
95

Was the implementation of this feature in PPC.td intentionally omitted? Is the plan to implement setting this feature using -mattr at a later time?

cycheng added inline comments.Jan 11 2016, 4:32 PM
lib/Target/PowerPC/PPCInstrAltivec.td
1217

Agree. By the way, how can I know an instruction is optional instruction?

lib/Target/PowerPC/PPCSubtarget.h
95

Thanks! It looks like I have to add "FeatureP9*" in PPC.td, I didn't notice it, I will fix it later.

nemanjai added inline comments.Jan 12 2016, 1:04 AM
lib/Target/PowerPC/PPCInstrAltivec.td
1217

The text "Category:" followed by the name of the category will be part of the instruction description or the section of the ISA. This is of course very prevalent in all versions of Power ISA up to and including 2.07. It is mostly absent from ISA 3.0.

cycheng updated this revision to Diff 44638.Jan 12 2016, 7:01 AM
  • Use single predicate for power9
  • Remove all intrinsics, we will implement them after finish P9 assembler/disassembler support
cycheng updated this revision to Diff 44743.Jan 13 2016, 5:39 AM
cycheng retitled this revision from [Power9] Implement new vector permute, count zero instructions to [Power9] Implement new altivec instructions: permute, count zero, extend sign, negate, parity, shift/rotate, mul10 .
cycheng updated this object.

Changes:

  • Follow naming convention to rename global and local instruction forms
  • Add pattern parameter for local defined instruction forms
  • Fix IsP9 position
  • Add new instructions (I plan to use 2 patches to cover all new p9 altivec instructions, so D15916 and D15917 will be merged.)
cycheng updated this revision to Diff 45950.Jan 26 2016, 12:24 AM
cycheng added a reviewer: nemanjai.
cycheng removed a subscriber: nemanjai.
  • After discuss with Kit, we change to use multiple predicate: one predicate for one feature. Because it is convenient if we want to test single feature. We can discuss on this more if you guys have other opinions.
kbarton added inline comments.Jan 27 2016, 10:44 AM
lib/Target/PowerPC/PPCInstrAltivec.td
1231

I would prefer to keep track of the questionable TODOs in a separate file, as opposed to scattering them throughout this file.
In my experience, these have a way of entering the code, but never getting cleaned up.

We talked about creating a README_P9.txt file in the lib/Target/PowerPC directory to contain this type of (possibly) outstanding items to do.

1238

Move to separate file

1246

Move to separate file.

1258

Is this referring to adding intrinsic support for this instruction, or something else?
This should apply to almost all of these instructions being added. Again, this is something we want to track in a separate file.

cycheng marked 4 inline comments as done.Jan 27 2016, 9:53 PM
cycheng added inline comments.
lib/Target/PowerPC/PPCInstrAltivec.td
1258

Yes, it is referring to adding intrinsic support.

cycheng updated this revision to Diff 46220.Jan 27 2016, 9:55 PM
cycheng marked an inline comment as done.
  • Separate TODOs into README_P9.txt
cycheng updated this revision to Diff 49156.Feb 26 2016, 1:01 AM

Rewrite README_P9.txt for conforming the discipline we have discussed in http://reviews.llvm.org/D16842#344765

kbarton accepted this revision.Mar 24 2016, 12:17 PM
kbarton edited edge metadata.

LGTM

This revision is now accepted and ready to land.Mar 24 2016, 12:17 PM

Committed r264504

cycheng closed this revision.Mar 31 2016, 5:23 PM