This is an archive of the discontinued LLVM Phabricator instance.

[ARM][MVE] Add VHADD and VHSUB patterns
ClosedPublic

Authored by samparker on Mar 30 2020, 8:37 AM.

Details

Summary

Add patterns, for two vector operands, that use a normal add node along with an arm vshr imm node.

Diff Detail

Event Timeline

samparker created this revision.Mar 30 2020, 8:37 AM

We had these patterns before and took them out because they were not correct. My understanding is that these instructions do trunc(shift(add(sext(a), sext(b)), 1)). They internally operate in a higher bitwidth than we natively have.

See rGe9e1daf2b9e800c00a3c08db53650c1569288a1b for the revert, which includes some examples in the commit message. I think I left the tests in for them though.

Maybe there's something we can do here with no wrap flags? Or patterns with extensions in them?

Ah yes, now I see '[esize:1]' has the result bit range. That's a bit annoying, but quite cool... I think using no wrap flags sounds neater, as I can just add a PatFrag. I guess I should emit the i8 patterns though as they won't trigger?

Now checking for non wrap flags on the add and sub.

Seems OK, from what I can tell. And http://volta.cs.utah.edu:8080/z/8mUFbh says this is OK. My fuzzer really isn't going to like it, but that's a separate issue!

llvm/lib/Target/ARM/ARMInstrMVE.td
2089

Can you add a comment about how this instruction is using a higher bitwidth type, and the nowrap makes sure we don't overflow when only dealing with lower bitwidth?

samparker updated this revision to Diff 257628.Apr 15 2020, 1:59 AM

Moved the PatFrags together and added a comment.

dmgreen accepted this revision.Apr 16 2020, 7:04 AM

LGTM thanks.

This revision is now accepted and ready to land.Apr 16 2020, 7:04 AM
This revision was automatically updated to reflect the committed changes.