]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Fix ICE and use simplify_gen_subreg instead of gen_rtx_SUBREG directly.
authorJiahao Xu <xujiahao@loongson.cn>
Wed, 29 Nov 2023 03:18:00 +0000 (11:18 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Fri, 8 Dec 2023 08:44:07 +0000 (16:44 +0800)
commit75f9c2ea29989b1663e4fc2648096ab2836d3877
tree2ff190f52d3e751c388cfa444e277e0257e03742
parent40366b89e9c8e727af70ecf7007cba6c51e4b7d2
LoongArch: Fix ICE and use simplify_gen_subreg instead of gen_rtx_SUBREG directly.

loongarch_expand_vec_cond_mask_expr generates 'subreg's of 'subreg's, which are not supported
in gcc, it causes an ICE:

ice.c:55:1: error: unrecognizable insn:
   55 | }
      | ^
(insn 63 62 64 8 (set (reg:V4DI 278)
        (subreg:V4DI (subreg:V4DF (reg:V4DI 273 [ vect__53.26 ]) 0) 0)) -1
     (nil))
during RTL pass: vregs
ice.c:55:1: internal compiler error: in extract_insn, at recog.cc:2804

Last time, Ruoyao has fixed a similar ICE:
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636156.html

This patch fixes ICE and use simplify_gen_subreg instead of gen_rtx_SUBREG as much as possible
to avoid the same ice happening again.

gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_try_expand_lsx_vshuf_const): Use
simplify_gen_subreg instead of gen_rtx_SUBREG.
(loongarch_expand_vec_perm_const_2): Ditto.
(loongarch_expand_vec_cond_expr): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/pr112476-3.c: New test.
* gcc.target/loongarch/pr112476-4.c: New test.
gcc/config/loongarch/loongarch.cc
gcc/testsuite/gcc.target/loongarch/pr112476-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/pr112476-4.c [new file with mode: 0644]