ping

https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00108.html


On 08/01/2018 04:07 PM, Sam Tebbs wrote:
Hi all,

This patch adds an optimisation that exploits the AArch64 BFXIL
instruction when or-ing the result of two bitwise and operations
with non-overlapping bitmasks
(e.g. (a & 0xFFFF0000) | (b & 0x0000FFFF)).

Example:

unsigned long long combine(unsigned long long a, unsigned long
long b) {
  return (a & 0xffffffff00000000ll) | (b & 0x00000000ffffffffll);
}

void read(unsigned long long a, unsigned long long b, unsigned
long long *c) {
  *c = combine(a, b);
}

When compiled with -O2, read would result in:

read:
  and   x5, x1, #0xffffffff
  and   x4, x0, #0xffffffff00000000
  orr   x4, x4, x5
  str   x4, [x2]
  ret

But with this patch results in:

read:
  mov    x4, x0
  bfxil    x4, x1, 0, 32
  str    x4, [x2]
  ret

Bootstrapped and regtested on aarch64-none-linux-gnu and
aarch64-none-elf with no regressions.


gcc/
2018-08-01  Sam Tebbs<sam.te...@arm.com>

        PR target/85628
        * config/aarch64/aarch64.md (*aarch64_bfxil):
        Define.
        * config/aarch64/constraints.md (Ulc): Define
        * config/aarch64/aarch64-protos.h
        (aarch64_is_left_consecutive): Define.
        * config/aarch64/aarch64.c (aarch64_is_left_consecutive):
        New function.

gcc/testsuite
2018-08-01  Sam Tebbs<sam.te...@arm.com>

        PR target/85628
        * gcc.target/aarch64/combine_bfxil.c: New file.
        * gcc.target/aarch64/combine_bfxil_2.c: New file.


Reply via email to