This is an archive of the discontinued LLVM Phabricator instance.

[PPC] Prefer direct move on power8 if load 1 or 2 bytes to VSR
ClosedPublic

Authored by Carrot on Nov 30 2016, 4:11 PM.

Details

Summary

This patch fixes pr31144.

Power8 has MTVSRWZ but no LXSIBZX/LXSIHZX, so move 1 or 2 bytes to VSR through MTVSRWZ is much faster than store the extended value into stack and load it with LXSIWZX.

Diff Detail

Repository
rL LLVM

Event Timeline

Carrot updated this revision to Diff 79836.Nov 30 2016, 4:11 PM
Carrot retitled this revision from to [PPC] Prefer direct move on power8 if load 1 or 2 bytes to VSR.
Carrot updated this object.
Carrot added a reviewer: hfinkel.
Carrot added a subscriber: llvm-commits.
nemanjai added inline comments.Nov 30 2016, 4:44 PM
lib/Target/PowerPC/PPCISelLowering.cpp
6617 ↗(On Diff #79836)

This is really a property of the ISA rather than the actual CPU. I think a better way of accomplishing this would be to check that the subtarget does not have "hasP9Vector()" because that's where the LXSIBZX/LXSIHZX become available. Even if that means this has to become a member function then.

Looks good in terms of coding standards.

Carrot updated this revision to Diff 79991.Dec 1 2016, 3:13 PM
Carrot marked an inline comment as done.

Other than the inline comment, I think this patch is fine but I'll let Hal have a look for the official stamp of approval.

test/CodeGen/PowerPC/pr31144.ll
14 ↗(On Diff #79991)

This will just check that you don't have an LXSIWZX after the move. I think you don't want this instruction emitted in this test case at all. So it's probably better to use --implicit-check-not in the FileCheck invocation.

hfinkel accepted this revision.Dec 12 2016, 1:06 AM
hfinkel edited edge metadata.

Other than the inline comment, I think this patch is fine but I'll let Hal have a look for the official stamp of approval.

In that case, fine by me too.

This revision is now accepted and ready to land.Dec 12 2016, 1:06 AM
Carrot updated this revision to Diff 81139.Dec 12 2016, 2:16 PM
Carrot edited edge metadata.
Carrot marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.