Improve dup pattern
commitac0bda3fc337ed88d57a0106a65940aaa94c215b
authorwilco <wilco@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Jun 2017 10:46:02 +0000 (21 10:46 +0000)
committerwilco <wilco@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Jun 2017 10:46:02 +0000 (21 10:46 +0000)
tree299fb3d6951d77ea9481949905d0bce787c70afb
parentbd6fe60df8e5059d3bd0cd23ef99d81036b28f40
Improve dup pattern

Improve the dup pattern to prefer vector registers.  When doing a dup
after a load, the register allocator thinks the costs are identical
and chooses an integer load.  However a dup from an integer register
includes an int->fp transfer which is not modelled.  Adding a '?' to
the integer variant means the cost is increased slightly so we prefer
using a vector register.  This improves the following example:

#include <arm_neon.h>
void f(unsigned *a, uint32x4_t *b)
{
  b[0] = vdupq_n_u32(a[1]);
  b[1] = vdupq_n_u32(a[2]);
}

to:
        ldr     s0, [x0, 4]
        dup     v0.4s, v0.s[0]
        str     q0, [x1]
        ldr     s0, [x0, 8]
        dup     v0.4s, v0.s[0]
        str     q0, [x1, 16]
        ret

    gcc/
* config/aarch64/aarch64-simd.md (aarch64_simd_dup):
Swap alternatives, make integer dup more expensive.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249443 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/aarch64/aarch64-simd.md