[PATCH][ARM] Fix bug in add patterns due to commutativity modifier

Richard Earnshaw rearnsha@arm.com
Thu Jul 25 16:17:00 GMT 2013


On 25/07/13 16:31, Kyrylo Tkachov wrote:
> Hi all,
>
> Some of the new alternatives added to the add patterns in arm.md recently to
> accommodate 16-bit encodings have the output template "add %0, %2" if operand
> 1 is the same register as the destination (operand 0). This would be fine,
> except that the two source operands for the add patterns are commutative, i.e.
> they have the '%' modifier that tells the optimisers that they can swap
> operands 1 and 2 without consequence. This will lead to incorrect code if we
> are not printing out operand 1.
>
> This patch fixes that oversight. Gas is smart enough to use the 16-bit
> encoding when it sees one of the sources being the same as the destination.
>
> Bootstrapped on arm-linux-gnueabihf and regtested on arm-none-eabi.
>
> Ok for trunk?
>
> Thanks,
> Kyrill
>
> 2013-07-25  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
> 	* config/arm/arm.md (arm_addsi3,
> 	addsi3_carryin_<optab> and addsi3_carryin_alt2_<optab>):
> 	Correct output template.
>
>

OK.

R.




More information about the Gcc-patches mailing list