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] additional bics patterns


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.
>
>


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