On Fri, 2011-05-20 at 18:06 +0200, Chung-Lin Tang wrote: > On 2011/5/20 11:45 AM, Dmitry Plotnikov wrote: > > This patch adds support for 12-bit immediate values for Thumb-2 in ADD and > > SUB instructions. We added two new alternatives for *arm_addsi3 which > > make use of two new constraints for 12-bit values. Also we modified > > costs of PLUS rtx expression. > > This patch reduces size of libevas by 1788 bytes (from 464916 to > > 463128), and sqlite by 54 bytes (from 266156 to 266052). > > Regtested with Cortex-A8 QEMU. > > > > Ok for trunk? > > > > Andrew Stubbs seem to have another patch related to ADDW/SUBW support, > which I think is not yet committed to trunk. I have not yet studied how > this patch and Andrew's relate. > > That aside, I think the style of adding new alternatives for this > purpose is a little unneeded. I suggest: > > 1) Abstract out const_ok_for_arm() into const_ok_for_arm_outer() with an > OUTER rtx code argument, and a const_ok_for_arm() with OUTER passed 0. > > 2) Within const_ok_for_arm_outer(), test for OUTER==PLUS and > TARGET_THUMB2 as needed. > > 3) Migrate from const_ok_for_arm() to const_ok_for_arm_outer() as > needed: in pattern conditions, etc.
We already have const_ok_for_op, which already does this sort of thing. R. > > I'll also note here that ADD/SUB are not the only instructions with > 12-bit immediate under Thumb-2; so does AND, ORR, etc. > > Chung-Lin >