This is an archive of the discontinued LLVM Phabricator instance.

[X86] Enable promotion of i16 popcnt (PR52056)
ClosedPublic

Authored by xbolva00 on Oct 10 2021, 4:56 AM.

Diff Detail

Event Timeline

xbolva00 created this revision.Oct 10 2021, 4:56 AM
xbolva00 requested review of this revision.Oct 10 2021, 4:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2021, 4:56 AM
xbolva00 retitled this revision from [X86] Enable promotion of i16 popcnt to [X86] Enable promotion of i16 popcnt (PR52056).Oct 10 2021, 4:56 AM
xbolva00 edited the summary of this revision. (Show Details)
craig.topper added inline comments.Oct 10 2021, 9:31 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
2665

This should be isLegalOrPromoted

llvm/test/CodeGen/X86/parity-vec.ll
21

This is a pretty big regression. My other comment will fix it. But I don’t understand why you would submit a patch without mentioning these regressions in the description.

xbolva00 updated this revision to Diff 378516.Oct 10 2021, 9:49 AM

Use isOperationLegalOrPromote.

xbolva00 added inline comments.Oct 10 2021, 9:50 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
2665

Yeah.

llvm/test/CodeGen/X86/parity-vec.ll
21

Sorry, I should have been more loud about this regression to be not overlooked.

RKSimon added inline comments.Oct 11 2021, 3:02 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
434

Please add a comment explaining why we don't use popcntw

xbolva00 added inline comments.Oct 13 2021, 2:58 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
434

So something like for both i8/i16

"The 32-bit version is shorter to encode and the zext we emit for the promotion is likely going to be a 32-bit zero extend anyway." ?

RKSimon added inline comments.Oct 13 2021, 3:28 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
434

Shouldn't it only refer to i16?

"The 32-bit version is shorter to encode than popcntw, ..."

xbolva00 added inline comments.Oct 13 2021, 3:43 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
434

Yeah right :)

craig.topper added inline comments.Oct 13 2021, 9:36 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
434

popcntw also has a false dependency on the dest that popcntl hasn't had since Cannon Lake.

xbolva00 updated this revision to Diff 379512.Oct 13 2021, 1:24 PM

Added code comment.

xbolva00 marked an inline comment as done.Oct 13 2021, 1:24 PM
RKSimon accepted this revision.Oct 14 2021, 12:31 PM

LGTM - cheers

This revision is now accepted and ready to land.Oct 14 2021, 12:31 PM
This revision was landed with ongoing or failed builds.Oct 15 2021, 6:41 AM
This revision was automatically updated to reflect the committed changes.