This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Legalize narrow type G_CTPOPs
ClosedPublic

Authored by paquette on Apr 20 2021, 4:16 PM.

Details

Summary

Using clampScalar here because we ought to mark s128 as custom eventually.

(Right now, it will just fall back.)

With this legalization, we get the same code as SDAG: https://godbolt.org/z/TneoPKrKG

Diff Detail

Event Timeline

paquette created this revision.Apr 20 2021, 4:16 PM
paquette requested review of this revision.Apr 20 2021, 4:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2021, 4:16 PM
jroelofs added inline comments.Apr 20 2021, 5:44 PM
llvm/test/CodeGen/AArch64/GlobalISel/legalize-ctpop.mir
125

Can we emit a COPY (or an extract?) instead of the uaddlv since all but one lane are guaranteed to be zero in the s8 case?

jroelofs added inline comments.Apr 20 2021, 6:20 PM
llvm/test/CodeGen/AArch64/GlobalISel/legalize-ctpop.mir
97

Could use the guaranteed zeroing I mentioned in the other case to emit uaddlp.4s here.

jroelofs accepted this revision.May 4 2021, 5:58 PM

LGTM. No need to gate getting GISel to parity on doing *better* than SDAG.

This revision is now accepted and ready to land.May 4 2021, 5:58 PM
This revision was automatically updated to reflect the committed changes.