This is an archive of the discontinued LLVM Phabricator instance.

[MSP430] Add codegen support for MSP430X shift instructions
Needs ReviewPublic

Authored by jozefl on Sep 29 2021, 8:51 AM.

Details

Reviewers
asl
Summary

MSP430X devices can utilize the RxxX and RxxM types of shift
instructions, which are more efficient than the default MSP430 shift
instructions. MSP430 shifts can only shift by one bit position at a
time, whilst RxxM and RxxX can shift by multiple bit positions.

RxxM shifts only support shift counts up to 4, but are cheaper than RxxX
shifts, which can shift by up to 16 bit positions. Therefore, there are
some situations where it is preferable to generate one or two RxxM
shifts instead of an RxxX shift.

RRCM and RRCX are not currently implemented as they are not required
when MSP430TargetLowering only lowers shifts with 8-bit or 16-bit
operands. They could be used in the future to improve the efficiency of
shifts for 32-bit or 64-bit operands.

Diff Detail