On 2011/5/20 下午 12:10, Richard Earnshaw wrote: > > 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 see now. Andrew's patch seems to be exactly adding this kind of constant support for const_ok_for_op(). CL