arm: Fix MVE ICEs with vector moves and -mpure-code [PR97252]
authorAlex Coplan <alex.coplan@arm.com>
Mon, 22 Mar 2021 14:43:15 +0000 (14:43 +0000)
committerAlex Coplan <alex.coplan@arm.com>
Mon, 22 Mar 2021 14:43:15 +0000 (14:43 +0000)
commit150a829accd76ddd73c20628774cb0781f6e8bfe
treefaa9ccc1f5819bc0fdead9671ae32024971d2686
parent57d9ac67280a09f3714086b95fe4c20e34ef5706
arm: Fix MVE ICEs with vector moves and -mpure-code [PR97252]

This fixes around 500 ICEs in the testsuite which can be seen when
testing with -march=armv8.1-m.main+mve -mfloat-abi=hard -mpure-code
(leaving the testsuite free of ICEs in this configuration). All of the
ICEs are in arm_print_operand (which is expecting a mem and gets another
rtx, e.g. a const_vector) when running the output code for
*mve_mov<mode> in alternative 4.

The issue is that MVE vector moves were relying on the arm_reorg pass to
move constant vectors that we can't easily synthesize to the literal
pool. This doesn't work for -mpure-code where the literal pool is
disabled. LLVM puts these in .rodata: I've chosen to do the same here.

With this change, for -mpure-code, we no longer want to allow a constant
on the RHS of a vector load in RA. To achieve this, I added a new
constraint which matches constants only if the literal pool is
available.

gcc/ChangeLog:

PR target/97252
* config/arm/arm-protos.h (neon_make_constant): Add generate
argument to guard emitting insns, default to true.
* config/arm/arm.c (arm_legitimate_constant_p_1): Reject
CONST_VECTORs which neon_make_constant can't handle.
(neon_vdup_constant): Add generate argument, avoid emitting
insns if it's not set.
(neon_make_constant): Plumb new generate argument through.
* config/arm/constraints.md (Ui): New. Use it...
* config/arm/mve.md (*mve_mov<mode>): ... here.
* config/arm/vec-common.md (movv8hf): Use neon_make_constant to
synthesize constants.
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.c
gcc/config/arm/constraints.md
gcc/config/arm/mve.md
gcc/config/arm/vec-common.md