[v4,11/23] LoongArch: Add tests for SX vector vexth/vextl/vldi/vneg/vsat instructions.

Message ID 20230913033522.5983-2-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-vexth-1.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vexth-2.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vextl-1.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vextl-2.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vldi.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vneg.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsat-1.c: New test.
	* gcc.target/loongarch/vector/lsx/lsx-vsat-2.c: New test.
---
 .../loongarch/vector/lsx/lsx-vexth-1.c        | 342 ++++++++++++++++++
 .../loongarch/vector/lsx/lsx-vexth-2.c        | 182 ++++++++++
 .../loongarch/vector/lsx/lsx-vextl-1.c        |  83 +++++
 .../loongarch/vector/lsx/lsx-vextl-2.c        |  83 +++++
 .../loongarch/vector/lsx/lsx-vldi.c           |  61 ++++
 .../loongarch/vector/lsx/lsx-vneg.c           | 321 ++++++++++++++++
 .../loongarch/vector/lsx/lsx-vsat-1.c         | 231 ++++++++++++
 .../loongarch/vector/lsx/lsx-vsat-2.c         | 272 ++++++++++++++
 8 files changed, 1575 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-2.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vextl-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vextl-2.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vldi.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vneg.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-2.c
  

Patch

diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-1.c
new file mode 100644
index 00000000000..f6390800d82
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-1.c
@@ -0,0 +1,342 @@ 
+/* { 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_vexth_h_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7fff000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x007fffff00000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000000f909;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_h_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000000ffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_h_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffff01ff01;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  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_vexth_h_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x1010111105050000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x4040000041410101;
+  *((unsigned long *)&__m128i_result[1]) = 0x0010001000110011;
+  *((unsigned long *)&__m128i_result[0]) = 0x0005000500000000;
+  __m128i_out = __lsx_vexth_h_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000000003e2;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000003ffe2;
+  __m128i_out = __lsx_vexth_h_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfffffffffffffffe;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffffffffffffe;
+  __m128i_out = __lsx_vexth_w_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x3ff0000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00003ff000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_w_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x03c0000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x03c0038000000380;
+  *((unsigned long *)&__m128i_result[1]) = 0x000003c000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_w_h (__m128i_op0);
+  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_vexth_w_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xb9fe3640e4eb1b18;
+  *((unsigned long *)&__m128i_op0[0]) = 0x800000005b4b1b18;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffb9fe00003640;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffe4eb00001b18;
+  __m128i_out = __lsx_vexth_w_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x370bdfec00130014;
+  *((unsigned long *)&__m128i_op0[0]) = 0x370bdfec00130014;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000370bffffdfec;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000001300000014;
+  __m128i_out = __lsx_vexth_w_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xe500c085c000c005;
+  *((unsigned long *)&__m128i_op0[0]) = 0xe5c1a185c48004c5;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffe500ffffc085;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffc000ffffc005;
+  __m128i_out = __lsx_vexth_w_h (__m128i_op0);
+  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_vexth_w_h (__m128i_op0);
+  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_vexth_w_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000010000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_d_w (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x5c9c9c9ce3636363;
+  *((unsigned long *)&__m128i_op0[0]) = 0x63635c9e63692363;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000005c9c9c9c;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffe3636363;
+  __m128i_out = __lsx_vexth_d_w (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x63b2ac27aa076aeb;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000063b2ac27;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffaa076aeb;
+  __m128i_out = __lsx_vexth_d_w (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x002a001a001a000b;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000002a001a;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000001a000b;
+  __m128i_out = __lsx_vexth_d_w (__m128i_op0);
+  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_vexth_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0028280000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x012927ffff272800;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0028280000000000;
+  __m128i_out = __lsx_vexth_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000ff000000ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000ff0000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000ff000000ff;
+  __m128i_out = __lsx_vexth_q_d (__m128i_op0);
+  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]) = 0x0000000000000005;
+  __m128i_out = __lsx_vexth_q_d (__m128i_op0);
+  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_vexth_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000020000020;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000020000020;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000020000020;
+  __m128i_out = __lsx_vexth_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000000fff0;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_q_d (__m128i_op0);
+  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]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfffffffffffffffc;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffffffffffffc;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffffffffffffc;
+  __m128i_out = __lsx_vexth_q_d (__m128i_op0);
+  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_vexth_q_d (__m128i_op0);
+  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_vexth_q_d (__m128i_op0);
+  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_vexth_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000080;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000080;
+  __m128i_out = __lsx_vexth_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x3a8000003a800000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000ef0000000003b;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x3a8000003a800000;
+  __m128i_out = __lsx_vexth_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-2.c
new file mode 100644
index 00000000000..6ab217e979e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-2.c
@@ -0,0 +1,182 @@ 
+/* { 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_vexth_hu_bu (__m128i_op0);
+  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]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_hu_bu (__m128i_op0);
+  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_vexth_hu_bu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x4f804f804f804f80;
+  *((unsigned long *)&__m128i_op0[0]) = 0x4f804f804f804f80;
+  *((unsigned long *)&__m128i_result[1]) = 0x004f0080004f0080;
+  *((unsigned long *)&__m128i_result[0]) = 0x004f0080004f0080;
+  __m128i_out = __lsx_vexth_hu_bu (__m128i_op0);
+  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_vexth_hu_bu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffff007f00000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffff007f00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00ff00ff0000007f;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_hu_bu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfffffffffffffffa;
+  *((unsigned long *)&__m128i_result[1]) = 0x00ff00ff00ff00ff;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ff00ff00ff00ff;
+  __m128i_out = __lsx_vexth_hu_bu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  int_out = __lsx_vpickve2gr_b (__m128i_op0, 0x5);
+  *((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_vexth_hu_bu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x007fffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x002cffacffacffab;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000007f00ff00ff;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ff00ff00ff00ff;
+  __m128i_out = __lsx_vexth_hu_bu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000082020201;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000820200000201;
+  __m128i_out = __lsx_vexth_wu_hu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0001000100010012;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000fec20704;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000100000012;
+  __m128i_out = __lsx_vexth_wu_hu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000ffffffff;
+  __m128i_out = __lsx_vexth_du_wu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7fffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_du_wu (__m128i_op0);
+  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_vexth_du_wu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000001000100;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_du_wu (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000001000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000100000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000001000001;
+  __m128i_out = __lsx_vexth_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000b5207f80;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000fff7fc01;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vexth_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0002000000020000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000001fc00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0002000000020000;
+  __m128i_out = __lsx_vexth_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000b4a00008808;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0808080800000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000b4a00008808;
+  __m128i_out = __lsx_vexth_qu_du (__m128i_op0);
+  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_vexth_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000400080003fff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000bc2000007e10;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000400080003fff;
+  __m128i_out = __lsx_vexth_qu_du (__m128i_op0);
+  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_vexth_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vextl-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vextl-1.c
new file mode 100644
index 00000000000..99854dbd85e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vextl-1.c
@@ -0,0 +1,83 @@ 
+/* { 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_vextl_q_d (__m128i_op0);
+  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_vextl_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000170014;
+  *((unsigned long *)&__m128i_op0[0]) = 0xff0cff78ff96ff14;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xff0cff78ff96ff14;
+  __m128i_out = __lsx_vextl_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffe500ffffc085;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffc000ffffc005;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffc000ffffc005;
+  __m128i_out = __lsx_vextl_q_d (__m128i_op0);
+  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_vextl_q_d (__m128i_op0);
+  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_vextl_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0001000101010001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001;
+  __m128i_out = __lsx_vextl_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000800000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000800000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000800000000000;
+  __m128i_out = __lsx_vextl_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x3131313131313131;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3131313131313131;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x3131313131313131;
+  __m128i_out = __lsx_vextl_q_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vextl-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vextl-2.c
new file mode 100644
index 00000000000..73bb530c9fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vextl-2.c
@@ -0,0 +1,83 @@ 
+/* { 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]) = 0x0000101fffff8b68;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000b6fffff8095;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000b6fffff8095;
+  __m128i_out = __lsx_vextl_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000104000800;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000104000800;
+  __m128i_out = __lsx_vextl_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000100010000fe7c;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000100010000fe01;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000100010000fe01;
+  __m128i_out = __lsx_vextl_qu_du (__m128i_op0);
+  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_vextl_qu_du (__m128i_op0);
+  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_vextl_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x67eb85afb2ebb000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xc8847ef6ed3f2000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xc8847ef6ed3f2000;
+  __m128i_out = __lsx_vextl_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x33f5c2d7d975d7fe;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vextl_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000d82;
+  *((unsigned long *)&__m128i_op0[0]) = 0x046a09ec009c0000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x046a09ec009c0000;
+  __m128i_out = __lsx_vextl_qu_du (__m128i_op0);
+  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_vextl_qu_du (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vldi.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vldi.c
new file mode 100644
index 00000000000..089500ea9ed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vldi.c
@@ -0,0 +1,61 @@ 
+/* { 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_result[1]) = 0x00a300a300a300a3;
+  *((unsigned long *)&__m128i_result[0]) = 0x00a300a300a300a3;
+  __m128i_out = __lsx_vldi (1187);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_result[1]) = 0xfffffffffffffe15;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffffffffffe15;
+  __m128i_out = __lsx_vldi (3605);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_result[1]) = 0xecececececececec;
+  *((unsigned long *)&__m128i_result[0]) = 0xecececececececec;
+  __m128i_out = __lsx_vldi (1004);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_result[1]) = 0x00ffff00ff00ff00;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ffff00ff00ff00;
+  __m128i_out = __lsx_vldi (-1686);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  unsigned_int_out = __lsx_vpickve2gr_hu (__m128i_op0, 0x3);
+  *((unsigned long *)&__m128i_result[1]) = 0x004d004d004d004d;
+  *((unsigned long *)&__m128i_result[0]) = 0x004d004d004d004d;
+  __m128i_out = __lsx_vldi (1101);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_result[1]) = 0x0a0000000a000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0a0000000a000000;
+  __m128i_out = __lsx_vldi (-3318);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_result[1]) = 0x00ffff00ff00ff00;
+  *((unsigned long *)&__m128i_result[0]) = 0x00ffff00ff00ff00;
+  __m128i_out = __lsx_vldi (-1686);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_result[1]) = 0x0a0000000a000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0a0000000a000000;
+  __m128i_out = __lsx_vldi (-3318);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vneg.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vneg.c
new file mode 100644
index 00000000000..9441ba50e35
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vneg.c
@@ -0,0 +1,321 @@ 
+/* { 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]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001;
+  __m128i_out = __lsx_vneg_d (__m128i_op0);
+  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_vneg_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffffeffffffff;
+  __m128i_out = __lsx_vneg_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000100000004;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffefffefffffffc;
+  __m128i_out = __lsx_vneg_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000ff000000ff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffff00ffffff01;
+  __m128i_out = __lsx_vneg_d (__m128i_op0);
+  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_vneg_w (__m128i_op0);
+  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_vneg_b (__m128i_op0);
+  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_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000000000d;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000000fff3;
+  __m128i_out = __lsx_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00ff00ff0000ffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00ff0001ffffff0a;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000100000101;
+  *((unsigned long *)&__m128i_result[0]) = 0x000100ff010101f6;
+  __m128i_out = __lsx_vneg_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101;
+  *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101;
+  __m128i_out = __lsx_vneg_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xff000000ff00ff00;
+  *((unsigned long *)&__m128i_op0[0]) = 0xff00ff0000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0100000001000100;
+  *((unsigned long *)&__m128i_result[0]) = 0x0100010000000000;
+  __m128i_out = __lsx_vneg_b (__m128i_op0);
+  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_vneg_w (__m128i_op0);
+  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_vneg_b (__m128i_op0);
+  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_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000000ff00;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000100;
+  __m128i_out = __lsx_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000101;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000fffffeff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vneg_w (__m128i_op0);
+  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_vneg_h (__m128i_op0);
+  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_vneg_b (__m128i_op0);
+  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_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfffffbff8888080a;
+  *((unsigned long *)&__m128i_op0[0]) = 0x080803ff807ff7f9;
+  *((unsigned long *)&__m128i_result[1]) = 0x010105017878f8f6;
+  *((unsigned long *)&__m128i_result[0]) = 0xf8f8fd0180810907;
+  __m128i_out = __lsx_vneg_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000080000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000080000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000080000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000080000000;
+  __m128i_out = __lsx_vneg_b (__m128i_op0);
+  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_vneg_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000300000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000100010001;
+  *((unsigned long *)&__m128i_result[1]) = 0xfffffffdffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffffffffeffff;
+  __m128i_out = __lsx_vneg_w (__m128i_op0);
+  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_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001;
+  __m128i_out = __lsx_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x441ba9fcffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x181b2541ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xbbe5560400010001;
+  *((unsigned long *)&__m128i_result[0]) = 0xe7e5dabf00010001;
+  __m128i_out = __lsx_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000000060a3db;
+  *((unsigned long *)&__m128i_op0[0]) = 0xa70594c000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000ff9f5c25;
+  *((unsigned long *)&__m128i_result[0]) = 0x58fa6b4000000000;
+  __m128i_out = __lsx_vneg_w (__m128i_op0);
+  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_vneg_b (__m128i_op0);
+  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_vneg_w (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00ff00ff00ff00ff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00ff00ff00ff00ff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001;
+  __m128i_out = __lsx_vneg_b (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000010000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffff0000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vneg_w (__m128i_op0);
+  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_vneg_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000000000001f;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000008000001e;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffe1;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffff7fffffe2;
+  __m128i_out = __lsx_vneg_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x67eb85afb2ebb000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xc8847ef6ed3f2000;
+  *((unsigned long *)&__m128i_result[1]) = 0x98147a504d145000;
+  *((unsigned long *)&__m128i_result[0]) = 0x377b810912c0e000;
+  __m128i_out = __lsx_vneg_d (__m128i_op0);
+  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_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffc00001ff800000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x003ffffe00800000;
+  __m128i_out = __lsx_vneg_d (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffff00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000100000000;
+  __m128i_out = __lsx_vneg_h (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000ffff0000ffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000ffff0000ffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001;
+  __m128i_out = __lsx_vneg_h (__m128i_op0);
+  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_vneg_d (__m128i_op0);
+  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_vneg_w (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x087c000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000000000000087c;
+  *((unsigned long *)&__m128i_result[1]) = 0xf784000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffffffffff784;
+  __m128i_out = __lsx_vneg_d (__m128i_op0);
+  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_vneg_w (__m128i_op0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-1.c
new file mode 100644
index 00000000000..cd8eefb470c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-1.c
@@ -0,0 +1,231 @@ 
+/* { 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_vsat_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_vsat_b (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0xc000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0xf000000000000000;
+  __m128i_out = __lsx_vsat_b (__m128i_op0, 0x4);
+  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_vsat_b (__m128i_op0, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7fff010181010102;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7fffffff81010102;
+  *((unsigned long *)&__m128i_result[1]) = 0x03ff0101fc010102;
+  *((unsigned long *)&__m128i_result[0]) = 0x03fffffffc010102;
+  __m128i_out = __lsx_vsat_b (__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_vsat_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_vsat_h (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000040400000383;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffff8383ffff7d0d;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000040400000383;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffe000ffff1fff;
+  __m128i_out = __lsx_vsat_h (__m128i_op0, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsat_h (__m128i_op0, 0x6);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xfffffffff8f8da00;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffff01018888;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffff00ff00;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffff00ffff00;
+  __m128i_out = __lsx_vsat_h (__m128i_op0, 0x8);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x3f8000003f800001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x3f8000003f800001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000000010001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000000010001;
+  __m128i_out = __lsx_vsat_h (__m128i_op0, 0x1);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000006f00001f0a;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000958affff995d;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000006f00001f0a;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000c000ffffc000;
+  __m128i_out = __lsx_vsat_h (__m128i_op0, 0xe);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000ffffffff;
+  __m128i_out = __lsx_vsat_h (__m128i_op0, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0038d800ff000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00fffe00fffffe00;
+  *((unsigned long *)&__m128i_result[1]) = 0x0038f000ff000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x00fffe00fffffe00;
+  __m128i_out = __lsx_vsat_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_vsat_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_vsat_h (__m128i_op0, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x7fff00007fff0000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x7fff00007fff0000;
+  *((unsigned long *)&__m128i_result[1]) = 0x003f0000003f0000;
+  *((unsigned long *)&__m128i_result[0]) = 0x003f0000003f0000;
+  __m128i_out = __lsx_vsat_h (__m128i_op0, 0x6);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0674c886fcba4e98;
+  *((unsigned long *)&__m128i_op0[0]) = 0xfdce8003090b0906;
+  *((unsigned long *)&__m128i_result[1]) = 0x003fffc0ffc0003f;
+  *((unsigned long *)&__m128i_result[0]) = 0xffc0ffc0003f003f;
+  __m128i_out = __lsx_vsat_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_vsat_h (__m128i_op0, 0x8);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x04e00060ffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x04e00060ffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x007fffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x007fffffffffffff;
+  __m128i_out = __lsx_vsat_w (__m128i_op0, 0x17);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000017f0a82;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000000003f;
+  __m128i_out = __lsx_vsat_w (__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_vsat_w (__m128i_op0, 0x1d);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  unsigned_int_out = __lsx_vpickve2gr_wu (__m128i_op0, 0x3);
+  *((unsigned long *)&__m128i_op0[1]) = 0x8006000080020000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x8004000080020000;
+  *((unsigned long *)&__m128i_result[1]) = 0xfffffff8fffffff8;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffff8fffffff8;
+  __m128i_out = __lsx_vsat_w (__m128i_op0, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsat_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]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff;
+  __m128i_out = __lsx_vsat_w (__m128i_op0, 0x10);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000008;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000008;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsat_w (__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_vsat_w (__m128i_op0, 0x11);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x6363636363636363;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffd27db010d20fbf;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000f0000000f;
+  *((unsigned long *)&__m128i_result[0]) = 0xfffffff00000000f;
+  __m128i_out = __lsx_vsat_w (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000003ff8;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000003ff8;
+  __m128i_out = __lsx_vsat_w (__m128i_op0, 0x11);
+  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_vsat_d (__m128i_op0, 0x35);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-2.c
new file mode 100644
index 00000000000..31e3919bf83
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-2.c
@@ -0,0 +1,272 @@ 
+/* { 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]) = 0xffff1739ffff48aa;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffff2896ffff5b88;
+  *((unsigned long *)&__m128i_result[1]) = 0x3f3f17393f3f3f3f;
+  *((unsigned long *)&__m128i_result[0]) = 0x3f3f283f3f3f3f3f;
+  __m128i_out = __lsx_vsat_bu (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0002000000020000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000001fc00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000000010000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000010100000000;
+  __m128i_out = __lsx_vsat_bu (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffcc000b000b000b;
+  *((unsigned long *)&__m128i_op0[0]) = 0x000b000b010a000b;
+  *((unsigned long *)&__m128i_result[1]) = 0x7f7f000b000b000b;
+  *((unsigned long *)&__m128i_result[0]) = 0x000b000b010a000b;
+  __m128i_out = __lsx_vsat_bu (__m128i_op0, 0x6);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000068;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000000001f;
+  __m128i_out = __lsx_vsat_bu (__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_vsat_bu (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffcd63ffffcd63;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffd765ffffd765;
+  *((unsigned long *)&__m128i_result[1]) = 0x1f1f1f1f1f1f1f1f;
+  *((unsigned long *)&__m128i_result[0]) = 0x1f1f1f1f1f1f1f1f;
+  __m128i_out = __lsx_vsat_bu (__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_vsat_bu (__m128i_op0, 0x4);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x000000120000000d;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000e0000000e;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001;
+  __m128i_out = __lsx_vsat_bu (__m128i_op0, 0x0);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xbf8000000000ffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xcf00000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x003f00000000003f;
+  *((unsigned long *)&__m128i_result[0]) = 0x003f000000000000;
+  __m128i_out = __lsx_vsat_hu (__m128i_op0, 0x5);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x00000000000007f8;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000000007f8;
+  *((unsigned long *)&__m128i_result[1]) = 0x00000000000000ff;
+  *((unsigned long *)&__m128i_result[0]) = 0x00000000000000ff;
+  __m128i_out = __lsx_vsat_hu (__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_vsat_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_vsat_hu (__m128i_op0, 0xa);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000006de1;
+  *((unsigned long *)&__m128i_op0[0]) = 0x5f9ccf33cf600000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000007;
+  *((unsigned long *)&__m128i_result[0]) = 0x0007000700070000;
+  __m128i_out = __lsx_vsat_hu (__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_vsat_wu (__m128i_op0, 0xb);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x00000000fff7fc01;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000000000f;
+  __m128i_out = __lsx_vsat_wu (__m128i_op0, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsat_wu (__m128i_op0, 0x1d);
+  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_vsat_wu (__m128i_op0, 0x14);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000003;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000003;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsat_wu (__m128i_op0, 0x3);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000bd3d00000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000bd3d00000000;
+  __m128i_out = __lsx_vsat_wu (__m128i_op0, 0x19);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsat_wu (__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_vsat_wu (__m128i_op0, 0x9);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0007000000050000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0003000000010000;
+  *((unsigned long *)&__m128i_result[1]) = 0x00003fff00003fff;
+  *((unsigned long *)&__m128i_result[0]) = 0x00003fff00003fff;
+  __m128i_out = __lsx_vsat_wu (__m128i_op0, 0xd);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x001a323b5430048c;
+  *((unsigned long *)&__m128i_op0[0]) = 0x008f792cab1cb915;
+  *((unsigned long *)&__m128i_result[1]) = 0x001a323b00ffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x008f792c00ffffff;
+  __m128i_out = __lsx_vsat_wu (__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_vsat_wu (__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_vsat_du (__m128i_op0, 0x20);
+  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_vsat_du (__m128i_op0, 0x25);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_result[1]) = 0x7fffffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x7fffffffffffffff;
+  __m128i_out = __lsx_vsat_du (__m128i_op0, 0x3e);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x6363636389038903;
+  *((unsigned long *)&__m128i_op0[0]) = 0x6363636389038903;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000000001ffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x000000000001ffff;
+  __m128i_out = __lsx_vsat_du (__m128i_op0, 0x10);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsat_du (__m128i_op0, 0x22);
+  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_vsat_du (__m128i_op0, 0x36);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000001fffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsat_du (__m128i_op0, 0x1c);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000;
+  __m128i_out = __lsx_vsat_du (__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_vsat_du (__m128i_op0, 0x7);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0001000101010001;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0001000100010001;
+  *((unsigned long *)&__m128i_result[1]) = 0x0001000101010001;
+  *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001;
+  __m128i_out = __lsx_vsat_du (__m128i_op0, 0x34);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0x0000000202020200;
+  *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000100;
+  *((unsigned long *)&__m128i_result[1]) = 0x000000001fffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000000000000100;
+  __m128i_out = __lsx_vsat_du (__m128i_op0, 0x1c);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  *((unsigned long *)&__m128i_op0[1]) = 0xa8a74bff9e9e0070;
+  *((unsigned long *)&__m128i_op0[0]) = 0x9e9e72ff9e9ff9ff;
+  *((unsigned long *)&__m128i_result[1]) = 0x0000ffffffffffff;
+  *((unsigned long *)&__m128i_result[0]) = 0x0000ffffffffffff;
+  __m128i_out = __lsx_vsat_du (__m128i_op0, 0x2f);
+  ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+  return 0;
+}