This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Fix MUL/SUB fusing
ClosedPublic

Authored by sanwou01 on Dec 5 2019, 7:31 AM.

Details

Summary

When MUL is the first operand to SUB, we can't use MLS because the accumulator
should be negated. Emit a NEG of the accumulator and an MLA instead, similar to
what we do for FMUL / FSUB fusing.

Diff Detail

Event Timeline

sanwou01 created this revision.Dec 5 2019, 7:31 AM
asbirlea accepted this revision.Dec 5 2019, 10:00 AM

I have no expertise here, but this fixes PR44222 (many AArch64 internal crashes caused by D70673), so I'm going to go ahead and approve this to get the fix in tree.

This revision is now accepted and ready to land.Dec 5 2019, 10:00 AM

Great, thanks for confirming.

As it turns out, the reason why we didn't test this pattern was because we weren't matching it (before D70673): we'd just see a mul and sub.

This revision was automatically updated to reflect the committed changes.