This is an archive of the discontinued LLVM Phabricator instance.

[X86] Don't use popcnt for parity if only bits 7:0 of the input can be non-zero.
ClosedPublic

Authored by craig.topper on Oct 6 2021, 10:42 AM.

Details

Summary

Without popcnt we had a special case for using the parity flag from a single test i8 test instruction if only bits 7:0 could be non-zero. That special case is still useful when we have popcnt.

To reach this special case, we enable custom lowering of parity for i16/i32/i64 even when popcnt is enabled. The check for POPCNT being enabled is now after the special case in LowerPARITY.

Fixes PR52093

Diff Detail

Event Timeline

craig.topper created this revision.Oct 6 2021, 10:42 AM
craig.topper requested review of this revision.Oct 6 2021, 10:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2021, 10:42 AM
spatel added inline comments.Oct 6 2021, 10:51 AM
llvm/test/CodeGen/X86/parity.ll
2–5

Add shared prefixes for any "X86" and "X64" to reduce the duplicated check lines?

Rebase after adding X86 and X64 check prefixes

spatel accepted this revision.Oct 6 2021, 11:57 AM

LGTM - thanks!

This revision is now accepted and ready to land.Oct 6 2021, 11:57 AM