This is an archive of the discontinued LLVM Phabricator instance.

[X86] Make the code that creates fmaddsub from build_vector of extracts and inserts functional and add tests.
ClosedPublic

Authored by craig.topper on Dec 12 2017, 2:26 PM.

Details

Summary

We had no tests for this and we couldn't do the optimization because of a bad use count check. We need to know how many non-undef pieces of the build vector were filled in and ensure our use count is equal to that. But on the shuffle combine version we need the use count to be 2.

The missing coverage was noticed during the review of D40335.

Diff Detail

Event Timeline

craig.topper created this revision.Dec 12 2017, 2:26 PM

Worth adding the fmsubadd tests now (or as a follow up)?

lib/Target/X86/X86ISelLowering.cpp
29717

Doesn't the ExpectedUses have to be 2/4/8 for xmm/ymm/zmm (double)? and 4/8/16 for float?

I'll add the fsubadd tests as a follow up.

lib/Target/X86/X86ISelLowering.cpp
29717

This call site is for matching a shuffle that interleaves a single fadd and fsub result together. So the only users of the fmul should be the full vector width fadd and fsub. The number of elements doesn't matter.

RKSimon accepted this revision.Dec 17 2017, 4:18 AM

LGTM the only other thing that might be useful is for test cases with some missing/UNDEF insertelements

This revision is now accepted and ready to land.Dec 17 2017, 4:18 AM
This revision was automatically updated to reflect the committed changes.