This patch is designed to improve code generation for "and" instructions with certain immediate operands.
For the following test case: int f2(int x) { x &= 0x0ffffff8; x &= 0xff001fff; return x; } the trunk aarch64 compiler generates: mov w1, 8184 movk w1, 0xf00, lsl 16 and w0, w0, w1 We can generate one fewer instruction if we recognize certain constants. With the attached patch the current trunk compiler generates: and w0, w0, 268435448 and w0, w0, -16769025 Bootstrapped and make check successfully completed with no regressions on aarch64-linux-gnu. Okay for trunk? Regards, Michael Collison ------------------------------------------------------------------------------------ ChangeLog entries are as follows: *** gcc/ChangeLog *** 2016-10-27 Michael Collison <michael.colli...@arm.com> * config/aarch64/aarch64-protos.h (aarch64_and_split_imm1, aarch64_and_split_imm2) (aarch64_and_bitmask_imm): New prototypes * config/aarch64/aarch64.c (aarch64_and_split_imm1): New overloaded function to create bit mask covering the lowest to highest bits set. (aarch64_and_split_imm2): New overloaded functions to create bit mask of zeros between first and last bit set. (aarch64_and_bitmask_imm): New function to determine if a integer is a valid two instruction "and" operation. * config/aarch64/aarch64.md:(and<mode>3): New define_insn and _split allowing wider range of constants with "and" operations. * (ior<mode>3, xor<mode>3): Use new LOGICAL2 iterator to prevent "and" operator from matching restricted constant range used for ior and xor operators. * config/aarch64/constraints.md (UsO constraint): New SImode constraint for constants in "and" operations. (UsP constraint): New DImode constraint for constants in "and" operations. * config/aarch64/iterators.md (lconst2): New mode iterator. (LOGICAL2): New code iterator. * config/aarch64/predicates.md (aarch64_logical_and_immediate): New predicate (aarch64_logical_and_operand): New predicate allowing extended constants for "and" operations. *** gcc/testsuite/ChangeLog *** 2016-10-27 Michael Collison <michael.colli...@arm.com> testsuite/ * gcc.target/aarch64/and_const.c: New test to verify additional constants are recognized and fewer instructions generated.
gnutools_5860_ipreview3.patch
Description: gnutools_5860_ipreview3.patch