This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Select (srl (sext_inreg X, i32), uimm5) to SRAIW if only lower 32 bits are used.
ClosedPublic

Authored by craig.topper on Sep 2 2021, 8:54 AM.

Details

Summary

SimplifyDemandedBits can turn srl into sra if the bits being shifted
in aren't demanded. This patch can recover the original sra in some cases.

I've renamed the tablegen class for detecting W users since the "overflowing operator"
term I originally borrowed from Operator.h does not include srl.

Diff Detail