This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Change CTTZ vector lowering to cttz(x) = ctpop(~x & (x - 1))
ClosedPublic

Authored by RKSimon on Oct 12 2018, 1:11 PM.

Details

Summary

This patch changes the vector CTTZ lowering from:

cttz(x) = ctpop((x & -x) - 1)

to:

cttz(x) = ctpop(~x & (x - 1))

Not only does this make better use of the PANDN instruction, but it also matches the LegalizeDAG method which should allow us to remove the x86 specific code at some point in the future (we need to fit some issues with the bitcasted logic ops and CTPOP lowering first).

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Oct 12 2018, 1:11 PM
This revision is now accepted and ready to land.Oct 12 2018, 1:37 PM
This revision was automatically updated to reflect the committed changes.