This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Fold Mul(And(Srl(X, 15), 0x10001), 0xffff) to CMLTz
ClosedPublic

Authored by dmgreen on Aug 1 2022, 1:02 AM.

Details

Summary

This folds a v4i32 Mul(And(Srl(X, 15), 0x10001), 0xffff) into a v8i16 CMLTz instruction. The Srl and And extract the top bit (whether the input is negative) and the Mul sets all values in the i16 half to all 1/0 depending on if that top bit was set. This is equivalent to a v8i16 CMLTz instruction. The same applies to other sizes with equivalent constants.

Diff Detail

Event Timeline

dmgreen created this revision.Aug 1 2022, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2022, 1:02 AM
dmgreen requested review of this revision.Aug 1 2022, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2022, 1:02 AM
samtebbs accepted this revision.Aug 2 2022, 1:46 AM

LGTM

This revision is now accepted and ready to land.Aug 2 2022, 1:46 AM
This revision was landed with ongoing or failed builds.Aug 2 2022, 5:02 AM
This revision was automatically updated to reflect the committed changes.