This is an archive of the discontinued LLVM Phabricator instance.

[MSP430] Optimize srl/sra in case of A >> (8 + N)
ClosedPublic

Authored by krisb on Nov 16 2018, 3:07 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

krisb created this revision.Nov 16 2018, 3:07 AM
efriedma added inline comments.
lib/Target/MSP430/MSP430ISelLowering.cpp
954 ↗(On Diff #174349)

I'm confused how the ZERO_EXTEND case works; you aren't even passing the right number of operands for a ZERO_EXTEND. (There is no ZERO_EXTEND_INREG because it's equivalent to an AND with the appropriate immediate. There's a helper function SelectionDAG::getZeroExtendInReg() to generate that for you.)

asl accepted this revision.Nov 16 2018, 11:25 AM
This revision is now accepted and ready to land.Nov 16 2018, 11:25 AM
asl requested changes to this revision.Nov 16 2018, 11:36 AM
asl added inline comments.
lib/Target/MSP430/MSP430ISelLowering.cpp
954 ↗(On Diff #174349)

Oh, you're right. It works here because the type operand for zext is essentially ignored and there is only a single version of i8 => i16 zext to match.

This revision now requires changes to proceed.Nov 16 2018, 11:36 AM
krisb updated this revision to Diff 174504.EditedNov 17 2018, 1:28 AM

@asl , @efriedma Thanks!

Applied comments and extended condition with 'ShiftAmount == 8'

asl accepted this revision.Nov 19 2018, 2:05 AM
This revision is now accepted and ready to land.Nov 19 2018, 2:05 AM
This revision was automatically updated to reflect the committed changes.