In the function loongarch_expand_vector_init_same, if same is MEM and
the mode of same does not match imode, it will cause an ICE
in force_reg (imode, same).
PR target/123807
gcc/ChangeLog:
* config/loongarch/loongarch.cc
(loongarch_expand_vector_init_same): When same is MEM and
GET_MODE(same) != imode, first load the data from memory
and then process it further.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/vector/lsx/pr123807.c: New test.
}
}
- temp = force_reg (imode, same);
+ if (GET_CODE (same) == MEM && GET_MODE (same) != imode)
+ {
+ rtx reg_tmp = gen_reg_rtx (GET_MODE (same));
+ loongarch_emit_move (reg_tmp, same);
+ temp = lowpart_subreg (imode, reg_tmp, GET_MODE (reg_tmp));
+ }
+ else
+ temp = same;
+
+ temp = force_reg (imode, temp);
switch (vmode)
{
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -msimd=lsx" } */
+
+typedef long long v2i64 __attribute__ ((__vector_size__ (16)));
+v2i64 a, b;
+void
+test (int imm8)
+{
+ b = a << imm8;
+}