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]

Re: [PATCH][AArch64] Properly handle mvn-register and add EON+shift pattern and cost appropriately


Ping.
https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01434.html

Thanks,
Kyrill

On 23/04/15 17:57, Kyrill Tkachov wrote:
[resending due to mail client messing up.]

Hi all,

The EON instruction can be expressed either by (xor (not a) b) or (not (xor
a b)),
simplify-rtx canonicalizes to the second form and we have a pattern for it
(*xor_one_cmpl<mode>3) but we don't have a pattern for the shifted operand
version. This patch adds that pattern as well as the proper handling of it
in
aarch64_rtx_costs. The zero-extend version of it is also added.

While we're in the NOT case of rtx costs this patch also
corrects the costing of MVN+shift operations.

With this patch, for C code:
unsigned long
baz (unsigned int a, unsigned int b)
{
   return ~(a ^ (b << 6));
}

unsigned long
foo (unsigned long a, unsigned long b)
{
   return ~(a ^ (b >> 24));
}


we now generate:
baz:
	eon	w0, w0, w1, lsl 6
	ret

foo:
	eon	x0, x0, x1, lsr 24
	ret

instead of the previous:
baz:
	eor	w0, w0, w1, lsl 6
	mvn	w0, w0
	uxtw	x0, w0
	ret

foo:
	eor	x0, x0, x1, lsr 24
	mvn	x0, x0
	ret


Bootstrapped and tested on aarch64-linux.
Ok for trunk?
Thanks,
Kyrill

2015-04-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* config/aarch64/aarch64.md
(*eor_one_cmpl_<SHIFT:optab><mode>3_alt):
	New pattern.
	(*eor_one_cmpl_<SHIFT:optab>sidi3_alt_ze): Likewise.
	* config/aarch64/aarch64.c (aarch64_rtx_costs): Handle MVN-shift
	appropriately.  Handle alternative EON form.


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