This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Add missing patterns for DSP muls
ClosedPublic

Authored by samparker on Dec 21 2018, 2:35 AM.

Details

Summary

Using a PatLeaf for sext_16_node allowed matching smulbb and smlabb instructions once the operands had been sign extended. But we also need to use sext_inreg operands allow with sext_16_node to catch a few more cases that enable use to remove the unnecessary sxth.

Diff Detail

Event Timeline

samparker created this revision.Dec 21 2018, 2:35 AM
efriedma added inline comments.Dec 21 2018, 12:22 PM
lib/Target/ARM/ARMInstrThumb2.td
2754

Does ISel automatically match the commuted version? (IIRC it does, but I haven't looked in a while.)

Could you use "PatFrags" to make a pattern that's either a sext_inreg or a sext_16_node, so you don't have to repeat these patterns? I haven't actually tried something like that, but I think it's possible.

samparker updated this revision to Diff 179761.Dec 31 2018, 7:25 AM

Hi Eli,

Thanks for taking a look. Yes, the operands can be commuted and it's why the tests accept top-bottom and bottom-top muls in those tests. I've now also added a few extra tests with swapped operands.

I've tried to combine these patterns before into something nicer, without luck and again I've tried and failed... The errors given by tablegen leave me baffled: I seem to be hitting a problem using 'PatFrags' matching a 'PatFrag' and a 'PatLeaf' and also some kind of type errors that I haven't seen before! However, I have created some PatFrags for the muls to simplify the descriptions.

efriedma accepted this revision.Jan 7 2019, 3:08 PM

LGTM

This revision is now accepted and ready to land.Jan 7 2019, 3:08 PM
This revision was automatically updated to reflect the committed changes.