This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add a DAG combine to pre-promote (i32 (and (srl X, Y), 1)) with Zbs on RV64.
ClosedPublic

Authored by craig.topper on Apr 20 2022, 10:30 AM.

Details

Summary

Type legalization will want to turn (srl X, Y) into RISCVISD::SRLW,
which will prevent us from using a BEXT instruction.

I don't think there is any precedent for type promotion checking
users to decide how to promote. Instead, I've added this DAG combine to
do it before type legalization.

Diff Detail

Event Timeline

craig.topper created this revision.Apr 20 2022, 10:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2022, 10:30 AM
craig.topper requested review of this revision.Apr 20 2022, 10:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2022, 10:30 AM

Make sure shift amount is non-constant to prevent infinite loops.

asb accepted this revision.May 11 2022, 7:29 AM

LGTM. Thanks Craig!

This revision is now accepted and ready to land.May 11 2022, 7:29 AM
This revision was landed with ongoing or failed builds.May 11 2022, 10:57 AM
This revision was automatically updated to reflect the committed changes.