This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Attachment: add_commutative.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]