This is an archive of the discontinued LLVM Phabricator instance.

[X86] Reduce some patterns by using FP instructions for integer types even when AVX2 is available and execution domain fixing will do the right thing
ClosedPublic

Authored by craig.topper on Feb 20 2019, 12:31 PM.

Details

Summary

We have quite a few cases of using FP instructions for integer operations when only AVX1 is available. Then we switch to integer instructions with AVX2. In a lot of these cases execution domain fixing will take care of turning FP instructions into integer if its profitable.

With this patch we just keep on using the FP instructions even with AVX2. I've only handled some cases that don't require messing with patterns that are defined in the instruction definition. Those will require more subtle multiclass work possibly involving null_frag, hasSideEffects = 0, etc.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 20 2019, 12:31 PM

Here you're making more use of the domain pass to reduce isel patterns, but in rL354511 you added isel patterns to avoid the load folding pass - what's the difference?

I’ve never understood if the peephole pass is as powerful at folding loads as SelectionDAG. I added the extra patterns to make sure AVX1 and 2 were being handled in a consistent way.

I do know that the execution domain fixing pass is going to make a domain decision for these instructions regardless of what instruction we started with. Though I guess it doesn’t run in O0 so maybe we should pick the best domain in isel?

RKSimon accepted this revision.Feb 25 2019, 4:05 AM

LGTM - as long as you are happy with the potential -O0 domain changes.

In my experience, load folding seems to get most things right but there are some cases (MOVSD vs BLENDPD etc.) where we struggle to recover from.

This revision is now accepted and ready to land.Feb 25 2019, 4:05 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2019, 5:13 PM