This is an archive of the discontinued LLVM Phabricator instance.

[x86] avoid cmov in movmsk reduction
ClosedPublic

Authored by spatel on Mar 26 2019, 6:54 AM.

Details

Summary

This is probably the least important of our movmsk problems, but I'm starting at the bottom to reduce distractions.

We were creating a select_cc which bypasses the select and bitmask codegen optimizations that we have now. If we produce a compare+negate instead, we allow things like neg/sbb carry bit hacks, and in all cases we avoid a cmov. There's no partial register update danger in these sequences because we always produce the zero-register xor ahead of the 'set' if needed.

There seems to be a missing fold for sext of a bool bit here:

negl %ecx
movslq %ecx, %rax

...but that's an independent transform.

Diff Detail

Event Timeline

spatel created this revision.Mar 26 2019, 6:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 26 2019, 6:54 AM
RKSimon accepted this revision.Mar 28 2019, 4:59 AM

LGTM - but that neg+movslq issue really needs fixing before we forget

This revision is now accepted and ready to land.Mar 28 2019, 4:59 AM
This revision was automatically updated to reflect the committed changes.

LGTM - but that neg+movslq issue really needs fixing before we forget

rL357178
Might be able to generalize on that, but I matched the negation case since we saw it here.
We also miss this in instcombine...