This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, aarch64] additional bics patterns
- From: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- To: Sandra Loosemore <sandra at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Chris Jones <chrisj at nvidia dot com>
- Date: Thu, 13 Nov 2014 17:05:26 +0000
- Subject: Re: [patch, aarch64] additional bics patterns
- Authentication-results: sourceware.org; auth=none
- References: <5464E265 dot 6050008 at codesourcery dot com>
- Reply-to: ramrad01 at arm dot com
On Thu, Nov 13, 2014 at 4:55 PM, Sandra Loosemore
<sandra@codesourcery.com> wrote:
> This patch to the AArch64 back end adds a couple of additional bics patterns
> to match code of the form
>
> if ((x & y) == x) ...;
>
> This is testing whether the bits set in x are a subset of the bits set in y;
> or, that no bits in x are set that are not set in y. So, it is equivalent
> to
>
> if ((x & ~y) == 0) ...;
>
> Presently this generates code like
> and x21, x21, x20
> cmp x21, x20
> b.eq c0 <main+0xc0>
>
> and this patch allows it to be written more concisely as:
> bics x21, x20, x21
> b.eq c0 <main+0xc0>
>
> Since the bics instruction sets the condition codes itself, no explicit
> comparison is required and the result of the bics computation can be
> discarded.
>
> Regression-tested on aarch64-linux-gnu. OK to commit?
Is this not a duplicate of
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00943.html ?
regards
Ramana
>
> -Sandra
>
>
> 2014-11-12 Sandra Loosemore <sandra@codesourcery.com>
> Chris Jones <chrisj@nvidia.com>
>
> gcc/
> * config/aarch64/aarch64.md (*and<mode>3_compare_op1): New.
> (*and<mode>3_compare_op2): New.
>
> gcc/testsuite/
> * gcc.target/aarch64/bics_3.c: New.
>
>