expand: Fix ICE in store_bit_field_using_insv [PR93235]
authorJakub Jelinek <jakub@redhat.com>
Thu, 4 Mar 2021 18:38:08 +0000 (19:38 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 4 Mar 2021 18:38:08 +0000 (19:38 +0100)
commit0ad6de3883a1641f7ec0bd9cf56d41fa5b313dae
treef536bfcc765ed079b35d0dae668bda3d48e56176
parent87dc3d0d36a8ac55122da72cf5b1dcf06e694018
expand: Fix ICE in store_bit_field_using_insv [PR93235]

The following testcase ICEs on aarch64.  The problem is that
op0 is (subreg:HI (reg:HF ...) 0) and because we can't create a SUBREG of a
SUBREG and aarch64 doesn't have HImode insv, only SImode insv,
store_bit_field_using_insv tries to create (subreg:SI (reg:HF ...) 0)
which is not valid for the target and so gen_rtx_SUBREG ICEs.

The following patch fixes it by punting if the to be created SUBREG
doesn't validate, callers of store_bit_field_using_insv can handle
the fallback.

2021-03-04  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/93235
* expmed.c (store_bit_field_using_insv): Return false of xop0 is a
SUBREG and a SUBREG to op_mode can't be created.

* gcc.target/aarch64/pr93235.c: New test.
gcc/expmed.c
gcc/testsuite/gcc.target/aarch64/pr93235.c [new file with mode: 0644]