This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Exploitate the Vector Integer Average Instructions
ClosedPublic

Authored by steven.zhang on Dec 4 2019, 2:35 AM.

Details

Summary

PowerPC has instruction to do the semantics of this piece of code:

vector int foo(vector int m, vector int n) {
  return (m + n + 1) >> 1;
}

This patch is adding the match rule to select it.

Diff Detail

Event Timeline

steven.zhang created this revision.Dec 4 2019, 2:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 4 2019, 2:36 AM

Gentle ping ...

shchenz added inline comments.Dec 9 2019, 7:28 PM
llvm/test/CodeGen/PowerPC/vavg.ll
4

It would be good if add some negative cases, like if the const operand is not splat of 1s.

Add the negative tests.

shchenz accepted this revision.Dec 9 2019, 10:48 PM

LGTM. Thanks for exploiting these instructions.

This revision is now accepted and ready to land.Dec 9 2019, 10:48 PM
lkail added a subscriber: lkail.Dec 9 2019, 11:51 PM
lkail added inline comments.
llvm/lib/Target/PowerPC/PPCInstrAltivec.td
1102

nit: We'd better place pattern and result in different lines considering there might be many brackets.

This revision was automatically updated to reflect the committed changes.