This is an archive of the discontinued LLVM Phabricator instance.

[SDAG] Vector op legalization for overflow ops
ClosedPublic

Authored by nikic on May 8 2019, 12:17 PM.

Details

Summary

Fixes issue reported by @aemerson on D57348. Vector op legalization support is added for uaddo, usubo, saddo and ssubo (umulo and smulo were already supported). As usual, by extracting TargetLowering methods and calling them from vector op legalization.

Vector op legalization doesn't really deal with multiple result nodes, so I'm explicitly performing a recursive legalization call on the result value that is not being legalized (this was also missing for the mulo case, which I've fixed as well).

There are lots of existing test changes. I haven't looked too closely at these, I think this is because expansion happens earlier, so we don't get a DAG combiner run in between anymore.

Diff Detail

Event Timeline

nikic created this revision.May 8 2019, 12:17 PM
craig.topper added inline comments.May 8 2019, 1:54 PM
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
423

It's interesting that we even pretend to handle SMUL_LOHI/UMUL_LOHI/SDIVREM/UDIVREM in this file. They aren't explicitly handled in Expand and will fall back to UnrollVectorOp which doesn't support multiple results. But I suspect we never create vector versions of theses nodes if they aren't marked Legal/Custom.

maybe pull out the MULO changes as another patch to be addressed first?

nikic updated this revision to Diff 199079.May 10 2019, 1:44 PM

Rebase over D61744.

aemerson accepted this revision.May 16 2019, 9:56 AM

LGTM if no one else has comments.

This revision is now accepted and ready to land.May 16 2019, 9:56 AM
RKSimon accepted this revision.May 16 2019, 10:27 AM

LGTM - I can fix the avx packss/pshufb shuffle regressions as followup

This revision was automatically updated to reflect the committed changes.