arm: mve: Don't force trivial vector literals to the pool
authorRichard Earnshaw <rearnsha@arm.com>
Fri, 17 Jun 2022 09:30:57 +0000 (10:30 +0100)
committerRichard Earnshaw <rearnsha@arm.com>
Fri, 17 Jun 2022 09:33:15 +0000 (10:33 +0100)
commit94018fd2675190a4353cb199da4957538f070886
tree372eceff777e3b38d9d8f480b4c164d0ff941a53
parentbc7e9f76756f2f164bb5dc70b59bc0d838f9fa96
arm: mve: Don't force trivial vector literals to the pool

A bug in the ordering of the operands in the mve_mov<mode> pattern
meant that all literal values were being pushed to the literal pool.
This patch fixes that and simplifies some of the logic slightly so
that we can use as simple switch statement.

For example:
void f (uint32_t *a)
{
  int i;
  for (i = 0; i < 100; i++)
    a[i] += 1;
}

Now compiles to:
        push    {lr}
        mov     lr, #25
        vmov.i32        q2, #0x1  @ v4si
        ...

instead of

        push    {lr}
        mov     lr, #25
        vldr.64 d4, .L6
        vldr.64 d5, .L6+8
...
.L7:
        .align  3
.L6:
        .word   1
        .word   1
        .word   1
        .word   1

gcc/ChangeLog:
* config/arm/mve.md (*mve_mov<mode>): Re-order constraints
to avoid spilling trivial literals to the constant pool.

gcc/testsuite/ChangeLog:
* gcc.target/arm/acle/cde-mve-full-assembly.c: Adjust expected
output.
gcc/config/arm/mve.md
gcc/testsuite/gcc.target/arm/acle/cde-mve-full-assembly.c