This is an archive of the discontinued LLVM Phabricator instance.

[CostModel] Handle CTLZ and CCTZ in getTypeBasedIntrinsicInstrCost
ClosedPublic

Authored by sdesmalen on Jan 25 2021, 6:12 AM.

Diff Detail

Event Timeline

sdesmalen requested review of this revision.Jan 25 2021, 6:12 AM
sdesmalen created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2021, 6:12 AM
dmgreen accepted this revision.Jan 25 2021, 7:55 AM

Sounds good. The costs are a little wonky for MVE (CTLZ is legal but CTTZ is custom lowered to 3 or so instructions), but they are much better then they were before!

LGTM

This revision is now accepted and ready to land.Jan 25 2021, 7:55 AM

I guess these costs look more reasonable compared to their scalar counterparts, though I don't think we have cttz for MVE. But as a general query, if these are being scalarized why isn't the cost 16? It looks like it could just be the accumulation costs of the scalar parts. Or have I missed something?

It's not scalarized. Like I said it's custom lowered to a bitreverse (plus a mov) and a ctlz so 3 instructions in general.

This revision was landed with ongoing or failed builds.Jan 26 2021, 6:38 AM
This revision was automatically updated to reflect the committed changes.