Page MenuHomePhabricator

[PowerPC] Exploitate the Vector Integer Average Instructions

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



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

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.

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.