diff options
| author | Jim Grosbach <grosbach@apple.com> | 2012-02-24 00:33:36 +0000 |
|---|---|---|
| committer | Jim Grosbach <grosbach@apple.com> | 2012-02-24 00:33:36 +0000 |
| commit | c01104dfbf92f941dfd3e6b931e6eabf08c1327a (patch) | |
| tree | 5e60c7dbc49275076a7c9b13d92efeda03ae069d /llvm/lib | |
| parent | 77a9255329be5d8bb8a03f3188dadb9907c6a7f3 (diff) | |
| download | bcm5719-llvm-c01104dfbf92f941dfd3e6b931e6eabf08c1327a.tar.gz bcm5719-llvm-c01104dfbf92f941dfd3e6b931e6eabf08c1327a.zip | |
Thumb2 size reduction fix for tied operands of tMUL.
The tied source operand of tMUL is the second source operand, not the
first like every other two-address thumb instruction. Special case it
in the size reduction pass to make sure we create the tMUL instruction
properly.
llvm-svn: 151315
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/ARM/Thumb2SizeReduction.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp b/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp index 4abff28f026..776d0eff5e1 100644 --- a/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp +++ b/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp @@ -597,7 +597,19 @@ Thumb2SizeReduce::ReduceTo2Addr(MachineBasicBlock &MBB, MachineInstr *MI, unsigned Reg0 = MI->getOperand(0).getReg(); unsigned Reg1 = MI->getOperand(1).getReg(); - if (Reg0 != Reg1) { + // t2MUL is "special". The tied source operand is second, not first. + if (MI->getOpcode() == ARM::t2MUL) { + if (Reg0 != MI->getOperand(2).getReg()) { + // If the other operand also isn't the same as the destination, we + // can't reduce. + if (Reg1 != Reg0) + return false; + // Try to commute the operands to make it a 2-address instruction. + MachineInstr *CommutedMI = TII->commuteInstruction(MI); + if (!CommutedMI) + return false; + } + } else if (Reg0 != Reg1) { // Try to commute the operands to make it a 2-address instruction. unsigned CommOpIdx1, CommOpIdx2; if (!TII->findCommutedOpIndices(MI, CommOpIdx1, CommOpIdx2) || |

