This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Teach the costmodel about widening muls
ClosedPublic

Authored by dmgreen on Apr 3 2022, 1:56 PM.

Details

Summary

A vector mul(sext, sext) or mul(zext, zext) will be code generated as a single smull or umull instruction. This most notably effects v2i64 multiplies, which are otherwise not legal and need to be expanded.

The oneuse check has also been slightly changed, as it is already checked from the use of isWideningInstruction in getCastInstrCost.

Diff Detail

Event Timeline

dmgreen created this revision.Apr 3 2022, 1:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2022, 1:56 PM
dmgreen requested review of this revision.Apr 3 2022, 1:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2022, 1:56 PM
SjoerdMeijer accepted this revision.Apr 4 2022, 1:27 AM

Looks like a good one to me.

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
1292

While we are at it, look at shl in a follow up? :)

1839–1840

Nit: we don't need the brackets?

This revision is now accepted and ready to land.Apr 4 2022, 1:27 AM

Thanks.

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
1292

I'll see what I can do about this and any others. I think they are much rarer than mul, which can come up a fair amount.

1839–1840

Oh yeah, I will remove it.

This revision was landed with ongoing or failed builds.Apr 4 2022, 4:45 AM
This revision was automatically updated to reflect the committed changes.