]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Fix ICE when trying to recognize bitwise + alsl.w pair [PR119127]
authorXi Ruoyao <xry111@xry111.site>
Fri, 7 Mar 2025 04:49:54 +0000 (12:49 +0800)
committerXi Ruoyao <xry111@xry111.site>
Mon, 10 Mar 2025 09:12:05 +0000 (17:12 +0800)
commitc7d493baf13f1f144f2c4bc375383b6ce5d88a76
treea8b35640d4434608ca0338cac0a485013978937f
parent9fe5106ea92218380ea2a7166417565f79fe680d
LoongArch: Fix ICE when trying to recognize bitwise + alsl.w pair [PR119127]

When we call loongarch_reassoc_shift_bitwise for
<optab>_alsl_reversesi_extend, the mask is in DImode but we are trying
to operate it in SImode, causing an ICE.

To fix the issue sign-extend the mask into the mode we want.  And also
specially handle the case the mask is extended into -1 to avoid a
miss-optimization.

gcc/ChangeLog:

PR target/119127
* config/loongarch/loongarch.cc
(loongarch_reassoc_shift_bitwise): Sign extend mask to mode,
specially handle the case it's extended to -1.
* config/loongarch/loongarch.md
(loongarch_reassoc_shift_bitwise): Update the comment for the
special case.
gcc/config/loongarch/loongarch.cc
gcc/config/loongarch/loongarch.md
gcc/testsuite/gcc.target/loongarch/pr119127.c [new file with mode: 0644]