ARM: fix handling of SUB immediates in peephole opt.
authorTim Northover <tnorthover@apple.com>
Mon, 2 May 2016 18:30:08 +0000 (18:30 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 2 May 2016 18:30:08 +0000 (18:30 +0000)
commitc08db1840c32392725dfba26228145aac5f80ba0
tree7d07851aa3086ea516de154356c4b98956c61259
parentff12f230809162a7e8e5c3846cba2addfca8a844
ARM: fix handling of SUB immediates in peephole opt.

We were negating an immediate that was going to be used in a SUBri form
unnecessarily. Since ADD/SUB are very similar we *can* do that, but we have to
change the SUB to an ADD at the same time. This also applies to ADD, and allows
us to handle a slightly larger range of immediates for those two operations.

rdar://25992245

llvm-svn: 268276
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/test/CodeGen/MIR/ARM/imm-peephole-arm.mir [new file with mode: 0644]
llvm/test/CodeGen/MIR/ARM/imm-peephole-thumb.mir [new file with mode: 0644]