This is an archive of the discontinued LLVM Phabricator instance.

[Power9] Exploit D-form vector load/store
ClosedPublic

Authored by syzaara on May 16 2017, 10:44 AM.

Details

Summary

The new d-form vector load/store instructions lxv/stxv can be used in place of the x-form instructions lxvx/stxvx when the offset is an immediate. This patch adds the tlbgen patterns to exploit the new instructions. It also changes the existing instructions addressing mode from xoaddr to xaddr so a register + immediate can be selected rather than register + register only. This patch has also been functionally tested on Power9.

Diff Detail

Event Timeline

syzaara created this revision.May 16 2017, 10:44 AM
echristo added a subscriber: echristo.
timshen accepted this revision.EditedMay 16 2017, 1:52 PM

As a side node, the CHECKs may be generated and updated using llvm/util/update_llc_test_checks.py automatically.

lib/Target/PowerPC/PPCInstrVSX.td
2516

Why xoaddr -> xaddr change? AFAIK LXVX doesn't accept immediates, does it?

This revision is now accepted and ready to land.May 16 2017, 1:52 PM
timshen requested changes to this revision.May 16 2017, 1:53 PM

Undo LGTM, since I had a question regarding xoaddr.

This revision now requires changes to proceed.May 16 2017, 1:53 PM
syzaara added inline comments.May 16 2017, 2:04 PM
lib/Target/PowerPC/PPCInstrVSX.td
2516

LXVX doesn't accept immediates, but the addressing mode xaddr checks if this instruction can be better represented with a register + immediate rather than register + register. Since we now have a d-form instruction, LXVX can be changed to xaddr and if the register + immediate is possible, it will be changed to used LXV. With xoaddr, only register + register is used, even if the input is an immediate.

timshen accepted this revision.May 16 2017, 2:17 PM
timshen added inline comments.
lib/Target/PowerPC/PPCInstrVSX.td
2516

I see, thanks for the explanation!

My understanding is that there are passes that generates LXVX without necessarily going through an ISD::LOAD, and we want to optimize for those as well.

This revision is now accepted and ready to land.May 16 2017, 2:17 PM
nemanjai added inline comments.May 17 2017, 5:11 PM
lib/Target/PowerPC/PPCInstrVSX.td
2348

You should probably look into what this is used for. I remember not adding the scalar D-Forms to that map and had very hard to debug problems. But I don't remember how the problems manifested themselves. That's why I added this comment too. I imagine you should probably add yours here as well.

2516

We should definitely look to see if there are other ways of generating an LXVX and address that if there are any.

syzaara added inline comments.May 23 2017, 8:47 AM
lib/Target/PowerPC/PPCInstrVSX.td
2348

It is already added in the ImmToIdxMap in PPCRegisterInfo::PPCRegisterInfo.

nemanjai added inline comments.May 23 2017, 10:03 AM
lib/Target/PowerPC/PPCInstrVSX.td
2348

Oh, OK cool. Then this LGTM as well.

syzaara closed this revision.Jun 1 2017, 12:51 PM