[PATCH][AArch64] Use SUBS for parallel subtraction and comparison with immediate

Kyrill Tkachov kyrylo.tkachov@foss.arm.com
Fri Apr 21 08:39:00 GMT 2017


Hi all,

Our sub<mode>3_compare1 pattern is not enough to catch cases where we subtract an immediate
and compare against in PARALLEL. This is due to the RTL canonicalisation rules that require
subtractions of immediate IMM be represented as (plus x -IMM).
So we need a bit of trickery to catch those cases and this patch does that.
It adds a new define_insn to match the plus-negatable-immediate in parallel with a comparison
and a peephole that will bring the two together when possible.
Otherwise it's pretty straightforward.

The testcase in the patch now generates a single SUBS-immediate instead of a SUB followed by a CMP.

Bootstrapped and tested on aarch64-none-linux-gnu.

Ok for GCC 8?

Thanks,
Kyrill

2017-04-21  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* config/aarch64/aarch64.md (sub<mode>3_compare1_imm): New define_insn.
	(peephole2): New peephole2 to emit the above.
	* config/aarch64/predicates.md (aarch64_sub_immediate): New predicate.

2017-04-21  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* gcc.target/aarch64/subs_compare_2.c: New test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: aarch64-subs-plus.patch
Type: text/x-patch
Size: 2968 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170421/ea07bb10/attachment.bin>


More information about the Gcc-patches mailing list