I can't believe I made such a stupid pasto and the regression test
didn't detect anything wrong.

        PR target/121634

gcc/

        * config/loongarch/simd.md (simd_maddw_evod_<mode>_<su>): Use
        WVEC_HALF instead of WVEC for the mode of the sign_extend for
        the rhs of multiplication.

gcc/testsuite/

        * gcc.target/loongarch/pr121634.c: New test.
---

Bootstrapped and regtested on loongarch64-linux-gnu.  Ok for trunk?

 gcc/config/loongarch/simd.md                  |  2 +-
 gcc/testsuite/gcc.target/loongarch/pr121634.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/pr121634.c

diff --git a/gcc/config/loongarch/simd.md b/gcc/config/loongarch/simd.md
index dd17cd13fc5..4156b269f9a 100644
--- a/gcc/config/loongarch/simd.md
+++ b/gcc/config/loongarch/simd.md
@@ -773,7 +773,7 @@ (define_insn "simd_maddw_evod_<mode>_<su>"
              (vec_select:<VEC_HALF>
                (match_operand:IVEC 2 "register_operand" "f")
                (match_operand:IVEC 4 "vect_par_cnst_even_or_odd_half")))
-           (any_extend:<WVEC>
+           (any_extend:<WVEC_HALF>
              (vec_select:<VEC_HALF>
                (match_operand:IVEC 3 "register_operand" "f")
                (match_dup 4))))
diff --git a/gcc/testsuite/gcc.target/loongarch/pr121634.c 
b/gcc/testsuite/gcc.target/loongarch/pr121634.c
new file mode 100644
index 00000000000..325173ad798
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/pr121634.c
@@ -0,0 +1,15 @@
+/* PR target/121634: ICE in highway-1.3.0 testsuite */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=la464 -mabi=lp64d" } */
+
+typedef short v8i16 __attribute__ ((vector_size (16)));
+typedef int v4i32 __attribute__ ((vector_size (16)));
+typedef long __m128i __attribute__ ((__vector_size__ (16)));
+__m128i x, y;
+
+__m128i
+WidenMulPairwiseAdd (__m128i a, __m128i b)
+{
+  y = (__m128i)__builtin_lsx_vmaddwod_w_h ((v4i32)x, (v8i16){}, (v8i16){});
+  return y;
+}
-- 
2.51.0

Reply via email to