diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-1.c
new file mode 100644
index 00000000000..cb4be04757c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-1.c
@@ -0,0 +1,299 @@
+/* { 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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x3ff0000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x40f3fa0000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffb4ff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffb4ff;
+  *((unsigned long *)&__m128i_result[1]) = 0xc110000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xc00d060000000000;
+  __m128i_out = __lsx_vdiv_b (__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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101;
+  __m128i_out = __lsx_vdiv_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000020000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0101000101010001;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000fe0000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffff00ffffff00ff;
+  __m128i_out = __lsx_vdiv_b (__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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0101010100000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0101010100000000;
+  __m128i_out = __lsx_vdiv_b (__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]) = 0xd3259a2984048c23;
+  *((unsigned long *)&__m128i_op1[0]) = 0xf9796558e39953fd;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffff9727ffff9727;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffe79ffffba5f;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x010169d9010169d9;
+  *((unsigned long *)&__m128i_result[0]) = 0x01010287010146a1;
+  __m128i_out = __lsx_vdiv_b (__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]) = 0x80010001b57fc565;
+  *((unsigned long *)&__m128i_op1[0]) = 0x8001000184000be0;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000080001fffe;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_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]) = 0xffffffff9cf0d77b;
+  *((unsigned long *)&__m128i_op1[0]) = 0xc1000082b0fb585b;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000ff000000ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000ff000000ff;
+  *((unsigned long *)&__m128i_op1[1]) = 0x33f5c2d7d975d7fe;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000ff010000ff01;
+  __m128i_out = __lsx_vdiv_h (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000030000;
+  __m128i_out = __lsx_vdiv_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]) = 0x4f4f4f4f4f4f4f4f;
+  *((unsigned long *)&__m128i_op1[0]) = 0x4f4f4f4f4f4f4f4f;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00003ff000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000fffc00000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00001ff800000001;
+  *((unsigned long *)&__m128i_op1[0]) = 0x7ffe800e80000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000200000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x195f307a5d04acbb;
+  *((unsigned long *)&__m128i_op0[0]) = 0x6a1a3fbb3c90260e;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xe6a0cf86a2fb5345;
+  *((unsigned long *)&__m128i_result[0]) = 0x95e5c045c36fd9f2;
+  __m128i_out = __lsx_vdiv_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfffffffffffffffe;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000100000000;
+  __m128i_out = __lsx_vdiv_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]) = 0x4f804f804f804f80;
+  *((unsigned long *)&__m128i_op1[0]) = 0x4f804f804f804f80;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_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]) = 0x000fffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0010000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_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]) = 0x370bdfecffecffec;
+  *((unsigned long *)&__m128i_op1[0]) = 0x370bdfecffecffec;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_w (__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]) = 0x7f80000000000007;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000700000007;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000000e32c50e;
+  *((unsigned long *)&__m128i_result[0]) = 0xf2b2ce330e32c50e;
+  __m128i_out = __lsx_vdiv_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffff00000001;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffff00000001;
+  __m128i_out = __lsx_vdiv_d (__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]) = 0x52527d7d52527d7d;
+  *((unsigned long *)&__m128i_op1[0]) = 0x52527d7d52527d7d;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vdiv_d (__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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x8000000080000000;
+  __m128i_out = __lsx_vdiv_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]) = 0xe93d0bd19ff0c170;
+  *((unsigned long *)&__m128i_op1[0]) = 0x5237c1bac9eadf55;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x003fffff00000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x003fffff00000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000000003dffc2;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000000003dffc2;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000001084314a6;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000001084314a6;
+  __m128i_out = __lsx_vdiv_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000ffef0010000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000010000010101;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0101000001000100;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x4280000042800000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xbd7fffffbd800000;
+  __m128i_out = __lsx_vdiv_d (__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]) = 0x30eb022002101b20;
+  *((unsigned long *)&__m128i_op1[0]) = 0x020310edc003023d;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000002000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000002000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000000000004ff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000000667ae56;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000020;
+  __m128i_out = __lsx_vdiv_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-vdiv-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-2.c
new file mode 100644
index 00000000000..f2bc7df27c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-2.c
@@ -0,0 +1,254 @@
+/* { 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]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffefffffffef;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffefffffffef;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_bu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xe3e3e3e3e3e3e3e3;
+  *((unsigned long *)&__m128i_op1[1]) = 0xe3e3e3e3e3e3e3e3;
+  *((unsigned long *)&__m128i_op1[0]) = 0xe3e3e3e3e3e3e3e3;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101;
+  __m128i_out = __lsx_vdiv_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfffffffffffffffe;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101;
+  __m128i_out = __lsx_vdiv_bu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0006000000040000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0002000000000007;
+  *((unsigned long *)&__m128i_op1[1]) = 0x31b1777777777776;
+  *((unsigned long *)&__m128i_op1[0]) = 0x6eee282828282829;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_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]) = 0x0101010101010101;
+  *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101;
+  __m128i_out = __lsx_vdiv_bu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000010100000101;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000010100000101;
+  *((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_vdiv_bu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0effeffefdffa1e0;
+  *((unsigned long *)&__m128i_op0[0]) = 0xe6004c5f64284224;
+  *((unsigned long *)&__m128i_op1[1]) = 0xfeffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfeffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000000010000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_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]) = 0x10f917d72d3d01e4;
+  *((unsigned long *)&__m128i_op1[0]) = 0x203e16d116de012b;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000073;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000000002a;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00ffffff00ff00ff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00ff00ffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000003f200001e01;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000014bf000019da;
+  *((unsigned long *)&__m128i_op1[1]) = 0x9c9c99aed5b88fcf;
+  *((unsigned long *)&__m128i_op1[0]) = 0x7c3650c5f79a61a3;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0002000200020002;
+  *((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_vdiv_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]) = 0x8080808080808080;
+  *((unsigned long *)&__m128i_op1[0]) = 0x8080808080800008;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffd700;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffff00;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffff00;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000100000000;
+  __m128i_out = __lsx_vdiv_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]) = 0x0000ffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000ffffffdfffdf;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_wu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000000ff00;
+  *((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_vdiv_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_vdiv_wu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffffffffbfff8;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0080008000800080;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0080006b0000000b;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000001ff1745745c;
+  __m128i_out = __lsx_vdiv_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]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_wu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffff14eb54ab;
+  *((unsigned long *)&__m128i_op0[0]) = 0x14ea6a002a406a00;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffff80008a7555aa;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0a7535006af05cf9;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000200000000;
+  __m128i_out = __lsx_vdiv_wu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0141010101410101;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0141010101410101;
+  *((unsigned long *)&__m128i_op1[1]) = 0xfebffefffebffeff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfebffefffebffeff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x6363797c63996399;
+  *((unsigned long *)&__m128i_op0[0]) = 0x171f0a1f6376441f;
+  *((unsigned long *)&__m128i_op1[1]) = 0x6363797c63996399;
+  *((unsigned long *)&__m128i_op1[0]) = 0x171f0a1f6376441f;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vdiv_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000036de0000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000003be14000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x000000000000006f;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000001f0a;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000007e8a60;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000001edde;
+  __m128i_out = __lsx_vdiv_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]) = 0x0000000015d926c7;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000000000000e41b;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vdiv_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x77c0404a4000403a;
+  *((unsigned long *)&__m128i_op0[0]) = 0x77c03fd640003fc6;
+  *((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_vdiv_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0042003e0042002f;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001fffc0001fffc;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0042003e0042002f;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0001fffc0001fffc;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vdiv_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000feff2356;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000fd165486;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000007;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000007;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000246d9755;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000002427c2ee;
+  __m128i_out = __lsx_vdiv_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-vmod-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-1.c
new file mode 100644
index 00000000000..5470d40dd69
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-1.c
@@ -0,0 +1,254 @@
+/* { 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]) = 0x82c539ffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xc72df14afbfafdf9;
+  *((unsigned long *)&__m128i_op1[1]) = 0x82c539ffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xc72df14afbfafdf9;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0xffffffff994cb09c;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffc3639d96;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0003c853c843c844;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0003c853c843c844;
+  *((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_vmod_b (__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]) = 0x6363636363636363;
+  *((unsigned long *)&__m128i_op1[0]) = 0x6363636363636363;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0001808281820102;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001808201018081;
+  *((unsigned long *)&__m128i_op1[1]) = 0x8080808080808080;
+  *((unsigned long *)&__m128i_op1[0]) = 0x8080808080808080;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001008281820102;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001008201010081;
+  __m128i_out = __lsx_vmod_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0101010240010202;
+  *((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_vmod_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xff00ff00ff00ff00;
+  *((unsigned long *)&__m128i_op0[0]) = 0xff00ff00ff00ff00;
+  *((unsigned long *)&__m128i_op1[1]) = 0xff00ff00ff00ff00;
+  *((unsigned long *)&__m128i_op1[0]) = 0xff00ff00ff00ff00;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000104000800;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0101080408040804;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0804080407040804;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000104000800;
+  __m128i_out = __lsx_vmod_h (__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]) = 0x1202120212021202;
+  *((unsigned long *)&__m128i_op1[0]) = 0x1202120212021202;
+  *((unsigned long *)&__m128i_result[1]) = 0x1000100010001000;
+  *((unsigned long *)&__m128i_result[0]) = 0x1000100010001000;
+  __m128i_out = __lsx_vmod_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00ff00ff00ff00ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00ff00ff00ff00ff;
+  *((unsigned long *)&__m128i_op1[1]) = 0xfffffffffffffffa;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfffffffffffffffa;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000003;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000003;
+  __m128i_out = __lsx_vmod_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]) = 0xfffffffffffffffc;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfffffffffffffffc;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xf6548a1747e59090;
+  *((unsigned long *)&__m128i_op0[0]) = 0x27b169bbb8145f50;
+  *((unsigned long *)&__m128i_op1[1]) = 0xf6548a1747e59090;
+  *((unsigned long *)&__m128i_op1[0]) = 0x27b169bbb8145f50;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x370bdfecffecffec;
+  *((unsigned long *)&__m128i_op0[0]) = 0x370bdfeca2eb9931;
+  *((unsigned long *)&__m128i_op1[1]) = 0x370bdfecffecffec;
+  *((unsigned long *)&__m128i_op1[0]) = 0x370bdfeca2eb9931;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x805ffffe01001fe0;
+  *((unsigned long *)&__m128i_op0[0]) = 0x9a49e11102834d70;
+  *((unsigned long *)&__m128i_op1[1]) = 0x8144ffff01c820a4;
+  *((unsigned long *)&__m128i_op1[0]) = 0x9b2ee1a4034b4e34;
+  *((unsigned long *)&__m128i_result[1]) = 0xff1affff01001fe0;
+  *((unsigned long *)&__m128i_result[0]) = 0xff1aff6d02834d70;
+  __m128i_out = __lsx_vmod_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x001d001d001d001d;
+  *((unsigned long *)&__m128i_op0[0]) = 0x001d001d001d0000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x001d001d001d001d;
+  *((unsigned long *)&__m128i_op1[0]) = 0x001d001d001d0000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0x000a000a000a000a;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000a000a000a000a;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0x4f8000004f800000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x4f8000004f800000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vmod_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00ffff0000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00ffff000000ff00;
+  *((unsigned long *)&__m128i_op1[1]) = 0x03c0000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x03c0038000000380;
+  *((unsigned long *)&__m128i_result[1]) = 0x00ffff0000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ffff000000ff00;
+  __m128i_out = __lsx_vmod_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]) = 0x0000006f00001f0a;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000958affff995d;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x80000000307d0771;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0d8e36706ac02b9b;
+  *((unsigned long *)&__m128i_op1[1]) = 0x80000000307d0771;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0d8e36706ac02b9b;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x8000000000000000;
+  *((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_vmod_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]) = 0x413e276583869d79;
+  *((unsigned long *)&__m128i_op1[0]) = 0x7f7f017f9d8726d3;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0x000000000011ffee;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000000000dfff2;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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-vmod-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-2.c
new file mode 100644
index 00000000000..8deb04427a0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-2.c
@@ -0,0 +1,254 @@
+/* { 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]) = 0x16161616a16316b0;
+  *((unsigned long *)&__m128i_op0[0]) = 0x6363636363636363;
+  *((unsigned long *)&__m128i_op1[1]) = 0x16161616a16316b0;
+  *((unsigned long *)&__m128i_op1[0]) = 0x6363636363636363;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_bu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000001fffffffe;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000001fffffffe;
+  *((unsigned long *)&__m128i_op1[1]) = 0x5a5a5a5a5b5a5b5a;
+  *((unsigned long *)&__m128i_op1[0]) = 0x5a5a5a5a5b5a5b5a;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000001494b494a;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000001494b494a;
+  __m128i_out = __lsx_vmod_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_vmod_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]) = 0xd70b30c96ea9f4e8;
+  *((unsigned long *)&__m128i_op1[0]) = 0xa352bfac9269e0aa;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0xffffffffffffffeb;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffeb;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0x7f801fa06451ef11;
+  *((unsigned long *)&__m128i_op1[0]) = 0x68bcf93435ed25ed;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000022666621;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffdd9999da;
+  *((unsigned long *)&__m128i_op1[1]) = 0x7f7f7f7f00107f04;
+  *((unsigned long *)&__m128i_op1[0]) = 0x7f0000fd7f0000fd;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000066621;
+  *((unsigned long *)&__m128i_result[0]) = 0x01ff00085e9900ab;
+  __m128i_out = __lsx_vmod_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000000000bd3d;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000007fff0000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xefffdffff0009d3d;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000000000bd3d;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000007fff0000;
+  __m128i_out = __lsx_vmod_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000004870ba0;
+  *((unsigned long *)&__m128i_op1[1]) = 0x478b478b38031779;
+  *((unsigned long *)&__m128i_op1[0]) = 0x6b769e690fa1e119;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000004870ba0;
+  __m128i_out = __lsx_vmod_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x2006454690d3de87;
+  *((unsigned long *)&__m128i_op0[0]) = 0x2006454690d3de87;
+  *((unsigned long *)&__m128i_op1[1]) = 0x2006454690d3de87;
+  *((unsigned long *)&__m128i_op1[0]) = 0x2006454690d3de87;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0002000200020002;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0002000200020002;
+  *((unsigned long *)&__m128i_op1[1]) = 0x02b010f881a281a2;
+  *((unsigned long *)&__m128i_op1[0]) = 0x27b169bbb8145f50;
+  *((unsigned long *)&__m128i_result[1]) = 0x0002000200020002;
+  *((unsigned long *)&__m128i_result[0]) = 0x0002000200020002;
+  __m128i_out = __lsx_vmod_hu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffff100000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0010001000100010;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0010001000100010;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000f000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_wu (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000fffe0000fffe;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffff00ffffff00;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffff00ffffff00;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000fffe0000fffe;
+  __m128i_out = __lsx_vmod_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]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0x00ff00ff00ff00ff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00ff00ff00ff00ff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0x0000000000000200;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000200;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffff00000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000000ffff0000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vmod_du (__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]) = 0xff80ff80ff80ff80;
+  *((unsigned long *)&__m128i_op1[0]) = 0xff80ff8080008000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000101fd01fe;
+  __m128i_out = __lsx_vmod_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffcafff8ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000000000a0;
+  *((unsigned long *)&__m128i_op1[1]) = 0xff2cfed4fea8ff44;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfffeffff0035ff8f;
+  *((unsigned long *)&__m128i_result[1]) = 0x00d3012acc56f9bb;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000000000a0;
+  __m128i_out = __lsx_vmod_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x37c0001000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x37c0001000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0004000400040004;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0004000400040004;
+  *((unsigned long *)&__m128i_result[1]) = 0x0003c853c843c844;
+  *((unsigned long *)&__m128i_result[0]) = 0x0003c853c843c844;
+  __m128i_out = __lsx_vmod_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000003ddc5dac;
+  *((unsigned long *)&__m128i_op1[1]) = 0xfcfcfcdcfcfcfcdc;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfcfcfcdcfcfcfcdc;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000003ddc5dac;
+  __m128i_out = __lsx_vmod_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffffefffff784;
+  *((unsigned long *)&__m128i_op1[1]) = 0x10f8000100000001;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000001000010f8;
+  *((unsigned long *)&__m128i_result[1]) = 0x0177fff0fffffff0;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000011ff8bc;
+  __m128i_out = __lsx_vmod_du (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
