[PATCH v1 2/4] LoongArch:Add vector subtraction arithmetic operation SX instruction.

Xiaolong Chen chenxiaolong@loongson.cn
Thu Sep 7 07:13:09 GMT 2023


gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vhsubw-2.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vmsub.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vssub-1.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vssub-2.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsub.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsubi.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsubwev-2.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsubwod-2.c: New test.
---
 .../loongarch/vector/lsx/lsx-vhsubw-1.c       | 326 +++++++++++++
 .../loongarch/vector/lsx/lsx-vhsubw-2.c       | 352 ++++++++++++++
 .../loongarch/vector/lsx/lsx-vmsub.c          | 460 ++++++++++++++++++
 .../loongarch/vector/lsx/lsx-vssub-1.c        | 397 +++++++++++++++
 .../loongarch/vector/lsx/lsx-vssub-2.c        | 407 ++++++++++++++++
 .../loongarch/vector/lsx/lsx-vsub.c           | 380 +++++++++++++++
 .../loongarch/vector/lsx/lsx-vsubi.c          | 328 +++++++++++++
 .../loongarch/vector/lsx/lsx-vsubwev-1.c      | 325 +++++++++++++
 .../loongarch/vector/lsx/lsx-vsubwev-2.c      | 416 ++++++++++++++++
 .../loongarch/vector/lsx/lsx-vsubwod-1.c      | 325 +++++++++++++
 .../loongarch/vector/lsx/lsx-vsubwod-2.c      | 307 ++++++++++++
 11 files changed, 4023 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-2.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsub.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-2.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsub.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubi.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-2.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-2.c

diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c
new file mode 100644
index 00000000000..8f7bbc0ad2d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c
@@ -0,0 +1,326 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000fffffc00;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000010000;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00007f8000007f80;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00007f8000007f80;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000008000000080;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000008000000080;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffff00;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffff07effffe;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001000100010000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001000100110002;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  unsigned_int_out = __lsx_vpickve2gr_wu(__m128i_op0,0x2);
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000000ffffff01;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffeff400000df4;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000006f00001f0a;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000958affff995d;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000ff91fffffff5;
+  *((unsigned long*)& __m128i_result[0]) = 0xffff00650001ffb0;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000bfffffffe0f6;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000010001000a;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x41dfffffffc00000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xbff0000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0008000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0101010101010101;
+  *((unsigned long*)& __m128i_result[1]) = 0x0039ffffffff0000;
+  *((unsigned long*)& __m128i_result[0]) = 0xffbeffffffffffff;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x370bdfecffecffec;
+  *((unsigned long*)& __m128i_op0[0]) = 0x370bdfecffecffec;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000008140c80;
+  *((unsigned long*)& __m128i_result[1]) = 0x0037ffdfffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0037ffdfffeb007f;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x98147a504d145000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x377b810912c0e000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x4e3e133738bb47d2;
+  *((unsigned long*)& __m128i_result[1]) = 0xff98007a004d0050;
+  *((unsigned long*)& __m128i_result[0]) = 0xfff9ff4a0057000e;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000501ffff0005;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001000600000001;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00020000ffff0001;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001000100000001;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000ffae001effae;
+  *((unsigned long*)& __m128i_op0[0]) = 0x001effae001effae;
+  *((unsigned long*)& __m128i_op1[1]) = 0x5252525252525252;
+  *((unsigned long*)& __m128i_op1[0]) = 0x5252525252525252;
+  *((unsigned long*)& __m128i_result[1]) = 0xffaeffadffaeffad;
+  *((unsigned long*)& __m128i_result[0]) = 0xffaeffadffaeffad;
+  __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000201000000000b;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000fc0000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000200000000;
+  __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffff01ff01;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffff02;
+  __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000;
+  __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000001;
+  __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000000000ff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffff01;
+  __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x9727b8499727b849;
+  *((unsigned long*)& __m128i_op0[0]) = 0x12755900b653f081;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x7d7f13fc7c7ffbf4;
+  *((unsigned long*)& __m128i_result[1]) = 0xffff9727ffff9727;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffe79ffffba5f;
+  __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000100010;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000100010;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vhsubw_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000006f00001f0a;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000958affff995d;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000000000ff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000100c6ffef10c;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffff70;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffff9001a47e;
+  __m128i_out = __lsx_vhsubw_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000000000a6;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffff59;
+  __m128i_out = __lsx_vhsubw_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000400000004;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000400000004;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffc;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffc;
+  __m128i_out = __lsx_vhsubw_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000001;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x002affd600000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0xcbc2723a4f12a5f8;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x343d8dc5b0ed5a08;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffff53d9;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffff0001ffff9515;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000fffe00006aea;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000455555555;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000003fe0000141e;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffc01ffffebe2;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x67eb85afb2ebb000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xc8847ef6ed3f2000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000002000000020;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000001f0000001f;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x67eb8590b2ebafe1;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x56a09e662ab46b31;
+  *((unsigned long*)& __m128i_op1[0]) = 0xb4b8122ef4054bb3;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x4b47edd10bfab44d;
+  __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-2.c
new file mode 100644
index 00000000000..927ecac59a0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-2.c
@@ -0,0 +1,352 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000001;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffff0000010000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfe00fe00fe00fd01;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfe00fffefe0100f6;
+  *((unsigned long*)& __m128i_result[1]) = 0x00ff00ff0000ffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x00ff0001ffffff0a;
+  __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000017161515;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000095141311;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0x76f424887fffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000170014;
+  *((unsigned long*)& __m128i_result[0]) = 0xff0cff78ff96ff14;
+  __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x67eb85afb2ebb000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x67eb85afb2ebb000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xff7cffd6ffc700b0;
+  __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00ff00ff00ff00ff;
+  __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000ffff0000ffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000ffff0000ffff;
+  __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00ffff0000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00ffff0000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x7f8000007f800000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x7f80000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x000000ff00000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000ff00000000;
+  __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000020;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xffff0001ffff0001;
+  *((unsigned long*)& __m128i_result[0]) = 0xffff0001ffff0001;
+  __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0101010101010101;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0101010101010101;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000010100000101;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000010100000101;
+  __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfefeff00fefeff00;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfefeff00fefeff00;
+  *((unsigned long*)& __m128i_op1[1]) = 0x8080808080808080;
+  *((unsigned long*)& __m128i_op1[0]) = 0x8080808080808080;
+  *((unsigned long*)& __m128i_result[1]) = 0x00007e7e00007e7e;
+  *((unsigned long*)& __m128i_result[0]) = 0x00007e7e00007e7e;
+  __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xa2e3a36363636363;
+  *((unsigned long*)& __m128i_op0[0]) = 0xa2e3a36463636363;
+  *((unsigned long*)& __m128i_op1[1]) = 0x7f8000007f800000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000a2e300006363;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000a2e300006363;
+  __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x52527d7d52527d7d;
+  *((unsigned long*)& __m128i_op0[0]) = 0x52527d7d52527d7d;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000052527d7d;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000052527d7d;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000002400180004;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000024;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffff02;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000001;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffff0000010000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xabff54f1ffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xa5f7458b000802ff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000fff7fc01;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffffffe;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffe;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffff00000002;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000002;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000800000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000800000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000014eb54ab;
+  *((unsigned long*)& __m128i_op0[0]) = 0x14eb6a002a406a00;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffff80008a7555aa;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0a7535006af05cf9;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffff758aaa56;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffa9fb0d07;
+  __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000000;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffff01ff01;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0f180000ffe00000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000001ca02f854;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000100013fa0;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000001ca02f854;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000100013fa0;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000004b01;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffb4ff;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00001b4a00007808;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffe4b5ffff87f8;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x3fc03fc000000003;
+  *((unsigned long*)& __m128i_op0[0]) = 0x7f7f1fd800000004;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x3fc03fc000000004;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xc080800000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xc080800000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x7efefefe82010201;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x418181017dfefdff;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x67eb85afb2ebb000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xc8847ef6ed3f2000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x67eb85afb2ebb000;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xff800000ff800000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xe593c8c4e593c8c4;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000ffff0000ffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000ff8000010f78;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xff7f0080ff7ef088;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000155;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000000f0000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffff10000;
+  __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsub.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsub.c
new file mode 100644
index 00000000000..af71b6f2d8c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsub.c
@@ -0,0 +1,460 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfeffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfeffffffffff0002;
+  *((unsigned long*)& __m128i_op2[1]) = 0x54beed87bc3f2be1;
+  *((unsigned long*)& __m128i_op2[0]) = 0x8024d8f6a494afcb;
+  *((unsigned long*)& __m128i_result[1]) = 0xa8beed87bc3f2be1;
+  *((unsigned long*)& __m128i_result[0]) = 0x0024d8f6a494006a;
+  __m128i_out = __lsx_vmsub_b(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000fc0000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  unsigned_int_out = __lsx_vpickve2gr_wu(__m128i_op0,0x3);
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000ffff00000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000ffff0000ffff;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000ffff00000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000ffff0000ffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001ffff00000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001ffff0001ffff;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0001000100000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_b(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000200010;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0xfffffff0ffe04000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000001fc0000;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000200010;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000200010;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0400040004000400;
+  *((unsigned long*)& __m128i_op0[0]) = 0x040004000400040d;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0400040004000400;
+  *((unsigned long*)& __m128i_result[0]) = 0x040004000400040d;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xb327b9363c99d32e;
+  *((unsigned long*)& __m128i_op0[0]) = 0xa1e7b475d925730f;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000003f80b0;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000ff800000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x00007f8000007f80;
+  *((unsigned long*)& __m128i_op2[0]) = 0x00007f8000007f80;
+  *((unsigned long*)& __m128i_result[1]) = 0xb327b9363c992b2e;
+  *((unsigned long*)& __m128i_result[0]) = 0xa1e7b475d925730f;
+  __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00ff000000ff0000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffff800;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00ff000000ff0000;
+  __m128i_out = __lsx_vmsub_b(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0002000200020002;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0002000200020002;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000a000a000a000a;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000a000a000a000a;
+  *((unsigned long*)& __m128i_op2[1]) = 0x000000004c7f4c7f;
+  *((unsigned long*)& __m128i_op2[0]) = 0xe0c0c0c0d1c7d1c6;
+  *((unsigned long*)& __m128i_result[1]) = 0x061006100613030c;
+  *((unsigned long*)& __m128i_result[0]) = 0x4d6814ef9c77ce46;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x7fff7fff7fff7fff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x7fff7fff7fff7fff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x7fff7fff7fff7fff;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x7ffe7ffe7ffe7ffe;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000002bfd9461;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000f00;
+  *((unsigned long*)& __m128i_op2[0]) = 0x00000000ffffff00;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000002bfd9461;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x3727f00000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xc7e01fcfe0000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x3727112c00000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x39201f7120000040;
+  *((unsigned long*)& __m128i_op2[1]) = 0x00007fff00007fff;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xe5b9012c00000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xc7e01fcfe0000000;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000004;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffff0204;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000442900007b4c;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000e22b0000efa4;
+  *((unsigned long*)& __m128i_op2[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000442800007b50;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffff0204;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op2[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op2[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffefffffffe;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x000000000000002f;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000029;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000003a24;
+  *((unsigned long*)& __m128i_op2[0]) = 0x003dbe88077c78c1;
+  *((unsigned long*)& __m128i_result[1]) = 0x000000000000002f;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000029;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x7f8000007f800000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x7f8000007f800000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xff0000007f800000;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0fff0fff0fff0fff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0fff0fff0fff0fff;
+  *((unsigned long*)& __m128i_op2[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op2[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0fff0fff0fff0fff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0fff0fff0fff0fff;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000003f0000ffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffc3ffff003e;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000003f0000ffff;
+  *((unsigned long*)& __m128i_op2[0]) = 0xffffffc3ffff003e;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000f07f0000ffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffff177fffff0fc;
+  __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x7fff7fff7fff7fff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfffbfffefffc9510;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfffbfffefffc9510;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0c0b0a090b0a0908;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0a09080709080706;
+  *((unsigned long*)& __m128i_op2[1]) = 0xfffbfffefffc9510;
+  *((unsigned long*)& __m128i_op2[0]) = 0xfffbfffefffc9510;
+  *((unsigned long*)& __m128i_result[1]) = 0x29c251319c3a5c90;
+  *((unsigned long*)& __m128i_result[0]) = 0x62fb9272df7da6b0;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_b(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x8f8f8f8f8f8f8f8f;
+  *((unsigned long*)& __m128i_op1[0]) = 0x8f8f8f8f8f8f8f8f;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x8000000080000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x8000000080000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op2[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op2[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x800000007fffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x800000007fffffff;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000010000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000010000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000010000000000;
+  __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000001400000014;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000001400000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000053a4f452;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000001400000014;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000001400000000;
+  __m128i_out = __lsx_vmsub_b(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00680486ffffffda;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffff913bfffffffd;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00680486ffffffda;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffff913bfffffffd;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x000000003ddc5dac;
+  *((unsigned long*)& __m128i_result[1]) = 0x00680486ffffffda;
+  *((unsigned long*)& __m128i_result[0]) = 0xffff913bb9951901;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000002000000020;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000001f0000001f;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_b(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0021b761002c593c;
+  *((unsigned long*)& __m128i_op0[0]) = 0x002584710016cc56;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffffff;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000001e03;
+  *((unsigned long*)& __m128i_result[1]) = 0x0021b761002c593c;
+  *((unsigned long*)& __m128i_result[0]) = 0x002584710016ea59;
+  __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000290;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000290;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0001000100000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0002000400000001;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000100000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0003000500000001;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000001700000017;
+  *((unsigned long*)& __m128i_op0[0]) = 0x59f7fd8759f7fd87;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000ffae001effae;
+  *((unsigned long*)& __m128i_op1[0]) = 0x001effae001effae;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000001700000017;
+  *((unsigned long*)& __m128i_op2[0]) = 0x59f7fd8759f7fd87;
+  *((unsigned long*)& __m128i_result[1]) = 0xfd200ed2fd370775;
+  *((unsigned long*)& __m128i_result[0]) = 0x96198318780e32c5;
+  __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0004000400040004;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0004000400040004;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0004000400040004;
+  *((unsigned long*)& __m128i_result[0]) = 0x0004000400040004;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op2[1]) = 0xfe3bfb01fe3bfe01;
+  *((unsigned long*)& __m128i_op2[0]) = 0xfe03fe3ffe01fa21;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-1.c
new file mode 100644
index 00000000000..b4bcfaa137e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-1.c
@@ -0,0 +1,397 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00001801f0307f80;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00001801f0307f80;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfffffffff8f8dada;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffff01018888;
+  *((unsigned long*)& __m128i_result[1]) = 0x0101010108082626;
+  *((unsigned long*)& __m128i_result[0]) = 0x01010101ffff7878;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00fe000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfe80000000000001;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x027e0000000000ff;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffb4ff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffff98dea;
+  *((unsigned long*)& __m128i_op1[1]) = 0x3ff0000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x40f3fa0000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xc00fffffffffb4ff;
+  *((unsigned long*)& __m128i_result[0]) = 0xbf0c05fffff98dea;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x000000000000002f;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000029;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffff00;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffff00;
+  *((unsigned long*)& __m128i_result[1]) = 0x010101010101012f;
+  *((unsigned long*)& __m128i_result[0]) = 0x0101010101010129;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x1000100010001000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x1000100010001000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfefefefefefefefe;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfefefefefefefefe;
+  *((unsigned long*)& __m128i_result[1]) = 0x1202120212021202;
+  *((unsigned long*)& __m128i_result[0]) = 0x1202120212021202;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[1]) = 0x00ff00ff00ff00ff;
+  *((unsigned long*)& __m128i_result[0]) = 0x00ff00ff00ff00ff;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0fffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x8000800080008000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x41957fff7fff7fff;
+  *((unsigned long*)& __m128i_result[1]) = 0x7fff7fff7fff7fff;
+  *((unsigned long*)& __m128i_result[0]) = 0xbf6b810181018101;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfff8ffa2fffdffb0;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000ff800000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0108015e01030150;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000017f0000;
+  __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x007fffff00000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x007fffff00000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xf436f3f52f4ef4a8;
+  *((unsigned long*)& __m128i_op1[1]) = 0xff80000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xff80000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0080000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xf4b6f3f52f4ef4a8;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000fe00ff;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffff01ff01;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001000101fd01fe;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0040004000400040;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0040004000400040;
+  *((unsigned long*)& __m128i_result[1]) = 0xffc0ffc0ffc0ffc0;
+  *((unsigned long*)& __m128i_result[0]) = 0xffc0ffc0ffc0ffc0;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x7fff010181010102;
+  *((unsigned long*)& __m128i_op0[0]) = 0x7fffffff81010102;
+  *((unsigned long*)& __m128i_op1[1]) = 0x003f0000ffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x003f0000ffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x7fc0010181020103;
+  *((unsigned long*)& __m128i_result[0]) = 0x7fc0ffff81020103;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000001e03;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000011e04;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x6363636363abdf16;
+  *((unsigned long*)& __m128i_op0[0]) = 0x41f8e08016161198;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000246d9755;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000000002427c2ee;
+  *((unsigned long*)& __m128i_result[1]) = 0x636363633f3e47c1;
+  *((unsigned long*)& __m128i_result[0]) = 0x41f8e080f1ef4eaa;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0001fffe00014b41;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0001fffe0001ffde;
+  *((unsigned long*)& __m128i_result[1]) = 0xffff0002ffffb4bf;
+  *((unsigned long*)& __m128i_result[0]) = 0xffff0002ffff0022;
+  __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000001fc0000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000002010;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000001fbdff0;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x03f1e3d28b1a8a1a;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000000001d5d4;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000000150d707009;
+  *((unsigned long*)& __m128i_result[1]) = 0x00000000fffe2a2c;
+  *((unsigned long*)& __m128i_result[0]) = 0x03f1e3bd80000000;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000001;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffd5002affffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x343d8dc6b0ed5a08;
+  *((unsigned long*)& __m128i_result[1]) = 0x002affd600000001;
+  *((unsigned long*)& __m128i_result[0]) = 0xcbc2723a4f12a5f8;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000001;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffff7ffffffffe;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000000fffffffe;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffff7ffffffffe;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000fffffffe;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000002000000020;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000002000000020;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffdfffffffe0;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffdfffffffe0;
+  __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000c2f90000bafa;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000c2f90000bafa;
+  *((unsigned long*)& __m128i_op1[0]) = 0x8000c2fa8000c2fa;
+  *((unsigned long*)& __m128i_result[1]) = 0xffff3d06ffff4506;
+  *((unsigned long*)& __m128i_result[0]) = 0x7ffffffe7ffff800;
+  __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfffffff3fffffff3;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfffffff3fffffff3;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffff3fffffff4;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffff3fffffff4;
+  __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x7ef8000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x8108000000000000;
+  __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000063b2ac27;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffaa076aeb;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffff53d9;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffff0001ffff9515;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffff63b3584e;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000fffdaa07d5d6;
+  __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffff81;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000005;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffff7c;
+  __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xff7cffd6ffc700b0;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x008300290038ff50;
+  __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000c0dec4d1;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffff3f213b2f;
+  __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-2.c
new file mode 100644
index 00000000000..d5d11fab0f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-2.c
@@ -0,0 +1,407 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x7f801fa06451ef11;
+  *((unsigned long*)& __m128i_op0[0]) = 0x68bcf93435ed25ed;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffb64c;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000003900;
+  *((unsigned long*)& __m128i_result[0]) = 0x68bcf93435ed25ed;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x460f3b393ef4be3a;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x04e00060ffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x04e00060ffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x04e00060ffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x04e00060ffffffff;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x004200a000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x004200a000200001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000000000001c;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000000000000001c;
+  *((unsigned long*)& __m128i_result[1]) = 0x004200a000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x004200a000200000;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0c03e17edd781b11;
+  *((unsigned long*)& __m128i_op0[0]) = 0x342caf9be5579ebe;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000000000000f909;
+  *((unsigned long*)& __m128i_result[1]) = 0x0c03e17edd781b11;
+  *((unsigned long*)& __m128i_result[0]) = 0x342caf9be55700b5;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000200010;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000200010;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x11000f2010000e20;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0f000d200e000c20;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x11000f2010000e20;
+  *((unsigned long*)& __m128i_result[0]) = 0x0f000d200e000c20;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x001ffff0003ffff0;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000fffefffefffef;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x001ffff0003ffff0;
+  *((unsigned long*)& __m128i_result[0]) = 0x000fffefffefffef;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000014;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000014;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000005;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000005;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x4e3e13368c17f6e6;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000005;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x1111311111114111;
+  *((unsigned long*)& __m128i_op0[0]) = 0x1111311111112111;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000007fff;
+  *((unsigned long*)& __m128i_result[1]) = 0x1111311111114111;
+  *((unsigned long*)& __m128i_result[0]) = 0x1111311111110000;
+  __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfefefefefefefefe;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfefefefefefefefe;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0002000200020002;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0202fe02fd020102;
+  *((unsigned long*)& __m128i_result[1]) = 0xfefcfefcfefcfefc;
+  *((unsigned long*)& __m128i_result[0]) = 0xfcfc00fc01fcfdfc;
+  __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00004000ffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xbfd10d0d7b6b6b73;
+  *((unsigned long*)& __m128i_op0[0]) = 0xc5c53492f25acbf2;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000f3040705;
+  *((unsigned long*)& __m128i_result[1]) = 0xbfd10d0d7b6b6b73;
+  *((unsigned long*)& __m128i_result[0]) = 0xc5c534920000c4ed;
+  __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000200;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000200;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffff0000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00ff000000ff0000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00ff00ff00ff00ff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00ff00ff000000ff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000ff000000ff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000000ff000000ff;
+  *((unsigned long*)& __m128i_result[1]) = 0x00ff000000ff0000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00ff000000000000;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xc14eef7fc14ea000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000ea000010fa101;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  int_out = __lsx_vpickve2gr_b(__m128i_op0,0xb);
+  *((unsigned long*)& __m128i_op0[1]) = 0x000000000000bd3d;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000007fff0000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000c7fff000c;
+  *((unsigned long*)& __m128i_op1[0]) = 0x1000100010001000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000006ffef000;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffc2ffe700000007;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000ffc100010001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x41dfffff00000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xbde2ffe800000007;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000ffc100010001;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000000f3040705;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x00000000f3040705;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0xa000308000008002;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0500847b00000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffffff;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x4f4f4f4f4f4f4f4f;
+  *((unsigned long*)& __m128i_op1[0]) = 0x4f4f4f4f4f4f4f4f;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000ff000000ff00;
+  *((unsigned long*)& __m128i_op1[1]) = 0x3fffff0000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x3fffff0000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x006f0efe258ca851;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000006f00001f0a;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000958affff995d;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffff90ffffe0f5;
+  *((unsigned long*)& __m128i_result[0]) = 0x006e7973258d0ef4;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000ca02f854;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x6363636363636363;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000d0000000d;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x6363635663636356;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000080;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000080;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000080;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000080;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsub.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsub.c
new file mode 100644
index 00000000000..41b75c05fa6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsub.c
@@ -0,0 +1,380 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000000000000ff02;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000000001fe;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffe000ffffe000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xc6ffe000c6fde000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x8080808080808081;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffe000ffffe000;
+  *((unsigned long*)& __m128i_result[0]) = 0x467f6080467d607f;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000010000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00ff00ff00fe00ff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000100000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000010000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00ff00fe00fe00ff;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x7fff00007fff0000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x7fff00007fff0000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x7fff00007fff0000;
+  *((unsigned long*)& __m128i_result[0]) = 0x7fff00007fff0000;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000000000000ff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000c0dec4d1;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000040223c2e;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfd200ed2fd370775;
+  *((unsigned long*)& __m128i_op0[0]) = 0x96198318780e32c5;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffe65ecc1be5bc;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffe65ecc1be5bc;
+  *((unsigned long*)& __m128i_result[1]) = 0xfe212874311c22b9;
+  *((unsigned long*)& __m128i_result[0]) = 0x971a9dbaacf34d09;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  unsigned_int_out = __lsx_vpickve2gr_wu(__m128i_op0,0x0);
+  *((unsigned long*)& __m128i_op0[1]) = 0x4f4f4f4f4f4f4f4f;
+  *((unsigned long*)& __m128i_op0[0]) = 0x4f4f4f4f4f4f4f4f;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x4f4f4f4f4f4f4f4f;
+  *((unsigned long*)& __m128i_result[0]) = 0x4f4f4f4f4f4f4f4f;
+  __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0404038383838404;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0404038383838404;
+  *((unsigned long*)& __m128i_op1[1]) = 0xf000e001bf84df83;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfff8e001ff84e703;
+  *((unsigned long*)& __m128i_result[1]) = 0x14042382c3ffa481;
+  *((unsigned long*)& __m128i_result[0]) = 0x040c238283ff9d01;
+  __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0141010101410101;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0141010101410101;
+  *((unsigned long*)& __m128i_result[1]) = 0xfebffefffebffeff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfebffefffebffeff;
+  __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x1111111111111111;
+  *((unsigned long*)& __m128i_op0[0]) = 0x1111111111111111;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x1111111111111111;
+  *((unsigned long*)& __m128i_result[0]) = 0x1111111111111111;
+  __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfffefffefffefffe;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfffefffefffefffe;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000700000004fdff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000300000000fdff;
+  *((unsigned long*)& __m128i_result[1]) = 0xfff7fffefffa01ff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffbfffefffe01ff;
+  __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0001000000010000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000cd630000cd63;
+  *((unsigned long*)& __m128i_result[1]) = 0xffff0000ffff0000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000329d0000329d;
+  __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x08080807f7f7f7f8;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000202020200;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000100;
+  *((unsigned long*)& __m128i_result[1]) = 0x08080805f5f5f5f8;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000000000ff00;
+  __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00060eb000000006;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000075c00000cf0;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffaf1500000fffa;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000f8a40000f310;
+  __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfffffffff100fffc;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000200000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffffdf100fffc;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x000000007f7f7f7f;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffff0;
+  *((unsigned long*)& __m128i_result[1]) = 0x000000007f7f7f7f;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000010;
+  __m128i_out = __lsx_vsub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000800000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000800000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000800000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000800000000000;
+  __m128i_out = __lsx_vsub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00001802041b0013;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_result[0]) = 0x00001802041b0014;
+  __m128i_out = __lsx_vsub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffff000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000f7d1000000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0x773324887fffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xfff082efffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x88cbdb7780000001;
+  __m128i_out = __lsx_vsub_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000001f50000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffe0b0000;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfff0000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfff0000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x000fffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0010000000000001;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000800080;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000b;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000800080;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000000000000b;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffeb;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffeb;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000014;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000015;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0007000000050000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0003000100010001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000ffff0000ffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0001fffe0001fefc;
+  *((unsigned long*)& __m128i_result[1]) = 0x0006000100040001;
+  *((unsigned long*)& __m128i_result[0]) = 0x00010002ffff0105;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000003fffffffd;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000003fffffffd;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x00000003fffffffe;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000003fffffffd;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000feff23560000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000fd1654860000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x6363636363abdf16;
+  *((unsigned long*)& __m128i_op1[0]) = 0x41f8e08016161198;
+  *((unsigned long*)& __m128i_result[1]) = 0x9c9d9b9bbfaa20e9;
+  *((unsigned long*)& __m128i_result[0]) = 0xbe081c963e6fee68;
+  __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubi.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubi.c
new file mode 100644
index 00000000000..cda4ffd52f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubi.c
@@ -0,0 +1,328 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfff489b693120950;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfffc45a851c40c18;
+  *((unsigned long*)& __m128i_result[1]) = 0xe0d56a9774f3ea31;
+  *((unsigned long*)& __m128i_result[0]) = 0xe0dd268932a5edf9;
+  __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x1f);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffff88;
+  *((unsigned long*)& __m128i_result[1]) = 0xe5e5e5e5e5e5e5e5;
+  *((unsigned long*)& __m128i_result[0]) = 0xe5e5e5e5e4e4e46d;
+  __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x1b);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000897957687;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000408;
+  *((unsigned long*)& __m128i_result[1]) = 0xf7f7f7ff8e8c6d7e;
+  *((unsigned long*)& __m128i_result[0]) = 0xf7f7f7f7f7f7fbff;
+  __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x9);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  int_out = __lsx_vpickve2gr_w(__m128i_op0,0x1);
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xe6e6e6e6e6e6e6e6;
+  *((unsigned long*)& __m128i_result[0]) = 0xe6e6e6e6e6e6e6e6;
+  __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x19);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xf8f8f8f8f8f8f8f8;
+  *((unsigned long*)& __m128i_result[0]) = 0xf8f8f8f8f8f8f8f8;
+  __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x8);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x2e34594c3b000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xe9e9e9e9e9e9e9e9;
+  *((unsigned long*)& __m128i_result[0]) = 0x171d423524e9e9e9;
+  __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x17);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffe2ffe2ffe2ffe2;
+  *((unsigned long*)& __m128i_result[0]) = 0xffe2ffe2ffe2ffe2;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x1e);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x9795698585057dec;
+  *((unsigned long*)& __m128i_op0[0]) = 0x87f82867431a1d08;
+  *((unsigned long*)& __m128i_result[1]) = 0x9780697084f07dd7;
+  *((unsigned long*)& __m128i_result[0]) = 0x87e3285243051cf3;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x15);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffcfffcfffcfffc;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffcfffcfffcfffc;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x4);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000101;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffcfffcfffc00fd;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffcfffcfffcfffc;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x4);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x371fe00000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x371fe00000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x370bdfecffecffec;
+  *((unsigned long*)& __m128i_result[0]) = 0x370bdfecffecffec;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x14);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000040600000406;
+  *((unsigned long*)& __m128i_op0[0]) = 0x020202020202fe02;
+  *((unsigned long*)& __m128i_result[1]) = 0xfff503fbfff503fb;
+  *((unsigned long*)& __m128i_result[0]) = 0x01f701f701f7fdf7;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0xb);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffdfffdfffdfffd;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffdfffdfffdfffd;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x2);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x803e0000803e0000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x803e0000803e0000;
+  *((unsigned long*)& __m128i_result[1]) = 0x803bfffd803bfffd;
+  *((unsigned long*)& __m128i_result[0]) = 0x803bfffd803bfffd;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x3);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffdfffdfffdfffd;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffdfffdfffdfffd;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x3);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffedffedffedffed;
+  *((unsigned long*)& __m128i_result[0]) = 0xffedffedffedffed;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x13);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xffe4ffe4ffe4ffe4;
+  *((unsigned long*)& __m128i_result[0]) = 0xffe4ffe4ffe4ffe4;
+  __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x1b);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x0);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffefffffffef;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffefffffffef;
+  __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x11);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffe6ffffffe6;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffe6ffffffe6;
+  __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x19);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffff1fffffff1;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffff1fffffff1;
+  __m128i_out = __lsx_vsubi_wu(__m128i_op0,0xf);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffff6fffffff6;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffff6fffffff6;
+  __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x9);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffe4ffffffe4;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffe4ffffffe4;
+  __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x1c);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffe1ffffffe1;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffe1ffffffe1;
+  __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x1f);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffff1fffffff1;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffff1fffffff1;
+  __m128i_out = __lsx_vsubi_wu(__m128i_op0,0xf);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffab7e71e33848;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffe1ffffffe1;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffab5f71e33829;
+  __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x1f);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xa8beed87bc3f2be1;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0024d8f6a494006a;
+  *((unsigned long*)& __m128i_result[1]) = 0xa8beed87bc3f2bd3;
+  *((unsigned long*)& __m128i_result[0]) = 0x0024d8f6a494005c;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0xe);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffeb;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffeb;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x15);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffe1;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffe1;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x1f);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffff7;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff7;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x9);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffe5;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffe5;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x1a);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xf2f2e5e5e5e5e5e5;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xf2f2e5e5e5e5e5dc;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff7;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x9);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x3fffff0000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x3fffff0000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x3ffffeffffffffe5;
+  *((unsigned long*)& __m128i_result[0]) = 0x3ffffeffffffffe5;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x1b);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x000000000000007b;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000070;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff5;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0xb);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffff0;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff0;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x10);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffe6;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffe6;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x1a);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[1]) = 0x000100010000fffb;
+  *((unsigned long*)& __m128i_result[0]) = 0x000100010000fffb;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x6);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffeb;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffeb;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x15);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffa;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffa;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x6);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfffdfffe80008000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffe2;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffdfffe80007fe2;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x1e);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x001a001a001a001a;
+  *((unsigned long*)& __m128i_op0[0]) = 0x001a001a001a001a;
+  *((unsigned long*)& __m128i_result[1]) = 0x001a001a001a000b;
+  *((unsigned long*)& __m128i_result[0]) = 0x001a001a001a000b;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0xf);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x000000000234545b;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000000c0dec4d1;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000002345454;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000c0dec4ca;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x7);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0f8d33000f8d3300;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0003b80000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0f8d33000f8d32fd;
+  *((unsigned long*)& __m128i_result[0]) = 0x0003b7fffffffffd;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x3);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubi_du(__m128i_op0,0x0);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c
new file mode 100644
index 00000000000..f181389badb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c
@@ -0,0 +1,325 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x43d3e0000013e000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x43d3e0000013e000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffd3000000130000;
+  *((unsigned long*)& __m128i_result[0]) = 0xffd3000000130000;
+  __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000000ffff53d9;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffff0001ffff9515;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x000100010000ffda;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000200000016;
+  __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffbfbfbfc0;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffbfbfbfc0;
+  *((unsigned long*)& __m128i_op1[1]) = 0x4040404040404040;
+  *((unsigned long*)& __m128i_op1[0]) = 0x4040404040404040;
+  *((unsigned long*)& __m128i_result[1]) = 0xffbfffbfff7fff80;
+  *((unsigned long*)& __m128i_result[0]) = 0xffbfffbfff7fff80;
+  __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000808000020200;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000ff8000020000;
+  __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x413e276583869d79;
+  *((unsigned long*)& __m128i_op0[0]) = 0x7f7f017f9d8726d3;
+  *((unsigned long*)& __m128i_op1[1]) = 0x7c7cd2eb63637c52;
+  *((unsigned long*)& __m128i_op1[0]) = 0x82ffd2210127add2;
+  *((unsigned long*)& __m128i_result[1]) = 0xffc2007aff230027;
+  *((unsigned long*)& __m128i_result[0]) = 0x0080005eff600001;
+  __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffee;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000011ff040;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001000100010012;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000ffe1ffc0;
+  __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000100000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000004000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffc000000000;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000d;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000000000000d;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000ffff00;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000000000ff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000100c6ffef10c;
+  *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffff01;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffeff400000df4;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000002050320;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000002050320;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000001c88bf0;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000320;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000007730;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000005;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000005;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000001030103;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000100000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000103;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x33eac9fdca42f660;
+  *((unsigned long*)& __m128i_op0[0]) = 0xaa472d26fe867091;
+  *((unsigned long*)& __m128i_op1[1]) = 0x33eac9fdca42f660;
+  *((unsigned long*)& __m128i_op1[0]) = 0xaa472d26fe867091;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsubwev_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000208000002080;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000208000002080;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000208000002080;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000208000002080;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000004;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000004;
+  __m128i_out = __lsx_vsubwev_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000ff0000857a;
+  *((unsigned long*)& __m128i_op1[0]) = 0x05fafe0101fe000e;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffff7a86;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffe01fff2;
+  __m128i_out = __lsx_vsubwev_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xf654ad7447e59090;
+  *((unsigned long*)& __m128i_op1[0]) = 0x27b1b106b8145f50;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffb81a6f70;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000047eba0b0;
+  __m128i_out = __lsx_vsubwev_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000c01020d8009;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000003004;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000c01020d5005;
+  __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000fe00ff;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffff01ff01;
+  __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000d;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000000000000000d;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x4f804f804f804f80;
+  *((unsigned long*)& __m128i_op0[0]) = 0x4f804f804f804f80;
+  *((unsigned long*)& __m128i_op1[1]) = 0x7fff7fff7fff7fff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x4f804f804f804f80;
+  __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xb9fe3640e4eb1b18;
+  *((unsigned long*)& __m128i_op0[0]) = 0x800000005b4b1b18;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffb9fe00003640;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffe4eb00001b18;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x80001b155b4b0000;
+  __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000100000008;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000100080000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffefff80000;
+  __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x3fc03fc000000004;
+  *((unsigned long*)& __m128i_op1[1]) = 0x3fc03fc000000003;
+  *((unsigned long*)& __m128i_op1[0]) = 0x7f7f1fd800000004;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xc0411fe800000000;
+  __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xff00e400ff00e400;
+  *((unsigned long*)& __m128i_op0[0]) = 0xff01e41ffff0e440;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfffffffefffffffe;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfffffffefffffffe;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xff01e420fff0e442;
+  __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-2.c
new file mode 100644
index 00000000000..29d73c81683
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-2.c
@@ -0,0 +1,416 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00ff00ff00000083;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000004;
+  *((unsigned long*)& __m128i_result[1]) = 0xff01ff010000ff7d;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000000000fffc;
+  __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x1000100010001000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x1000100010001000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffff00fc0000ff02;
+  *((unsigned long*)& __m128i_result[1]) = 0x000000000000ffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xff01ff040000fffe;
+  __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfffffacdb6dbecac;
+  *((unsigned long*)& __m128i_op0[0]) = 0x1f5533a694f902c0;
+  *((unsigned long*)& __m128i_op1[1]) = 0x21011f3f193d173b;
+  *((unsigned long*)& __m128i_op1[0]) = 0xff39ff37ff35ff33;
+  *((unsigned long*)& __m128i_result[1]) = 0x00fe008e009e0071;
+  *((unsigned long*)& __m128i_result[0]) = 0x001c006f00c4008d;
+  __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x9c9ca19d509ae734;
+  *((unsigned long*)& __m128i_op0[0]) = 0xd1b09480f2123460;
+  *((unsigned long*)& __m128i_op1[1]) = 0x9c9c9c9c9c9c9c9c;
+  *((unsigned long*)& __m128i_op1[0]) = 0x9c9c9c9c9c9c9c9c;
+  *((unsigned long*)& __m128i_result[1]) = 0x00000001fffeff98;
+  *((unsigned long*)& __m128i_result[0]) = 0x0014ffe4ff76ffc4;
+  __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x34947b4b11684f92;
+  *((unsigned long*)& __m128i_op1[0]) = 0xee297a731e5c5f86;
+  *((unsigned long*)& __m128i_result[1]) = 0xff6cffb5ff98ff6e;
+  *((unsigned long*)& __m128i_result[0]) = 0xffd7ff8dffa4ff7a;
+  __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfffffffff8f8dada;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffff01018888;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffff3ea5016b;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfffefffe3f6fb04d;
+  *((unsigned long*)& __m128i_result[1]) = 0x000000000000d96f;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000001ffffd83b;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000000f0009d3c;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000016fff9d3d;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000bd0;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000000007f0;
+  *((unsigned long*)& __m128i_result[1]) = 0x000000000000916c;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000010000954d;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000100010000fe01;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000050000007b;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000500000005;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffffbffffff85;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffc0000fdfc;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000032;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000032;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffff80df00000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xa5c4c774856ba837;
+  *((unsigned long*)& __m128i_op1[0]) = 0x2a569f8081c3bbe9;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffb96bffff57c9;
+  *((unsigned long*)& __m128i_result[0]) = 0xffff6080ffff4417;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000063b2ac27;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffaa076aeb;
+  *((unsigned long*)& __m128i_result[1]) = 0x00000000ffff53d9;
+  *((unsigned long*)& __m128i_result[0]) = 0xffff0001ffff9515;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000ffff0000ffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000ffff0000ffff;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00060fbf00040fbf;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00020fbf00000fbf;
+  *((unsigned long*)& __m128i_op1[1]) = 0x6363636363636363;
+  *((unsigned long*)& __m128i_op1[0]) = 0x6363636363636363;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffac5cffffac5c;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffac5cffffac5c;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000000000ffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffaefffbffaefffb;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffaefffbffaefffb;
+  *((unsigned long*)& __m128i_result[1]) = 0xffff0005ffff0005;
+  *((unsigned long*)& __m128i_result[0]) = 0xffff000500000004;
+  __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000000a1630000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000a1630000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000001fffffffe;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000001fffffffe;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000001fd0;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000001fd0;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xff7ffffef77fffdd;
+  *((unsigned long*)& __m128i_op1[0]) = 0xf77edf9cffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000008800022;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000001;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffda6f;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffe3d7;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffda6e;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffe3d6;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x003fffff00000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x003fffff00000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x8000807f00000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x80006b0080808080;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffff00011cf0c569;
+  *((unsigned long*)& __m128i_op1[0]) = 0xc0000002b0995850;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffe30f3a97;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffcfe72830;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000000ff9f5c25;
+  *((unsigned long*)& __m128i_op0[0]) = 0x58fa6b4000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000000ff9f5c25;
+  *((unsigned long*)& __m128i_op1[0]) = 0x58fa6b4000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x8080808080808080;
+  *((unsigned long*)& __m128i_op0[0]) = 0x8080808080808080;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xcda585aebbb2836a;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000080808080;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffc4cdfd16;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  int_out = __lsx_vpickve2gr_w(__m128i_op0,0x2);
+  *((unsigned long*)& __m128i_op0[1]) = 0x801dd5cb0004e058;
+  *((unsigned long*)& __m128i_op0[0]) = 0x77eb15638eeb5fc2;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000200000001b;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000002000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x000000000004e03d;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000008eeb5fc2;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000c0000bd49;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000c7fff000c;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfffff00010000fff;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000100c6ffef00d;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000006f00000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000c00000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000000000006f;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000001f0a;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000bfffffffe0f6;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfffcfffcfffcfffd;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfffcfffdfffcfffd;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffcfffdfffcfffd;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffff7e00000081;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0a0a0a0a0a0a0a0a;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0a0a0a0a0a0a0a0a;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffb96bffff57c9;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffff6080ffff4417;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0a0aa9890a0ac5f3;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x370bdfecffecffec;
+  *((unsigned long*)& __m128i_op0[0]) = 0x370bdfecffecffec;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0010001000100010;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0010001000100010;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x36fbdfdcffdcffdc;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffefffefffeffff;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffff000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000000a752a55;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0a753500a9fa0d06;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xf589caff5605f2fa;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x087c000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000000000087c;
+  *((unsigned long*)& __m128i_op1[1]) = 0x10f8000100000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000001000010f8;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffefffff784;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffff000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffff000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001000000000000;
+  __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c
new file mode 100644
index 00000000000..a40ec44d4bb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c
@@ -0,0 +1,325 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x3ff0000000000001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x40f3fa0000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xc485edbcc0000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x003f000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x007c000d00400000;
+  __m128i_out = __lsx_vsubwod_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x841f000fc28f801f;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x007c0000003e0080;
+  __m128i_out = __lsx_vsubwod_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001;
+  __m128i_out = __lsx_vsubwod_h_b(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffff00000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x000000017fff9000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000210011084;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000007fff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000001001;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xff80000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0xff80000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffff8000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffff8000000000;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfffffffffefefe6a;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000000c2bac2c2;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffefe;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffc2ba;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x000000ff000000ff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000027f000000fe;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfe80000000000001;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000018000000000;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000001f0a;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffff7a53;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffffff;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000ff0000ff86;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffa6ff91fdd8ef77;
+  *((unsigned long*)& __m128i_op1[0]) = 0x061202bffb141c38;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000005a00000228;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffff9ee000004ec;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000002000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x000000001fe02000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000002000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000000001fe02000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x30eb020302101b03;
+  *((unsigned long*)& __m128i_op0[0]) = 0x020310d0c0030220;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000002345454;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00000000c0dec4ca;
+  *((unsigned long*)& __m128i_result[1]) = 0x000030ebffffffdc;
+  *((unsigned long*)& __m128i_result[0]) = 0x00000203ffffff25;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x380fdfdfc0000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffc7f100004000;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00005dcbe7e830c0;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000015d926c7;
+  *((unsigned long*)& __m128i_op1[0]) = 0x000000000000e41b;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000005dcb;
+  __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000014;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000014;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00f0008100800080;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00f000807000009e;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0003c853c843c87e;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0003c853c843c87e;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000ec382e;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000ec382d;
+  __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfcfcfcfcfcfcfcfd;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfcfcfcfcfcfc0000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00009c7c00007176;
+  *((unsigned long*)& __m128i_result[1]) = 0xfffffffffcfcfcfc;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffffffffcfc6080;
+  __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xc0b4d1a5f8babad3;
+  *((unsigned long*)& __m128i_op0[0]) = 0xbbc8ecc5f3ced5f3;
+  *((unsigned long*)& __m128i_op1[1]) = 0xffaefffbffaefffb;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffaefffbffaefffb;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffc105d1aa;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffbc19ecca;
+  __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0001000101fd01fe;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000fe00ff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001;
+  __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfffff0000000ad3d;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfffff000fffff000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x1000100010001000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x1000100010001000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xefffdffff0009d3d;
+  __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000ff000000ff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000ff0000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffff00ffffff01;
+  __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x000100010001007c;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x000100010001007c;
+  __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x5f675e96e29a5a60;
+  *((unsigned long*)& __m128i_op0[0]) = 0x7fff7fff7fff7fff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00fe000100cf005f;
+  *((unsigned long*)& __m128i_op1[0]) = 0x7fff7fff7fff7fff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x5e695e95e1cb5a01;
+  __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x7efefefe82010201;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-2.c
new file mode 100644
index 00000000000..5c19f7713d7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-2.c
@@ -0,0 +1,307 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int main ()
+{
+  __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+  __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+  __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+  int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail;
+  long int long_op0, long_op1, long_op2, lont_out, lont_result;
+  long int long_int_out, long_int_result;
+  unsigned int unsigned_int_out, unsigned_int_result;
+  unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000010000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfe07e5fefefdddfe;
+  *((unsigned long*)& __m128i_op1[0]) = 0x00020100fedd0c00;
+  *((unsigned long*)& __m128i_result[1]) = 0xff02ff1bff02ff23;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000ffffff02fff4;
+  __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfffefff6fff80002;
+  *((unsigned long*)& __m128i_op1[1]) = 0x82c53a0000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xc72ef153fc02fdf7;
+  *((unsigned long*)& __m128i_result[1]) = 0x007d00c500ff00ff;
+  *((unsigned long*)& __m128i_result[0]) = 0x0038000e0003ff03;
+  __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x000000000000007b;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x7ff0000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x7ff0000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x007f000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x007f000000000000;
+  __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000040000000400;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x8000000000000010;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xffff800000000000;
+  __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfc01fd1300000001;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfe00fd1400010000;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfc01fd1300000001;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfe00fd1400010000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000000ffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000000fffff800;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x000000000000ffff;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffff;
+  __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000200000002;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000200000002;
+  *((unsigned long*)& __m128i_op1[1]) = 0xfe813f00fe813f00;
+  *((unsigned long*)& __m128i_op1[0]) = 0xfe813f00fe813f00;
+  *((unsigned long*)& __m128i_result[1]) = 0xffff017fffff017f;
+  *((unsigned long*)& __m128i_result[0]) = 0xffff017fffff017f;
+  __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x9c7c266e71768fa4;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x00009c7c00007176;
+  __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0001000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0001000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000100000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000;
+  __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000800000008;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000800000008;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000008;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000009;
+  __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000897957687;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000408;
+  *((unsigned long*)& __m128i_op1[1]) = 0x7fff0007e215b122;
+  *((unsigned long*)& __m128i_op1[0]) = 0x7ffeffff7bfff828;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffff80010001;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffff80010001;
+  __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x00000af555555555;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00000af555555555;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000af5;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000af5;
+  __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x8000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x8000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x8000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x8000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x2e34594c3b000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x000000002e34594c;
+  __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000036280001;
+  *((unsigned long*)& __m128i_op0[0]) = 0x42a0000042a02001;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000036280001;
+  __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xd0b1ffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0x9d519ee8d2d84f1d;
+  *((unsigned long*)& __m128i_op1[1]) = 0x8644ffff0000ffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000ffff0000fffe;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x4a6d0000ffff0000;
+  __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x82c539ffffffffff;
+  *((unsigned long*)& __m128i_op1[0]) = 0xc72df14afbfafdf9;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x7d3ac60000000000;
+  __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000010000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x00ff00ff00fe00ff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000000100000000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x0000000000010000;
+  __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0xfeffffffffffffff;
+  *((unsigned long*)& __m128i_op0[0]) = 0xfeffffffffffffff;
+  *((unsigned long*)& __m128i_op1[1]) = 0x00000fffffffe000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0000102020204000;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0xfefff00000001fff;
+  __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0003000300000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0003000300a10003;
+  *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long*)& __m128i_result[0]) = 0xfffcfffd00000000;
+  __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long*)& __m128i_op0[1]) = 0x6363636363636363;
+  *((unsigned long*)& __m128i_op0[0]) = 0x6363636363636363;
+  *((unsigned long*)& __m128i_op1[1]) = 0x0000000200000000;
+  *((unsigned long*)& __m128i_op1[0]) = 0x0002000200000001;
+  *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long*)& __m128i_result[0]) = 0x6363636163636363;
+  __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1);
+  ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
-- 
2.20.1



More information about the Gcc-patches mailing list