[patch, aarch64] additional bics patterns
Sandra Loosemore
sandra@codesourcery.com
Thu Nov 13 16:59:00 GMT 2014
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?
-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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aarch64-bics.patch
Type: text/x-patch
Size: 2989 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141113/240803eb/attachment.bin>
More information about the Gcc-patches
mailing list