This is an archive of the discontinued LLVM Phabricator instance.

[MIPS GlobalISel] Select population count (popcount)
ClosedPublic

Authored by Petar.Avramovic on Jan 22 2020, 10:13 AM.

Details

Summary

G_CTPOP is generated from llvm.ctpop.<type> intrinsics, clang generates
these intrinsics from builtin_popcount and builtin_popcountll.
Add lower and narrow scalar for G_CTPOP.
Lower G_CTPOP for MIPS32.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2020, 10:13 AM
arsenm added a subscriber: arsenm.Jan 22 2020, 10:35 AM
arsenm added inline comments.
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
3922

Assumes NarrowTy == OrigTy / 2. This one should be easy to handle for any divisible type.

3924

Can do just buildUnmerge(NarrowTy) assuming it's divisible

arsenm added inline comments.Jan 22 2020, 10:36 AM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
3922

Also this won't work for vector

Add check that OrigType is scalar and NarrowTy == OrigType/2. Fix build unmerge.

This revision is now accepted and ready to land.Jan 23 2020, 5:41 AM
This revision was automatically updated to reflect the committed changes.