[v4,14/23] LoongArch: Add tests for SX vector vsll/vslli/vsrl/vsrli/vsrln/vsrlni/vsrlr /vsrlri/vslrlrn/vsrlrni instructions.

Message ID 20230913033522.5983-5-chenxiaolong@loongson.cn
State Accepted
Headers
Series Add tests for SX vector instructions. |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

chenxiaolong Sept. 13, 2023, 3:35 a.m. UTC
  gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/vector/lsx/lsx-vsll.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vslli.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsllwil-1.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsllwil-2.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsrl.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsrli.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsrln.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsrlni.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsrlr.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsrlri.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsrlrn.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsrlrni.c: New test.
---
 .../loongarch/vector/lsx/lsx-vsll.c           | 254 +++++++
 .../loongarch/vector/lsx/lsx-vslli.c          | 293 ++++++++
 .../loongarch/vector/lsx/lsx-vsllwil-1.c      | 244 +++++++
 .../loongarch/vector/lsx/lsx-vsllwil-2.c      | 189 +++++
 .../loongarch/vector/lsx/lsx-vsrl.c           | 389 ++++++++++
 .../loongarch/vector/lsx/lsx-vsrli.c          | 328 +++++++++
 .../loongarch/vector/lsx/lsx-vsrln.c          | 335 +++++++++
 .../loongarch/vector/lsx/lsx-vsrlni.c         | 281 +++++++
 .../loongarch/vector/lsx/lsx-vsrlr.c          | 434 +++++++++++
 .../loongarch/vector/lsx/lsx-vsrlri.c         | 300 ++++++++
 .../loongarch/vector/lsx/lsx-vsrlrn.c         | 164 +++++
 .../loongarch/vector/lsx/lsx-vsrlrni.c        | 686 ++++++++++++++++++
 12 files changed, 3897 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsll.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vslli.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsllwil-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsllwil-2.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrl.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrli.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrln.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlni.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlr.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlri.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlrn.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlrni.c
  

Patch

diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsll.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsll.c
new file mode 100644
index 00000000000..7b8ad7d5a44
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsll.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]) = 0x1dcc4255c9d85c05;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3ab7a3fc47a5c31a;
+  *((unsigned long *)&__m128i_op1[1]) = 0x1dcc4255c9d85c05;
+  *((unsigned long *)&__m128i_op1[0]) = 0x3ab7a3fc47a5c31a;
+  *((unsigned long *)&__m128i_result[1]) = 0xb9884ab93b0b80a0;
+  *((unsigned long *)&__m128i_result[0]) = 0xf11e970c68000000;
+  __m128i_out = __lsx_vsll_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0101010101010101;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0100000100010001;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101;
+  *((unsigned long *)&__m128i_result[0]) = 0x0100000100010001;
+  __m128i_out = __lsx_vsll_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_vsll_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_vsll_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_vsll_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_vsll_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_vsll_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_vsll_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00307028003f80b0;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0040007fff800000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffc0ffffff81;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffff008000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0060e050007f0160;
+  *((unsigned long *)&__m128i_result[0]) = 0x0040007fff800000;
+  __m128i_out = __lsx_vsll_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000401000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000401000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsll_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x3fffffff80000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00003ffd000a4000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xfffcffff00000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000fffd000a0000;
+  *((unsigned long *)&__m128i_result[1]) = 0xf000800080000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000a00028004000;
+  __m128i_out = __lsx_vsll_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x6b9fe3649c9d6363;
+  *((unsigned long *)&__m128i_op0[0]) = 0x6363bc9e8b696363;
+  *((unsigned long *)&__m128i_op1[1]) = 0x6b9fe3649c9d6363;
+  *((unsigned long *)&__m128i_op1[0]) = 0x6363bc9e8b696363;
+  *((unsigned long *)&__m128i_result[1]) = 0xb9fe3640e4eb1b18;
+  *((unsigned long *)&__m128i_result[0]) = 0x800000005b4b1b18;
+  __m128i_out = __lsx_vsll_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x80001b155b4b0000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffff00006c82;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00009b140000917b;
+  *((unsigned long *)&__m128i_result[1]) = 0x80000000fffffffc;
+  *((unsigned long *)&__m128i_result[0]) = 0xb150000000000000;
+  __m128i_out = __lsx_vsll_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_vsll_h (__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]) = 0x8000000000008000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsll_h (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x03f1e3d28b1a8a1a;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x18e2184858682868;
+  __m128i_out = __lsx_vsll_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_vsll_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_vsll_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ff02d060;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000000ff02d060;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xff02d06000000000;
+  __m128i_out = __lsx_vsll_d (__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]) = 0x0001000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001;
+  __m128i_out = __lsx_vsll_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7fffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x8000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x7fffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x8000000000000000;
+  __m128i_out = __lsx_vsll_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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsll_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_vsll_w (__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_vsll_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000200000001c;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000200000001c;
+  *((unsigned long *)&__m128i_op1[1]) = 0x000000200000001c;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000000200000001c;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000020000000c0;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000020000000c0;
+  __m128i_out = __lsx_vsll_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_vsll_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vslli.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vslli.c
new file mode 100644
index 00000000000..7a77e80c081
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vslli.c
@@ -0,0 +1,293 @@ 
+/* { 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_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0x35);
+  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_vslli_b (__m128i_op0, 0x2);
+  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_vslli_w (__m128i_op0, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xaaaaffebcfb748e0;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfd293eab528e7ebe;
+  *((unsigned long *)&__m128i_result[1]) = 0xf6e91c0000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x51cfd7c000000000;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0x25);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffff0ffe04000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0x3f);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xfffcfffcfffcfffc;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffcfffcfffcfffc;
+  __m128i_out = __lsx_vslli_h (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xc39fffff007fffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000fe00fd;
+  *((unsigned long *)&__m128i_result[1]) = 0x0e7ffffc01fffffc;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000003f803f4;
+  __m128i_out = __lsx_vslli_w (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vslli_h (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000080000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000080000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000800000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000800000000000;
+  __m128i_out = __lsx_vslli_b (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000040;
+  __m128i_out = __lsx_vslli_h (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vslli_w (__m128i_op0, 0x19);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7ff8000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0x3c);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffff00ffff00ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffff00;
+  *((unsigned long *)&__m128i_result[1]) = 0xfcfcfc00fcfc00fc;
+  *((unsigned long *)&__m128i_result[0]) = 0xfcfcfcfcfcfcfc00;
+  __m128i_out = __lsx_vslli_b (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000000000007b;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000060;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vslli_b (__m128i_op0, 0x5);
+  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_vslli_d (__m128i_op0, 0x38);
+  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_vslli_w (__m128i_op0, 0xe);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000000f00f;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000000f00f;
+  __m128i_out = __lsx_vslli_b (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000d46cdc13;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000060000000;
+  __m128i_out = __lsx_vslli_w (__m128i_op0, 0x1d);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7ff0000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x61608654a2d4f6da;
+  *((unsigned long *)&__m128i_result[1]) = 0xfee0000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xc2c00ca844a8ecb4;
+  __m128i_out = __lsx_vslli_b (__m128i_op0, 0x1);
+  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_vslli_h (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0004000400040004;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0004000400040004;
+  *((unsigned long *)&__m128i_result[1]) = 0x0100000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0100000000000000;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0x36);
+  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_vslli_w (__m128i_op0, 0x18);
+  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_vslli_b (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0x18);
+  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_vslli_b (__m128i_op0, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000002;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00ff010300ff0103;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000002000;
+  *((unsigned long *)&__m128i_result[0]) = 0xf0003000f0003000;
+  __m128i_out = __lsx_vslli_h (__m128i_op0, 0xc);
+  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_vslli_w (__m128i_op0, 0x12);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x8000000080000000;
+  __m128i_out = __lsx_vslli_w (__m128i_op0, 0x1f);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffff800fff01;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffff001ffe02;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xd78cfd70b5f65d76;
+  *((unsigned long *)&__m128i_op0[0]) = 0x5779108fdedda7e4;
+  *((unsigned long *)&__m128i_result[1]) = 0x67eb85afb2ebb000;
+  *((unsigned long *)&__m128i_result[0]) = 0xc8847ef6ed3f2000;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfffffff7fffffff7;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffff7fffffff7;
+  *((unsigned long *)&__m128i_result[1]) = 0xfcfcfcdcfcfcfcdc;
+  *((unsigned long *)&__m128i_result[0]) = 0xfcfcfcdcfcfcfcdc;
+  __m128i_out = __lsx_vslli_b (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7fffffff7fffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xc0c0c0c0c0c0c0c0;
+  *((unsigned long *)&__m128i_result[0]) = 0xc0c0c0c0c0c0c0c0;
+  __m128i_out = __lsx_vslli_b (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vslli_h (__m128i_op0, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xe2560afe9c001a18;
+  *((unsigned long *)&__m128i_op0[0]) = 0xe2560afe9c001a18;
+  *((unsigned long *)&__m128i_result[1]) = 0x89582bf870006860;
+  *((unsigned long *)&__m128i_result[0]) = 0x89582bf870006860;
+  __m128i_out = __lsx_vslli_w (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x841f000fc28f801f;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x107c003c083c007c;
+  __m128i_out = __lsx_vslli_b (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffff9727ffff9727;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffe79ffffba5f;
+  *((unsigned long *)&__m128i_result[1]) = 0xffff972700000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffba5f00000000;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0x20);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x101b0330eb022002;
+  *((unsigned long *)&__m128i_op0[0]) = 0x030220020310edc0;
+  *((unsigned long *)&__m128i_result[1]) = 0x0080800080000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x8000000080008000;
+  __m128i_out = __lsx_vslli_b (__m128i_op0, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x317fce80317fce80;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xf0000000f0000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vslli_h (__m128i_op0, 0xc);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0177fff0fffffff0;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000011ff8bc;
+  *((unsigned long *)&__m128i_result[1]) = 0x05dfffc3ffffffc0;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000047fe2f0;
+  __m128i_out = __lsx_vslli_d (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsllwil-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsllwil-1.c
new file mode 100644
index 00000000000..796e88cad57
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsllwil-1.c
@@ -0,0 +1,244 @@ 
+/* { 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]) = 0x0020002000200020;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0020002000200020;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000002000000020;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000002000000020;
+  __m128i_out = __lsx_vsllwil_h_b (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000e0000000e0;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000000000fc00;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000000fc00;
+  __m128i_out = __lsx_vsllwil_h_b (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsllwil_h_b (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vsllwil_h_b (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffeb48e03eab7ebe;
+  *((unsigned long *)&__m128i_result[1]) = 0xffc0fac01200f800;
+  *((unsigned long *)&__m128i_result[0]) = 0x0f80eac01f80ef80;
+  __m128i_out = __lsx_vsllwil_h_b (__m128i_op0, 0x6);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000e7e20468;
+  *((unsigned long *)&__m128i_op0[0]) = 0xc2fac2fa53e7db29;
+  *((unsigned long *)&__m128i_result[1]) = 0xff84fff4ff84fff4;
+  *((unsigned long *)&__m128i_result[0]) = 0x00a6ffceffb60052;
+  __m128i_out = __lsx_vsllwil_h_b (__m128i_op0, 0x1);
+  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_vsllwil_h_b (__m128i_op0, 0x1);
+  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_vsllwil_h_b (__m128i_op0, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x002e0059003b0000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000005c000000b2;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000007600000000;
+  __m128i_out = __lsx_vsllwil_h_b (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x2e34594c3b000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x017001a002c80260;
+  *((unsigned long *)&__m128i_result[0]) = 0x01d8000000000000;
+  __m128i_out = __lsx_vsllwil_h_b (__m128i_op0, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x4f4f4f4f4f4f4f4f;
+  *((unsigned long *)&__m128i_op0[0]) = 0x4f4f4f4f4f4f4f4f;
+  *((unsigned long *)&__m128i_result[1]) = 0x09e009e009e009e0;
+  *((unsigned long *)&__m128i_result[0]) = 0x09e009e009e009e0;
+  __m128i_out = __lsx_vsllwil_h_b (__m128i_op0, 0x5);
+  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_vsllwil_w_h (__m128i_op0, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000001000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000100000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000040000000400;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0xa);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000005050000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0505000005050505;
+  *((unsigned long *)&__m128i_result[1]) = 0x0028280000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0028280000282800;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfffffffffffff800;
+  *((unsigned long *)&__m128i_op0[0]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffc0000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffc0000000000000;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffff00ffffff00;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffff00ffffff00;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0x8);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xf10cf508f904fd01;
+  *((unsigned long *)&__m128i_op0[0]) = 0xf10cf508f904fd01;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffe218ffffea10;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffff208fffffa02;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x21201f1e1d001b1a;
+  *((unsigned long *)&__m128i_op0[0]) = 0x1918171615141312;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001918000017160;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001514000013120;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfffff60ca7104649;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffff790a15db63d;
+  *((unsigned long *)&__m128i_result[1]) = 0xfffffc00ffde4000;
+  *((unsigned long *)&__m128i_result[0]) = 0xfe857400fed8f400;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0xa);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x1c6c80007fffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0038d800ff000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00fffe00fffffe00;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0x9);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7fc000007fc00000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7fc000007fc00000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00ff800000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ff800000000000;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0x9);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsllwil_w_h (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001fffe00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000007fff800000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsllwil_d_w (__m128i_op0, 0x16);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x007fffff00000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsllwil_d_w (__m128i_op0, 0x1a);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffff80ff0000ffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffff80000000ffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffff0000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000001fffe;
+  __m128i_out = __lsx_vsllwil_d_w (__m128i_op0, 0x1);
+  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_vsllwil_d_w (__m128i_op0, 0x1f);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000104000800;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000040004000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0010002000000000;
+  __m128i_out = __lsx_vsllwil_d_w (__m128i_op0, 0x1a);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000000000007b;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsllwil_d_w (__m128i_op0, 0x1e);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000100000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000020;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsllwil_d_w (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000017fffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000800000;
+  *((unsigned long *)&__m128i_result[0]) = 0x003fffffff800000;
+  __m128i_out = __lsx_vsllwil_d_w (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsllwil_d_w (__m128i_op0, 0x11);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x57f160c4a1750eda;
+  *((unsigned long *)&__m128i_result[1]) = 0x000002bf8b062000;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffd0ba876d000;
+  __m128i_out = __lsx_vsllwil_d_w (__m128i_op0, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsllwil-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsllwil-2.c
new file mode 100644
index 00000000000..5f46293dcd9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsllwil-2.c
@@ -0,0 +1,189 @@ 
+/* { 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]) = 0x00000000007f7f02;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00003f803f800100;
+  __m128i_out = __lsx_vsllwil_hu_bu (__m128i_op0, 0x7);
+  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_vsllwil_hu_bu (__m128i_op0, 0x2);
+  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_vsllwil_hu_bu (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0014000100000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x7f807f807f807f80;
+  __m128i_out = __lsx_vsllwil_hu_bu (__m128i_op0, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000001030103;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0020006000200060;
+  __m128i_out = __lsx_vsllwil_hu_bu (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0808080808080805;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0808080808080805;
+  *((unsigned long *)&__m128i_result[1]) = 0x0020002000200020;
+  *((unsigned long *)&__m128i_result[0]) = 0x0020002000200014;
+  __m128i_out = __lsx_vsllwil_hu_bu (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000ffff0000ffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001fffe0001fffe;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000201fe01fc;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000201fe01fc;
+  __m128i_out = __lsx_vsllwil_hu_bu (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xff1affff01001fe0;
+  *((unsigned long *)&__m128i_op0[0]) = 0xff1aff6d02834d70;
+  *((unsigned long *)&__m128i_result[1]) = 0x7f800d007f803680;
+  *((unsigned long *)&__m128i_result[0]) = 0x0100418026803800;
+  __m128i_out = __lsx_vsllwil_hu_bu (__m128i_op0, 0x7);
+  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_vsllwil_wu_hu (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x3e2b34ca59fa4c88;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3b2c8aefd44be966;
+  *((unsigned long *)&__m128i_result[1]) = 0x0007658000115de0;
+  *((unsigned long *)&__m128i_result[0]) = 0x001a8960001d2cc0;
+  __m128i_out = __lsx_vsllwil_wu_hu (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffff000000ff00;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000ffff0000ff00;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000000ff00;
+  __m128i_out = __lsx_vsllwil_wu_hu (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000040600000406;
+  *((unsigned long *)&__m128i_op0[0]) = 0x020202020202fe02;
+  *((unsigned long *)&__m128i_result[1]) = 0x0020200000202000;
+  *((unsigned long *)&__m128i_result[0]) = 0x002020000fe02000;
+  __m128i_out = __lsx_vsllwil_wu_hu (__m128i_op0, 0xc);
+  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_vsllwil_wu_hu (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsllwil_wu_hu (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000001ffffffe;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000002;
+  __m128i_out = __lsx_vsllwil_wu_hu (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3131313131313131;
+  *((unsigned long *)&__m128i_result[1]) = 0x0313100003131000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0313100003131000;
+  __m128i_out = __lsx_vsllwil_wu_hu (__m128i_op0, 0xc);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000900000009;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000900000009;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000090;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000090;
+  __m128i_out = __lsx_vsllwil_wu_hu (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000200000002;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000020000007d;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000800000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000001f400000;
+  __m128i_out = __lsx_vsllwil_du_wu (__m128i_op0, 0x16);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000005;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000005;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000280000;
+  __m128i_out = __lsx_vsllwil_du_wu (__m128i_op0, 0x13);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000fef01000e27ca;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000001fde020000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000001c4f940000;
+  __m128i_out = __lsx_vsllwil_du_wu (__m128i_op0, 0x11);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000ffffffff00;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000ffffffff00;
+  __m128i_out = __lsx_vsllwil_du_wu (__m128i_op0, 0x8);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7fff010181010102;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7fffffff81010102;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000fffffffe000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000102020204000;
+  __m128i_out = __lsx_vsllwil_du_wu (__m128i_op0, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000800000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000800000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000008000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsllwil_du_wu (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  int_out = __lsx_vpickve2gr_w (__m128i_op0, 0x0);
+  *((unsigned long *)&__m128i_op0[1]) = 0x8d78336c83652b86;
+  *((unsigned long *)&__m128i_op0[0]) = 0x39c51f389c0d6112;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000001ce28f9c0;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000004e06b0890;
+  __m128i_out = __lsx_vsllwil_du_wu (__m128i_op0, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrl.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrl.c
new file mode 100644
index 00000000000..f9c7898557f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrl.c
@@ -0,0 +1,389 @@ 
+/* { 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]) = 0xffffffefffffffef;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffefffffffef;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffefffffffef;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffefffffffef;
+  __m128i_out = __lsx_vsrl_b (__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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0101010100000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000005555555554;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000005555555554;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000001000f000e;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000fff1000ffffe;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000002a55005501;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000002a55000001;
+  __m128i_out = __lsx_vsrl_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x80000000fff8fff8;
+  *((unsigned long *)&__m128i_op0[0]) = 0x80000000fff80000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x7f800000fff8fff8;
+  *((unsigned long *)&__m128i_op1[0]) = 0x7f800000fff80000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000080;
+  *((unsigned long *)&__m128i_result[0]) = 0x80000000fff80000;
+  __m128i_out = __lsx_vsrl_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0004000000040000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0004000000040000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xfff6fff6fff6fff6;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfff6fff6fff6fff6;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_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]) = 0x0000750500006541;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000100fffffefd;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7f8000007f800000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7f8000007f800000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00f900d7003d00e4;
+  *((unsigned long *)&__m128i_op1[0]) = 0x003e00d100de002b;
+  *((unsigned long *)&__m128i_result[1]) = 0x7f4000007f040000;
+  *((unsigned long *)&__m128i_result[0]) = 0x7f0200007f020000;
+  __m128i_out = __lsx_vsrl_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffff00;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffffe000000f6;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffff00000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffff00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x01010101ffffff00;
+  *((unsigned long *)&__m128i_result[0]) = 0x01010101000000f6;
+  __m128i_out = __lsx_vsrl_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]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00ffffff00ff00ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00ff00ffffffffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000049000000c0;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000001ffffff29;
+  *((unsigned long *)&__m128i_result[1]) = 0x00ffff7f00ff00ff;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ff007f0101017f;
+  __m128i_out = __lsx_vsrl_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffff2900000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000401000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffff2900000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001;
+  __m128i_out = __lsx_vsrl_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_vsrl_w (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0xc2f9bafac2fac2fa;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000001fffffffe;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0101080408040804;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0804080407040804;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000000010a000b;
+  *((unsigned long *)&__m128i_result[1]) = 0x0101080408040804;
+  *((unsigned long *)&__m128i_result[0]) = 0x000100810080e081;
+  __m128i_out = __lsx_vsrl_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]) = 0x4688500046f6a000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x4f8000004f7fff02;
+  *((unsigned long *)&__m128i_result[1]) = 0x00ffffff03ffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffff00013fff;
+  __m128i_out = __lsx_vsrl_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffffffffffffe;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffffffffffffe;
+  __m128i_out = __lsx_vsrl_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000021ffffffdf;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000100000e60;
+  *((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_vsrl_d (__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]) = 0x0002000200020002;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0202fe02fd020102;
+  *((unsigned long *)&__m128i_result[1]) = 0x0400040004000400;
+  *((unsigned long *)&__m128i_result[0]) = 0x0400040004000400;
+  __m128i_out = __lsx_vsrl_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0101fe870101fe87;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0101fe8700000000;
+  *((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_vsrl_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_vsrl_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]) = 0x7ff0000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x61608654a2d4f6da;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000000000fb01;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000007000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0006000000040000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0002000000000007;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000000000fb01;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000000e0000;
+  __m128i_out = __lsx_vsrl_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000ff0000ff0000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000ff0000ff0000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000ff0000000000;
+  __m128i_out = __lsx_vsrl_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00ff000100ff00fe;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00ff003000ff00a0;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00ff000100ff00fe;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ff003000ff00a0;
+  __m128i_out = __lsx_vsrl_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x5d7f5d807fea807f;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100010100;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000080000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000080000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000080000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000080000000;
+  __m128i_out = __lsx_vsrl_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffe0000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffe0000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffe0000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffe0000000;
+  __m128i_out = __lsx_vsrl_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000ff00ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000ff00ff;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000ff00ff;
+  __m128i_out = __lsx_vsrl_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfffffffefffffffe;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffffe7fffffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000000000001fd02;
+  *((unsigned long *)&__m128i_result[1]) = 0xfffffffefffffffe;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffffe1fffffff;
+  __m128i_out = __lsx_vsrl_w (__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]) = 0x0000000900000009;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffff7fffffff7f;
+  __m128i_out = __lsx_vsrl_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_vsrl_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_vsrl_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffff007fff810001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000400530050ffa6;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffff800fff01;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x000000007ff000ff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsrl_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_vsrl_b (__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_vsrl_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_vsrl_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x4399d3221a29d3f2;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x000056f64adb9464;
+  *((unsigned long *)&__m128i_op1[0]) = 0x29ca096f235819c2;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000004399d32;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000ffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000ffffffffffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000ffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000ffffffffffff;
+  __m128i_out = __lsx_vsrl_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]) = 0x0002000200020002;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0002000200020002;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrl_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrli.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrli.c
new file mode 100644
index 00000000000..7b5e9a7bfb6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrli.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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001ffff0001ffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001ffff0001ffff;
+  __m128i_out = __lsx_vsrli_w (__m128i_op0, 0xf);
+  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_vsrli_h (__m128i_op0, 0x7);
+  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_vsrli_w (__m128i_op0, 0xa);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000020000000002;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000010000000100;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000100000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000080000;
+  __m128i_out = __lsx_vsrli_d (__m128i_op0, 0x15);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000017fda829;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000017f0a82;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x03ff03ff03ff03ff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0x6);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000400000004000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000400000204010;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000020000000200;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000020000010200;
+  __m128i_out = __lsx_vsrli_b (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000006;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0xa);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000001fffffffe;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000001fffffffe;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000003fffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000003fffffff;
+  __m128i_out = __lsx_vsrli_w (__m128i_op0, 0x2);
+  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_vsrli_w (__m128i_op0, 0x12);
+  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_vsrli_d (__m128i_op0, 0x37);
+  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_vsrli_h (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0x5);
+  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_vsrli_w (__m128i_op0, 0x1d);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000000000007b;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_d (__m128i_op0, 0x1e);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0020002000200020;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0020002000200020;
+  __m128i_out = __lsx_vsrli_w (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffefffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffefffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0007000700070007;
+  *((unsigned long *)&__m128i_result[0]) = 0x0007000700070007;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x6363636363636363;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000c000c000c000c;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000003d0000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000003d0000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000030000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000030000;
+  __m128i_out = __lsx_vsrli_b (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000010000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00ff00ff00fe00ff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0x9);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000001000000010;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000001000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000100000000;
+  __m128i_out = __lsx_vsrli_b (__m128i_op0, 0x4);
+  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_vsrli_d (__m128i_op0, 0x3d);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000200000002;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000200000002;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_h (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000001000100;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000001000100;
+  __m128i_out = __lsx_vsrli_d (__m128i_op0, 0x18);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000400000000;
+  __m128i_out = __lsx_vsrli_w (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_d (__m128i_op0, 0x3a);
+  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_vsrli_b (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x7fffffff7fffffff;
+  __m128i_out = __lsx_vsrli_w (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xaa14efac3bb62636;
+  *((unsigned long *)&__m128i_op0[0]) = 0xd6c22c8353a80d2c;
+  *((unsigned long *)&__m128i_result[1]) = 0x0002000300000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0003000000010000;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0xe);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x3fff3fff3fff3fff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0x2);
+  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_vsrli_b (__m128i_op0, 0x1);
+  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_vsrli_w (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0080000700000014;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000fffbffda;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000001010101;
+  __m128i_out = __lsx_vsrli_b (__m128i_op0, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfffefffefffefffe;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffefffefffefffe;
+  *((unsigned long *)&__m128i_result[1]) = 0x000001fffdfffdff;
+  *((unsigned long *)&__m128i_result[0]) = 0x000001fffdfffdff;
+  __m128i_out = __lsx_vsrli_d (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_b (__m128i_op0, 0x2);
+  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_vsrli_w (__m128i_op0, 0xc);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xd3259a2984048c23;
+  *((unsigned long *)&__m128i_op0[0]) = 0xf9796558e39953fd;
+  *((unsigned long *)&__m128i_result[1]) = 0x001a64b345308091;
+  *((unsigned long *)&__m128i_result[0]) = 0x001f2f2cab1c732a;
+  __m128i_out = __lsx_vsrli_d (__m128i_op0, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000290;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000290;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000002;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000002;
+  __m128i_out = __lsx_vsrli_b (__m128i_op0, 0x6);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00020000ffff0001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000003030000;
+  __m128i_out = __lsx_vsrli_b (__m128i_op0, 0x6);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000002345454;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000c0dec4ca;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000002;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000060006;
+  __m128i_out = __lsx_vsrli_h (__m128i_op0, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000200000000d;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000200000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000200000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_b (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000000eefff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xf8e1a03affffe3e2;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000003e0000003f;
+  __m128i_out = __lsx_vsrli_w (__m128i_op0, 0x1a);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0fffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrli_d (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrln.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrln.c
new file mode 100644
index 00000000000..5a8f4f70aba
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrln.c
@@ -0,0 +1,335 @@ 
+/* { 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]) = 0x0000c77c000047cd;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000c0f100006549;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_w_d (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_w_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]) = 0xffffe000ffffe000;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffe000ffffe000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsrln_w_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffdfff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffdfff;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffe00001ffe200;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000001ffffdfff;
+  __m128i_out = __lsx_vsrln_w_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffff35cab978;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffff35cab978;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000010035;
+  __m128i_out = __lsx_vsrln_h_w (__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]) = 0x0000000000000020;
+  __m128i_out = __lsx_vsrln_w_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_vsrln_w_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]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_h_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]) = 0x80307028ffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x8040007fffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffff0101ff010101;
+  __m128i_out = __lsx_vsrln_b_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_vsrln_w_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]) = 0x0000000000000003;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000003;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_w_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]) = 0x0000000001000100;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000001000100;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsrln_w_d (__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]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x4180418041804180;
+  __m128i_out = __lsx_vsrln_b_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_vsrln_w_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]) = 0x4f804f804f804f80;
+  *((unsigned long *)&__m128i_op1[0]) = 0x4f804f804f804f80;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_w_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00007fff00007fff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x001ffff0003ffff0;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000fffefffefffef;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ff00ff00000000;
+  __m128i_out = __lsx_vsrln_b_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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsrln_w_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_vsrln_w_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00008bf700017052;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000f841000091aa;
+  *((unsigned long *)&__m128i_op1[1]) = 0xe6d4572c8a5835bc;
+  *((unsigned long *)&__m128i_op1[0]) = 0xe5017c2ac9ca9fd0;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000f8410000;
+  __m128i_out = __lsx_vsrln_w_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffff0000ffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000001010001;
+  __m128i_out = __lsx_vsrln_b_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000100000001000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0ed5ced7e51023e5;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000010000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00001000e51023e5;
+  __m128i_out = __lsx_vsrln_w_d (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000010001;
+  __m128i_out = __lsx_vsrln_h_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]) = 0x0000000000020002;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000020002;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_b_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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsrln_b_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_h_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_vsrln_b_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000004;
+  *((unsigned long *)&__m128i_op1[1]) = 0x000000017ffeffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000000017ffeffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_h_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_vsrln_h_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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_w_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x379674c000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3789f68000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xfefeff00fefeff00;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfefeff00fefeff00;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00c0000000800000;
+  __m128i_out = __lsx_vsrln_b_h (__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]) = 0x0000000071768fa4;
+  __m128i_out = __lsx_vsrln_w_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_vsrln_h_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffdfdc0d;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x3ff0000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000ffdfdc0d;
+  __m128i_out = __lsx_vsrln_w_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]) = 0x00000000246d9755;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000000002427c2ee;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrln_h_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_vsrln_b_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlni.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlni.c
new file mode 100644
index 00000000000..ca462c83411
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlni.c
@@ -0,0 +1,281 @@ 
+/* { 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]) = 0x7fc000007fc00000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x1e801ffc7fc00000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00003fe00ffe3fe0;
+  __m128i_out = __lsx_vsrlni_w_d (__m128i_op0, __m128i_op1, 0x11);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000ff000000ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00ff00ff00000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlni_b_h (__m128i_op0, __m128i_op1, 0x0);
+  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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000000001f;
+  __m128i_out = __lsx_vsrlni_d_q (__m128i_op0, __m128i_op1, 0x7b);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000008;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000008;
+  *((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_vsrlni_w_d (__m128i_op0, __m128i_op1, 0xa);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xc39fffff007fffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000fe00fd;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x78c00000ff000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x61cf003f0000007f;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000003c607f80;
+  __m128i_out = __lsx_vsrlni_h_w (__m128i_op0, __m128i_op1, 0x11);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffff7f01ff01;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffff7f01ff01;
+  *((unsigned long *)&__m128i_result[1]) = 0xfffffffffffffe03;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffffffffffe03;
+  __m128i_out = __lsx_vsrlni_h_w (__m128i_op0, __m128i_op1, 0xf);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffff8001ffff8001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x7fff7fff7fff7fff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x001ffff0003ffff0;
+  *((unsigned long *)&__m128i_result[0]) = 0x000fffefffefffef;
+  __m128i_out = __lsx_vsrlni_d_q (__m128i_op0, __m128i_op1, 0x4b);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x6363797c63990099;
+  *((unsigned long *)&__m128i_op0[0]) = 0x171f0a1f6376441f;
+  *((unsigned long *)&__m128i_op1[1]) = 0x6363797c63990099;
+  *((unsigned long *)&__m128i_op1[0]) = 0x171f0a1f6376441f;
+  *((unsigned long *)&__m128i_result[1]) = 0x181e180005021811;
+  *((unsigned long *)&__m128i_result[0]) = 0x181e180005021811;
+  __m128i_out = __lsx_vsrlni_b_h (__m128i_op0, __m128i_op1, 0xa);
+  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]) = 0x0000ffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00003fff00003fff;
+  __m128i_out = __lsx_vsrlni_h_w (__m128i_op0, __m128i_op1, 0x12);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xf0fd800080000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000a00028004000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffff00000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x000f000800000002;
+  *((unsigned long *)&__m128i_result[0]) = 0x000f000000000000;
+  __m128i_out = __lsx_vsrlni_h_w (__m128i_op0, __m128i_op1, 0x1c);
+  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_vsrlni_w_d (__m128i_op0, __m128i_op1, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xaeaeaeaeaeaeae35;
+  *((unsigned long *)&__m128i_op0[0]) = 0xaeaeaeaeaeaeae35;
+  *((unsigned long *)&__m128i_op1[1]) = 0xaeaeaeaeaeaeae35;
+  *((unsigned long *)&__m128i_op1[0]) = 0xaeaeaeaeaeaeae35;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000200000002;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000200000002;
+  __m128i_out = __lsx_vsrlni_w_d (__m128i_op0, __m128i_op1, 0x3e);
+  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_vsrlni_h_w (__m128i_op0, __m128i_op1, 0x1a);
+  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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ff00ff00000000;
+  __m128i_out = __lsx_vsrlni_b_h (__m128i_op0, __m128i_op1, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000008140c80;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000008140c80;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000002050320;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000002050320;
+  __m128i_out = __lsx_vsrlni_w_d (__m128i_op0, __m128i_op1, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000002050320;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000002050320;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0101010101010101;
+  *((unsigned long *)&__m128i_op1[0]) = 0x010101017f010101;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000040600000406;
+  *((unsigned long *)&__m128i_result[0]) = 0x020202020202fe02;
+  __m128i_out = __lsx_vsrlni_b_h (__m128i_op0, __m128i_op1, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffe000ffffe000;
+  *((unsigned long *)&__m128i_op1[0]) = 0xe364525335ede000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000fff00000e36;
+  __m128i_out = __lsx_vsrlni_w_d (__m128i_op0, __m128i_op1, 0x34);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x601fbfbeffffffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xfffb00fdfdf7ffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xfff8000000000000;
+  __m128i_out = __lsx_vsrlni_d_q (__m128i_op0, __m128i_op1, 0xd);
+  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_vsrlni_h_w (__m128i_op0, __m128i_op1, 0x16);
+  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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsrlni_h_w (__m128i_op0, __m128i_op1, 0xc);
+  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]) = 0x0000000455555555;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000008;
+  __m128i_out = __lsx_vsrlni_d_q (__m128i_op0, __m128i_op1, 0x1f);
+  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_vsrlni_w_d (__m128i_op0, __m128i_op1, 0x1f);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7c7c000000007176;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000000f3040705;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000001f1f;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlni_d_q (__m128i_op0, __m128i_op1, 0x32);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000000000bffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000040001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlni_d_q (__m128i_op0, __m128i_op1, 0x6d);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xe4c8b96e2560afe9;
+  *((unsigned long *)&__m128i_op0[0]) = 0xc001a1867fffa207;
+  *((unsigned long *)&__m128i_op1[1]) = 0xe4c8b96e2560afe9;
+  *((unsigned long *)&__m128i_op1[0]) = 0xc001a1867fffa207;
+  *((unsigned long *)&__m128i_result[1]) = 0xe2560afe9c001a18;
+  *((unsigned long *)&__m128i_result[0]) = 0xe2560afe9c001a18;
+  __m128i_out = __lsx_vsrlni_d_q (__m128i_op0, __m128i_op1, 0x24);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000000042ab41;
+  *((unsigned long *)&__m128i_op0[0]) = 0xb1b1b1b1b16f0670;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000000084d12ce;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000044470000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000202020200;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000100;
+  __m128i_out = __lsx_vsrlni_b_h (__m128i_op0, __m128i_op1, 0xe);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x020310edc003023d;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000080c43b700;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlni_d_q (__m128i_op0, __m128i_op1, 0x56);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x30eb022002101b20;
+  *((unsigned long *)&__m128i_op0[0]) = 0x020310edc003023d;
+  *((unsigned long *)&__m128i_op1[1]) = 0x30eb022002101b20;
+  *((unsigned long *)&__m128i_op1[0]) = 0x020310edc003023d;
+  *((unsigned long *)&__m128i_result[1]) = 0x022002101b200203;
+  *((unsigned long *)&__m128i_result[0]) = 0x022002101b200203;
+  __m128i_out = __lsx_vsrlni_d_q (__m128i_op0, __m128i_op1, 0x30);
+  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_vsrlni_b_h (__m128i_op0, __m128i_op1, 0x6);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlr.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlr.c
new file mode 100644
index 00000000000..211339bb86a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlr.c
@@ -0,0 +1,434 @@ 
+/* { 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]) = 0x0000000000000002;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlr_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]) = 0x43e092728266beba;
+  *((unsigned long *)&__m128i_op1[0]) = 0x43d8969cc4afbf2d;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlr_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_vsrlr_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_vsrlr_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_vsrlr_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7f8000007f800000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7f8000007f800000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x7fffffff7fffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x7f8000007f800000;
+  __m128i_out = __lsx_vsrlr_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_vsrlr_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]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfffc001fffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffff8000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0010000200020002;
+  __m128i_out = __lsx_vsrlr_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_vsrlr_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_vsrlr_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_vsrlr_b (__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]) = 0xfffffff0ffe04000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000200010;
+  __m128i_out = __lsx_vsrlr_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]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0001000101fd01fe;
+  *((unsigned long *)&__m128i_result[1]) = 0xff80ff80ff80ff80;
+  *((unsigned long *)&__m128i_result[0]) = 0xff80ff8080008000;
+  __m128i_out = __lsx_vsrlr_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xf51cf8dad6040188;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0982e2daf234ed87;
+  *((unsigned long *)&__m128i_op1[1]) = 0xfffffffff51cf8da;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffd6040188;
+  *((unsigned long *)&__m128i_result[1]) = 0x00020002000d0000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000020f2300ee;
+  __m128i_out = __lsx_vsrlr_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00007f8000007f80;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00007f8000007f80;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffe5;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffe5;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000000003fc;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000000003fc;
+  __m128i_out = __lsx_vsrlr_d (__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]) = 0x0000000000000006;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000100000000;
+  __m128i_out = __lsx_vsrlr_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]) = 0x000a000a000a000a;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000a000a000a000a;
+  *((unsigned long *)&__m128i_result[1]) = 0x0040000000400000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0040000000400000;
+  __m128i_out = __lsx_vsrlr_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0020808100000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x7fffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlr_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffe218ffffea10;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffff208fffffa02;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffe218ffffea10;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffff208fffffa02;
+  __m128i_out = __lsx_vsrlr_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_vsrlr_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlr_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x111110ff11111141;
+  *((unsigned long *)&__m128i_op0[0]) = 0x1111113111111121;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000000000000f00f;
+  *((unsigned long *)&__m128i_result[1]) = 0x111110ff11111141;
+  *((unsigned long *)&__m128i_result[0]) = 0x1111113111111100;
+  __m128i_out = __lsx_vsrlr_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]) = 0x1f54e0ab00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlr_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_vsrlr_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffff0000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x000000003fbf3fbf;
+  *((unsigned long *)&__m128i_op1[0]) = 0x7fff7fff7fff7ff8;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffff00000002;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000200000100;
+  __m128i_out = __lsx_vsrlr_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00d3007c014e00bd;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000200020002;
+  *((unsigned long *)&__m128i_result[0]) = 0x06e1000e00030005;
+  __m128i_out = __lsx_vsrlr_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0202020202020202;
+  *((unsigned long *)&__m128i_op0[0]) = 0x363d753d50155c0a;
+  *((unsigned long *)&__m128i_op1[1]) = 0xe500c085c000c005;
+  *((unsigned long *)&__m128i_op1[0]) = 0xe5c1a185c48004c5;
+  *((unsigned long *)&__m128i_result[1]) = 0x0002020002020200;
+  *((unsigned long *)&__m128i_result[0]) = 0x021f3b0205150600;
+  __m128i_out = __lsx_vsrlr_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffe000ffdf;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000200000002000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffe000ffdf;
+  __m128i_out = __lsx_vsrlr_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffff0000ffff0000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffff000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffe080f6efc100f7;
+  *((unsigned long *)&__m128i_op1[0]) = 0xefd32176ffe100f7;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000040000000200;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000040000000000;
+  __m128i_out = __lsx_vsrlr_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_vsrlr_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]) = 0x00000001fffdfe01;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfffdfe0200000002;
+  *((unsigned long *)&__m128i_result[1]) = 0x8000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x4000000000000000;
+  __m128i_out = __lsx_vsrlr_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xd70b30c96ea9f4e8;
+  *((unsigned long *)&__m128i_op0[0]) = 0xa352bfac9269e0aa;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xd70b30c96ea9f4e8;
+  *((unsigned long *)&__m128i_result[0]) = 0xa352bfac9269e0aa;
+  __m128i_out = __lsx_vsrlr_w (__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_vsrlr_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000158;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000158;
+  __m128i_out = __lsx_vsrlr_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_vsrlr_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_vsrlr_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_vsrlr_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00009c7c00007176;
+  *((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_vsrlr_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000001fffeff98;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0014ffe4ff76ffc4;
+  *((unsigned long *)&__m128i_op1[1]) = 0x9c9c9c9c9c9c9c9c;
+  *((unsigned long *)&__m128i_op1[0]) = 0x9c9c9c9c9c9c9c9c;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000010;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000010;
+  __m128i_out = __lsx_vsrlr_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_vsrlr_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x4399d3221a29d3f2;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x4399d3221a29d3f2;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x084d1a0907151a3d;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlr_b (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfff9fffefff9ffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0280000000000000;
+  __m128i_out = __lsx_vsrlr_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0700f8ff0700f8ff;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0700f8ff0700f8ff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlr_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x3a8000003a800000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3bc000003a800000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000f50000000900;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000090a00000998;
+  *((unsigned long *)&__m128i_result[1]) = 0x3a8000003a800000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000ef0000000003b;
+  __m128i_out = __lsx_vsrlr_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0005847b00011005;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0005847b00000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000807bf0a1f80;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000800ecedee68;
+  *((unsigned long *)&__m128i_result[1]) = 0x0005840100000005;
+  *((unsigned long *)&__m128i_result[0]) = 0x0005847b00000000;
+  __m128i_out = __lsx_vsrlr_b (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00c2758000bccf42;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00a975be00accf03;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00250023001c001d;
+  *((unsigned long *)&__m128i_op1[0]) = 0x309d2f342a5d2b34;
+  *((unsigned long *)&__m128i_result[1]) = 0x00060eb000000006;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000075c00000cf0;
+  __m128i_out = __lsx_vsrlr_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlri.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlri.c
new file mode 100644
index 00000000000..2c3a5341645
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlri.c
@@ -0,0 +1,300 @@ 
+/* { 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]) = 0x0000ffff00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000800000000000;
+  __m128i_out = __lsx_vsrlri_w (__m128i_op0, 0x1);
+  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_vsrlri_w (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_w (__m128i_op0, 0x13);
+  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_vsrlri_w (__m128i_op0, 0x1c);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x52527d7d52527d7d;
+  *((unsigned long *)&__m128i_op0[0]) = 0x52527d7d52527d7d;
+  *((unsigned long *)&__m128i_result[1]) = 0x0005252800052528;
+  *((unsigned long *)&__m128i_result[0]) = 0x0005252800052528;
+  __m128i_out = __lsx_vsrlri_w (__m128i_op0, 0xc);
+  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_vsrlri_d (__m128i_op0, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0200020002000200;
+  *((unsigned long *)&__m128i_result[0]) = 0x0200020002000200;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffc001fffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000200000;
+  *((unsigned long *)&__m128i_result[0]) = 0x001fff8004000000;
+  __m128i_out = __lsx_vsrlri_d (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_w (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0010001000030000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00060001fffe8003;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000200010;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000078c00000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000078c00000;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffff00000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x4000400000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000040004000;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x001800390049ffaa;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0029ff96005cff88;
+  *((unsigned long *)&__m128i_result[1]) = 0x001800390049ffaa;
+  *((unsigned long *)&__m128i_result[0]) = 0x0029ff96005cff88;
+  __m128i_out = __lsx_vsrlri_b (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0xf);
+  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_vsrlri_b (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00007fff00007fff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000800000008;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0xc);
+  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_vsrlri_d (__m128i_op0, 0x28);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x03c0000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x03c0038000000380;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0xf);
+  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_vsrlri_d (__m128i_op0, 0x25);
+  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_vsrlri_w (__m128i_op0, 0x1a);
+  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_vsrlri_d (__m128i_op0, 0x28);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xa2a2a2a3a2a2a2a3;
+  *((unsigned long *)&__m128i_op0[0]) = 0xc605c000aedd0000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000005151515;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000006302e00;
+  __m128i_out = __lsx_vsrlri_d (__m128i_op0, 0x25);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x2000200000013fa0;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000013fa0;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000001000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_w (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_b (__m128i_op0, 0x6);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffff00;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffff00;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000020000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000020000000;
+  __m128i_out = __lsx_vsrlri_d (__m128i_op0, 0x23);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x370bdfecffecffec;
+  *((unsigned long *)&__m128i_op0[0]) = 0x370bdfecffecffec;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000dc300003ffb;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000dc300003ffb;
+  __m128i_out = __lsx_vsrlri_w (__m128i_op0, 0x12);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x8080808000000035;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0002000200000000;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0xe);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x6363636363636363;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00018d8e00018d8e;
+  __m128i_out = __lsx_vsrlri_w (__m128i_op0, 0xe);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7f801fe000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3fc03fc000000004;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000003fc00ff00;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000001fe01fe00;
+  __m128i_out = __lsx_vsrlri_d (__m128i_op0, 0x1d);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0002000200020002;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0002000200020002;
+  *((unsigned long *)&__m128i_result[1]) = 0x0002000200020002;
+  *((unsigned long *)&__m128i_result[0]) = 0x0002000200020002;
+  __m128i_out = __lsx_vsrlri_b (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x8000800080008000;
+  *((unsigned long *)&__m128i_result[0]) = 0x8000800080008000;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000158;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_d (__m128i_op0, 0xc);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x045340a628404044;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_w (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_w (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000003ddc5dac;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000001030103;
+  __m128i_out = __lsx_vsrlri_b (__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]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlri_h (__m128i_op0, 0xf);
+  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_vsrlri_h (__m128i_op0, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x86dd8341b164f12b;
+  *((unsigned long *)&__m128i_op0[0]) = 0x9611c3985b3159f5;
+  *((unsigned long *)&__m128i_result[1]) = 0x0021b761002c593c;
+  *((unsigned long *)&__m128i_result[0]) = 0x002584710016cc56;
+  __m128i_out = __lsx_vsrlri_w (__m128i_op0, 0xa);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xc0b4d1a5f8babad3;
+  *((unsigned long *)&__m128i_op0[0]) = 0xbbc8ecc5f3ced5f3;
+  *((unsigned long *)&__m128i_result[1]) = 0xc0b4d1a5f8babad3;
+  *((unsigned long *)&__m128i_result[0]) = 0xbbc8ecc5f3ced5f3;
+  __m128i_out = __lsx_vsrlri_d (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000feff23560000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000fd1654860000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000080801030000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000080103040000;
+  __m128i_out = __lsx_vsrlri_b (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlrn.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlrn.c
new file mode 100644
index 00000000000..c630b426112
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlrn.c
@@ -0,0 +1,164 @@ 
+/* { 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_vsrlrn_b_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_vsrlrn_h_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]) = 0x0001ffff00000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0001ffff0001ffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrn_b_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000000efffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vsrlrn_w_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000040400000383;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffe000ffff1fff;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000383ffff1fff;
+  __m128i_out = __lsx_vsrlrn_w_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_vsrlrn_h_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000000003fc;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000000003fc;
+  *((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_vsrlrn_b_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]) = 0x7fffffff00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrn_w_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]) = 0xffffffffffffff00;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffff00;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrn_b_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_vsrlrn_h_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x002affd600000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0xcbc2723a4f12a5f8;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffd60001723aa5f8;
+  __m128i_out = __lsx_vsrlrn_h_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffe000ffffe000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x467f6080467d607f;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x8080808080808081;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xe000e0006080b040;
+  __m128i_out = __lsx_vsrlrn_h_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_vsrlrn_w_d (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0101010101030101;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0101010101030101;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000000fffa0000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000000fffa0000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0101000101010001;
+  __m128i_out = __lsx_vsrlrn_b_h (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xff80ffffffffff80;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000ff80ffffffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0x6a5d5b056f2f4978;
+  *((unsigned long *)&__m128i_op1[0]) = 0x17483c07141b5971;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0800010001ff8000;
+  __m128i_out = __lsx_vsrlrn_h_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]) = 0xff01ff01ac025c87;
+  *((unsigned long *)&__m128i_op1[0]) = 0xff01ff01ac465ca1;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrn_h_w (__m128i_op0, __m128i_op1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlrni.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlrni.c
new file mode 100644
index 00000000000..468a17c1520
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsrlrni.c
@@ -0,0 +1,686 @@ 
+/* { 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]) = 0xffffffff00000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffff8969ffffd7e2;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000d688ffffbd95;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xf12dfafc1ad1f7b3;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x4000000000000000;
+  *((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_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x34);
+  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_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x9);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000002000000020;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000200000002000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000200000002000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000010000000100;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x25);
+  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]) = 0x0000000001000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x2f);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000c0002000c0002;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000400c600700153;
+  *((unsigned long *)&__m128i_op1[1]) = 0x000c0002000c0002;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000400c600700153;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x000000010000007f;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000000000000fffe;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0800000400000800;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000001515151500;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000001515151500;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001515000015150;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000fdfd0404;
+  *((unsigned long *)&__m128i_op1[1]) = 0x3fffffff3fffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0x3fffffff3fffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000000000fc08;
+  *((unsigned long *)&__m128i_result[0]) = 0x8000800080008000;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000000000fc08;
+  *((unsigned long *)&__m128i_op0[0]) = 0x8000800080008000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffba420000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x000007e044000400;
+  *((unsigned long *)&__m128i_result[0]) = 0xfdd2100000000000;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x25);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000081e003f3f3f;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3f3f3f0e00000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000081e003f3f3f;
+  *((unsigned long *)&__m128i_op1[0]) = 0x3f3f3f0e00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000103c007e7e8;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000103c007e7e8;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x43);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0202022302023212;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0202ff3f02022212;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000002100003010;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000ff3f00002010;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x79);
+  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]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x8);
+  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_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x1a);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffff7fff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xe2bb5ff00e20aceb;
+  *((unsigned long *)&__m128i_op1[0]) = 0xe2bb5ff00e20aceb;
+  *((unsigned long *)&__m128i_result[1]) = 0x0100010000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00e3000e00e3000e;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x18);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xf58df7841423142a;
+  *((unsigned long *)&__m128i_op1[0]) = 0x3f7477f8ff4e2152;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x3d3e0505101e4008;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0xa);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x2bd5d429e34a1efb;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfc0203fccbedbba7;
+  *((unsigned long *)&__m128i_op1[1]) = 0xc9f66947f077afd0;
+  *((unsigned long *)&__m128i_op1[0]) = 0x89fed7c07fdf5d00;
+  *((unsigned long *)&__m128i_result[1]) = 0x14f1a50ffe65f6de;
+  *((unsigned long *)&__m128i_result[0]) = 0xa3f83bd8e03fefaf;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x9);
+  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_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x6ed694e00e0355db;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000010600000106;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xe00e035606000001;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x8);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xe739e7ade77ae725;
+  *((unsigned long *)&__m128i_op0[0]) = 0xbb9013bd049bc9ec;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x56aca41400000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x7ade77ae3bd049bd;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000041400000;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0xc);
+  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_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x12);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x1010101010101010;
+  *((unsigned long *)&__m128i_op1[0]) = 0x1010101010101010;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x8081808180818081;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000000006ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0037f80000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x15);
+  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_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x9);
+  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_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x69);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0020202020202020;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0080808080c04040;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0101010101010101;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0101010001808080;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000202000008081;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001010100010101;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x28);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfff0000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0010000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00fff00000001000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x28);
+  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_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x6b);
+  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]) = 0x000000adf0000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000001e00;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0040000000400040;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000020002020;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x8080808080808102;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000001010102;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x001000100010000b;
+  *((unsigned long *)&__m128i_op0[0]) = 0x03fc03fc03fc03fc;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x04000400ff01ff01;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0xa);
+  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_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0xd);
+  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]) = 0x1010101010101010;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0xc);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000fff800000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000001ed68;
+  *((unsigned long *)&__m128i_op1[1]) = 0x1ff6a09e667f3bd8;
+  *((unsigned long *)&__m128i_op1[0]) = 0xfffffffffffffffe;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000007b5a;
+  *((unsigned long *)&__m128i_result[0]) = 0x999fcef600000000;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x2);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffe5c8000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op1[1]) = 0x91f80badc162a0c4;
+  *((unsigned long *)&__m128i_op1[0]) = 0x99d1ffff0101ff01;
+  *((unsigned long *)&__m128i_result[1]) = 0x00ff400000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x905d0b06cf0008f8;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3802f4fd025800f7;
+  *((unsigned long *)&__m128i_op1[1]) = 0xc8ff0bffff00ffae;
+  *((unsigned long *)&__m128i_op1[0]) = 0x91ff40fffff8ff50;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000200000000700;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000192000001240;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x33);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffff0ffd0ffd;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffff0ffc0001;
+  *((unsigned long *)&__m128i_op1[1]) = 0xbb7743ca4c78461f;
+  *((unsigned long *)&__m128i_op1[0]) = 0xd9743eb5fb4deb3a;
+  *((unsigned long *)&__m128i_result[1]) = 0x003fffffffc3ff44;
+  *((unsigned long *)&__m128i_result[0]) = 0x002eddd0f2931e12;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x4a);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xbb7743ca4c78461f;
+  *((unsigned long *)&__m128i_op0[0]) = 0xd9743eb5fb4deb3a;
+  *((unsigned long *)&__m128i_op1[1]) = 0x22445e1ad9c3e4f0;
+  *((unsigned long *)&__m128i_op1[0]) = 0x1b43e8a30a570a63;
+  *((unsigned long *)&__m128i_result[1]) = 0x743ca4c843eb5fb5;
+  *((unsigned long *)&__m128i_result[0]) = 0x45e1ad9c3e8a30a5;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x14);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0x1204900f62f72565;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x4901725600000000;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x4);
+  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_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x6a);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000400000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x12);
+  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]) = 0x0000000300000003;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x32);
+  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_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x19);
+  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]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x2);
+  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_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x8);
+  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]) = 0x3f3f3f7fbf3fffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x47);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000040804080;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000020100000000;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0xe);
+  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_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffe8ffff28fc;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffffffffffffa;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00007fff0000803e;
+  *((unsigned long *)&__m128i_op1[0]) = 0x00000006ffff81e1;
+  *((unsigned long *)&__m128i_result[1]) = 0x0ffffffe8ffff290;
+  *((unsigned long *)&__m128i_result[0]) = 0x000007fff0000804;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x44);
+  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]) = 0x000418200000008e;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000002100047;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x6363636363636362;
+  *((unsigned long *)&__m128i_op0[0]) = 0x6363636363636362;
+  *((unsigned long *)&__m128i_op1[1]) = 0x6363636363636362;
+  *((unsigned long *)&__m128i_op1[0]) = 0x6363636363636362;
+  *((unsigned long *)&__m128i_result[1]) = 0x0032003200320032;
+  *((unsigned long *)&__m128i_result[0]) = 0x0032003200320032;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x19);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffff01010102;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7ffdf87f0b0c7f7f;
+  *((unsigned long *)&__m128i_op1[1]) = 0xf6b3eb63f6b3f6b3;
+  *((unsigned long *)&__m128i_op1[0]) = 0x363953e42b56432e;
+  *((unsigned long *)&__m128i_result[1]) = 0x010000010080000b;
+  *((unsigned long *)&__m128i_result[0]) = 0x00f700f70036002b;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x18);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xed67d6c7ed67ed67;
+  *((unsigned long *)&__m128i_op1[0]) = 0x6c72a7c856ac865c;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000700000003;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x3d);
+  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_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x3);
+  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]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x8);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffff40ff83;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x1010101010101010;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0xc);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000003030103;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000003030103;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000006060;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000006060;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000002408beb26c8;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x000000000000706e;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000028c27;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000070;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x8);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x80000b0b80000b0b;
+  *((unsigned long *)&__m128i_op0[0]) = 0x8000101080001010;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffefefffffeff0;
+  *((unsigned long *)&__m128i_result[1]) = 0x0061006100020002;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000fe00fe;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000078087f08;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000078087f08;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000e0fc0000e0fc;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0x6);
+  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_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x17);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000ff0bff76;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff;
+  *((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_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x75);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x33);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000ff00ff0000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000ff00ffffff;
+  *((unsigned long *)&__m128i_op1[1]) = 0x8282828282828282;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000828282828282;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0008000800000008;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x1c);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00f7000000000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000000005150;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000000005150;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000000f7000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x24);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x41afddcb1c000000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xd09e1bd99a2c6eb1;
+  *((unsigned long *)&__m128i_op1[0]) = 0xe82f7c27bb0778af;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000040002;
+  *((unsigned long *)&__m128i_result[0]) = 0x000d000a000f000c;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x1c);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffff8000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffdff0;
+  *((unsigned long *)&__m128i_op1[1]) = 0x8000000080000000;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0144329880000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x007fffc0007ffff0;
+  *((unsigned long *)&__m128i_result[0]) = 0x004000004c400000;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x9);
+  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_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x17);
+  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]) = 0x0000001e0000001e;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffafff0fff9ff01;
+  *((unsigned long *)&__m128i_op1[1]) = 0x0000000200000002;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000200000002;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000d800cff8;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsrlrni_h_w (__m128i_op0, __m128i_op1, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_op1[1]) = 0x00000002000007d7;
+  *((unsigned long *)&__m128i_op1[0]) = 0x0000000300000ff1;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x000007d700000ff1;
+  __m128i_out = __lsx_vsrlrni_w_d (__m128i_op0, __m128i_op1, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xff800000ff800000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7fc000007fc00000;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffff00ffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffff00ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000ff8;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000001000;
+  __m128i_out = __lsx_vsrlrni_d_q (__m128i_op0, __m128i_op1, 0x74);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000f08;
+  *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000002;
+  *((unsigned long *)&__m128i_result[0]) = 0x2020202020202020;
+  __m128i_out = __lsx_vsrlrni_b_h (__m128i_op0, __m128i_op1, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}