llvm-project/llvm/test/CodeGen/MSP430
Alexander Richardson 8f44579d0b Emit a left-shift instead of a power-of-two multiply for jump-tables
Summary:
SelectionDAGLegalize::ExpandNode() inserts an ISD::MUL when lowering a
BR_JT opcode. While many backends optimize this multiply into a shift, e.g.
the MIPS backend currently always lowers this into a sequence of
load-immediate+multiply+mflo in MipsSETargetLowering::lowerMulDiv().

I initially changed the multiply to a shift in the MIPS backend but it
turns out that would not have handled the MIPSR6 case and was a lot more
code than doing it in LegalizeDAG.
I believe performing this simple optimization in LegalizeDAG instead of
each individual backend is the better solution since this also fixes other
backeds such as MSP430 which calls the multiply runtime function
__mspabi_mpyi without this patch.

Reviewers: sdardis, atanasyan, pftbest, asl

Reviewed By: sdardis

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D45760

llvm-svn: 332439
2018-05-16 08:58:26 +00:00
..
2009-05-10-CyclicDAG.ll
2009-05-17-Rot.ll
2009-05-17-Shift.ll
2009-05-19-DoubleSplit.ll
2009-08-25-DynamicStackAlloc.ll
2009-09-18-AbsoluteAddr.ll
2009-10-10-OrImpDef.ll
2009-11-08-InvalidResNo.ll
2009-11-20-NewNode.ll
2009-12-21-FrameAddr.ll
2009-12-22-InlineAsm.ll
2010-05-01-CombinerAnd.ll
AddrMode-bis-rx.ll
AddrMode-bis-xr.ll
AddrMode-mov-rx.ll
AddrMode-mov-xr.ll
BranchSelector.ll
DbgValueOtherTargets.test
Inst8mi.ll
Inst8mm.ll
Inst8mr.ll
Inst8ri.ll
Inst8rm.ll
Inst8rr.ll
Inst16mi.ll
Inst16mm.ll
Inst16mr.ll
Inst16ri.ll
Inst16rm.ll
Inst16rr.ll
asm-clobbers.ll
bit.ll
byval.ll
cc_args.ll
cc_ret.ll
flt_rounds.ll
fp.ll
hwmult16.ll
hwmult32.ll
hwmultf5.ll
indirectbr.ll
indirectbr2.ll
inline-asm.ll
jumptable.ll Emit a left-shift instead of a power-of-two multiply for jump-tables 2018-05-16 08:58:26 +00:00
libcalls.ll
lit.local.cfg
memset.ll
misched-msp430.ll
mult-alt-generic-msp430.ll
postinc.ll
promote-i8-mul.ll
select-use-sr.ll
setcc.ll
shifts.ll
spill-to-stack.ll
struct-return.ll
struct_layout.ll
transient-stack-alignment.ll
umulo-16.ll
vararg.ll