代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gcc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 4ccb21b6d2d23046c6a71c4540a1eb288609f041 Mon Sep 17 00:00:00 2001
From: Xiaolong Chen <[email protected]>
Date: Tue, 12 Sep 2023 11:25:20 +0800
Subject: [PATCH 093/124] LoongArch: Add tests for SX vector floating point
arithmetic instructions.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/vector/lsx/lsx-vfadd_d.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vfadd_s.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vfclass_d.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vfclass_s.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vflogb_d.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vflogb_s.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vfmax_d.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vfmax_s.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vfmaxa_d.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vfmaxa_s.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vfsqrt_d.c: New test.
* gcc.target/loongarch/vector/lsx/lsx-vfsqrt_s.c: New test.
Signed-off-by: Peng Fan <[email protected]>
Signed-off-by: ticat_fp <[email protected]>
---
.../loongarch/vector/lsx/lsx-vfadd_d.c | 407 +++++++++++++++
.../loongarch/vector/lsx/lsx-vfadd_s.c | 470 ++++++++++++++++++
.../loongarch/vector/lsx/lsx-vfclass_d.c | 83 ++++
.../loongarch/vector/lsx/lsx-vfclass_s.c | 74 +++
.../loongarch/vector/lsx/lsx-vflogb_d.c | 76 +++
.../loongarch/vector/lsx/lsx-vflogb_s.c | 185 +++++++
.../loongarch/vector/lsx/lsx-vfmax_d.c | 200 ++++++++
.../loongarch/vector/lsx/lsx-vfmax_s.c | 335 +++++++++++++
.../loongarch/vector/lsx/lsx-vfmaxa_d.c | 155 ++++++
.../loongarch/vector/lsx/lsx-vfmaxa_s.c | 230 +++++++++
.../loongarch/vector/lsx/lsx-vfsqrt_d.c | 216 ++++++++
.../loongarch/vector/lsx/lsx-vfsqrt_s.c | 372 ++++++++++++++
12 files changed, 2803 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfadd_d.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfadd_s.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfclass_d.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfclass_s.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vflogb_d.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vflogb_s.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmax_d.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmax_s.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmaxa_d.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmaxa_s.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfsqrt_d.c
create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfsqrt_s.c
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfadd_d.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfadd_d.c
new file mode 100644
index 000000000..7ffbd385e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfadd_d.c
@@ -0,0 +1,407 @@
+/* { dg-do run } */
+/* { dg-options "-mlsx -w -fno-strict-aliasing" } */
+#include "../simd_correctness_check.h"
+#include <lsxintrin.h>
+
+int
+main ()
+{
+ __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result;
+ __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result;
+ __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result;
+
+ int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail;
+ long int long_op0, long_op1, long_op2, lont_out, lont_result;
+ long int long_int_out, long_int_result;
+ unsigned int unsigned_int_out, unsigned_int_result;
+ unsigned long int unsigned_long_int_out, unsigned_long_int_result;
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x00000000fea8ff44;
+ *((unsigned long *)&__m128d_op1[1]) = 0x2020202020202020;
+ *((unsigned long *)&__m128d_op1[0]) = 0x2020202020202020;
+ *((unsigned long *)&__m128d_result[1]) = 0x2020202020202020;
+ *((unsigned long *)&__m128d_result[0]) = 0x2020202020202020;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x1000100010001000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x1000100010001000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x1000100010001000;
+ *((unsigned long *)&__m128d_result[0]) = 0x1000100010001000;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x000000000000000f;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x000000000000000f;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000010100fe0101;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffff0200ffff01ff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000ffffffffffff;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000ffffffffffff;
+ *((unsigned long *)&__m128d_result[1]) = 0x0001010100fe0100;
+ *((unsigned long *)&__m128d_result[0]) = 0xffff0200ffff01ff;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x7fff0101ffffe000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x7fffffffa0204000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x7f370101ff04ffff;
+ *((unsigned long *)&__m128d_op1[0]) = 0x7f3bffffa0226021;
+ *((unsigned long *)&__m128d_result[1]) = 0x7fff0101ffffe000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7fffffffa0204000;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000ebd20000714f;
+ *((unsigned long *)&__m128d_op0[0]) = 0x00012c8a0000a58a;
+ *((unsigned long *)&__m128d_op1[1]) = 0xf654ad7447e59090;
+ *((unsigned long *)&__m128d_op1[0]) = 0x27b1b106b8145f50;
+ *((unsigned long *)&__m128d_result[1]) = 0xf654ad7447e59090;
+ *((unsigned long *)&__m128d_result[0]) = 0x27b1b106b8145f50;
+ __m128d_out = __lsx_vfadd_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmul_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmul_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000001300000013;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000001300000013;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmul_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000100000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x1000100000001000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000100000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x1000100000001000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmul_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0010001000100010;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0010001000100010;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmul_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmul_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000007000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmul_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x01533b5e7489ae24;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffab7e71e33848;
+ *((unsigned long *)&__m128d_op1[1]) = 0x01533b5e7489ae24;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffffab7e71e33848;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffab7e71e33848;
+ __m128d_out = __lsx_vfmul_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmul_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x000000ff000000ff;
+ *((unsigned long *)&__m128d_op1[0]) = 0x000000ff000000ff;
+ *((unsigned long *)&__m128d_result[1]) = 0x800000ff000000ff;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x00000000fff8fff8;
+ *((unsigned long *)&__m128d_op1[0]) = 0x00000000fff80000;
+ *((unsigned long *)&__m128d_result[1]) = 0x80000000fff8fff8;
+ *((unsigned long *)&__m128d_result[0]) = 0x80000000fff80000;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x00000001fffffffe;
+ *((unsigned long *)&__m128d_op0[0]) = 0x00000001fffffffe;
+ *((unsigned long *)&__m128d_op1[1]) = 0xb55ccf30f52a6a68;
+ *((unsigned long *)&__m128d_op1[0]) = 0x4e0018eceb82c53a;
+ *((unsigned long *)&__m128d_result[1]) = 0x355ccf30f52a6a68;
+ *((unsigned long *)&__m128d_result[0]) = 0xce0018eceb82c53a;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffff00006c82;
+ *((unsigned long *)&__m128d_op0[0]) = 0x00009b140000917b;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffff00006c82;
+ *((unsigned long *)&__m128d_result[0]) = 0x00009b140000917b;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000100000020;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000083b00000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xe93d0bd19ff0c170;
+ *((unsigned long *)&__m128d_op0[0]) = 0x5237c1bac9eadf55;
+ *((unsigned long *)&__m128d_op1[1]) = 0xe6d4572c8a5835bc;
+ *((unsigned long *)&__m128d_op1[0]) = 0xe5017c2ac9ca9fd0;
+ *((unsigned long *)&__m128d_result[1]) = 0xe93d0bd19ff07013;
+ *((unsigned long *)&__m128d_result[0]) = 0x65017c2ac9ca9fd0;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xe93d0bd19ff07013;
+ *((unsigned long *)&__m128d_op0[0]) = 0x65017c2ac9ca9fd0;
+ *((unsigned long *)&__m128d_op1[1]) = 0x00008bf700017052;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000f841000091aa;
+ *((unsigned long *)&__m128d_result[1]) = 0xe93d0bd19ff07013;
+ *((unsigned long *)&__m128d_result[0]) = 0x65017c2ac9ca9fd0;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x00000001ca02f854;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x00000001ca02f854;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000004000000002;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x5555410154551515;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0004455501500540;
+ *((unsigned long *)&__m128d_result[1]) = 0xd555410154551515;
+ *((unsigned long *)&__m128d_result[0]) = 0x8004455501500540;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000005;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x000300037ff000ff;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0003000300a10003;
+ *((unsigned long *)&__m128d_op1[1]) = 0x000000007ff000ff;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0003000300000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0003000300a10003;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x56a09e662ab46b31;
+ *((unsigned long *)&__m128d_op1[0]) = 0xb4b8122ef4054bb3;
+ *((unsigned long *)&__m128d_result[1]) = 0xd6a09e662ab46b31;
+ *((unsigned long *)&__m128d_result[0]) = 0x34b8122ef4054bb3;
+ __m128d_out = __lsx_vfsub_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff8000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x7f4000007f040000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x7f0200007f020000;
+ *((unsigned long *)&__m128d_op1[1]) = 0xfffffffff8f8dada;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffffffff01018888;
+ *((unsigned long *)&__m128d_result[1]) = 0xfffffffff8f8dada;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffff01018888;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x8000000080000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x8000000080000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000100007f01;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff8000000000000;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffefefffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000020;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0400000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffefefffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff8000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff8000000000000;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x00000000ff801c9e;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000810000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x000000000000ffff;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x40eff02383e383e4;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff0000000000000;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0xc8847ef6ed3f2000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0001000000010000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000cd630000cd63;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffff00000000ffff;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xffff00000000ffff;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x000aa822a79308f6;
+ *((unsigned long *)&__m128d_op1[0]) = 0x03aa558e1d37b5a1;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xfffffffefffffffe;
+ *((unsigned long *)&__m128d_op0[0]) = 0xfffffffefffffffe;
+ *((unsigned long *)&__m128d_op1[1]) = 0xfffefffefffefffe;
+ *((unsigned long *)&__m128d_op1[0]) = 0xfffefffe011df03e;
+ *((unsigned long *)&__m128d_result[1]) = 0xfffffffefffffffe;
+ *((unsigned long *)&__m128d_result[0]) = 0xfffffffefffffffe;
+ __m128d_out = __lsx_vfdiv_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfadd_s.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfadd_s.c
new file mode 100644
index 000000000..388430278
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfadd_s.c
@@ -0,0 +1,470 @@
+/* { 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;
+
+ *((int *)&__m128_op0[3]) = 0x05050505;
+ *((int *)&__m128_op0[2]) = 0x05050505;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x05050000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x03574e38;
+ *((int *)&__m128_op1[0]) = 0xe496cbc9;
+ *((int *)&__m128_result[3]) = 0x05050505;
+ *((int *)&__m128_result[2]) = 0x05050505;
+ *((int *)&__m128_result[1]) = 0x03574e38;
+ *((int *)&__m128_result[0]) = 0xe496cbc9;
+ __m128_out = __lsx_vfadd_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfadd_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfadd_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x0000000f;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00077f88;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00077f97;
+ __m128_out = __lsx_vfadd_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x000000ff;
+ *((int *)&__m128_op0[0]) = 0x000000ff;
+ *((int *)&__m128_op1[3]) = 0x370bdfec;
+ *((int *)&__m128_op1[2]) = 0xffecffec;
+ *((int *)&__m128_op1[1]) = 0x370bdfec;
+ *((int *)&__m128_op1[0]) = 0xffecffec;
+ *((int *)&__m128_result[3]) = 0x370bdfec;
+ *((int *)&__m128_result[2]) = 0xffecffec;
+ *((int *)&__m128_result[1]) = 0x370bdfec;
+ *((int *)&__m128_result[0]) = 0xffecffec;
+ __m128_out = __lsx_vfadd_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffffffff;
+ *((int *)&__m128_op0[2]) = 0xffffffff;
+ *((int *)&__m128_op0[1]) = 0xffffffff;
+ *((int *)&__m128_op0[0]) = 0xffffffff;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x0000ff00;
+ *((int *)&__m128_op1[0]) = 0x00ff0000;
+ *((int *)&__m128_result[3]) = 0xffffffff;
+ *((int *)&__m128_result[2]) = 0xffffffff;
+ *((int *)&__m128_result[1]) = 0xffffffff;
+ *((int *)&__m128_result[0]) = 0xffffffff;
+ __m128_out = __lsx_vfadd_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffff0000;
+ *((int *)&__m128_op0[2]) = 0xffff0000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x40088040;
+ *((int *)&__m128_op1[2]) = 0x80040110;
+ *((int *)&__m128_op1[1]) = 0x40408010;
+ *((int *)&__m128_op1[0]) = 0x80200110;
+ *((int *)&__m128_result[3]) = 0xffff0000;
+ *((int *)&__m128_result[2]) = 0xffff0000;
+ *((int *)&__m128_result[1]) = 0x40408010;
+ *((int *)&__m128_result[0]) = 0x80200110;
+ __m128_out = __lsx_vfadd_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0xffffffff;
+ *((int *)&__m128_op1[2]) = 0xfffffffc;
+ *((int *)&__m128_op1[1]) = 0xffffffff;
+ *((int *)&__m128_op1[0]) = 0xfffffffc;
+ *((int *)&__m128_result[3]) = 0xffffffff;
+ *((int *)&__m128_result[2]) = 0xfffffffc;
+ *((int *)&__m128_result[1]) = 0xffffffff;
+ *((int *)&__m128_result[0]) = 0xfffffffc;
+ __m128_out = __lsx_vfadd_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x0000001b;
+ *((int *)&__m128_op0[2]) = 0x0000001b;
+ *((int *)&__m128_op0[1]) = 0x0000001b;
+ *((int *)&__m128_op0[0]) = 0x0000001b;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x0000001b;
+ *((int *)&__m128_result[2]) = 0x0000001b;
+ *((int *)&__m128_result[1]) = 0x0000001b;
+ *((int *)&__m128_result[0]) = 0x0000001b;
+ __m128_out = __lsx_vfadd_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x56411278;
+ *((int *)&__m128_op0[2]) = 0x43c0d41e;
+ *((int *)&__m128_op0[1]) = 0x0124d8f6;
+ *((int *)&__m128_op0[0]) = 0xa494006b;
+ *((int *)&__m128_op1[3]) = 0xffffffff;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0xffffffff;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x80000000;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x05010501;
+ *((int *)&__m128_op1[2]) = 0x05010501;
+ *((int *)&__m128_op1[1]) = 0x05010501;
+ *((int *)&__m128_op1[0]) = 0x0501050c;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x21f32eaf;
+ *((int *)&__m128_op0[2]) = 0x5b7a02c8;
+ *((int *)&__m128_op0[1]) = 0x407c2ca3;
+ *((int *)&__m128_op0[0]) = 0x2cbd0357;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00010400;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xfffe0001;
+ *((int *)&__m128_op0[2]) = 0xfffe0001;
+ *((int *)&__m128_op0[1]) = 0xfffe0001;
+ *((int *)&__m128_op0[0]) = 0xfffe0001;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0xfffe0001;
+ *((int *)&__m128_result[2]) = 0xfffe0001;
+ *((int *)&__m128_result[1]) = 0xfffe0001;
+ *((int *)&__m128_result[0]) = 0xfffe0001;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00002ebf;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0xffffffff;
+ *((int *)&__m128_op1[0]) = 0xffffffff;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0xffffffff;
+ *((int *)&__m128_result[0]) = 0xffffffff;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x01000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00081f1f;
+ *((int *)&__m128_op0[2]) = 0x1f1f1f1f;
+ *((int *)&__m128_op0[1]) = 0x1f1f1f1f;
+ *((int *)&__m128_op0[0]) = 0x1f1f1f1f;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x021b7d24;
+ *((int *)&__m128_op0[2]) = 0x49678a35;
+ *((int *)&__m128_op0[1]) = 0x030298a6;
+ *((int *)&__m128_op0[0]) = 0x21030a49;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000002;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xf6548a17;
+ *((int *)&__m128_op0[2]) = 0x47e59090;
+ *((int *)&__m128_op0[1]) = 0x27b169bb;
+ *((int *)&__m128_op0[0]) = 0xb8145f50;
+ *((int *)&__m128_op1[3]) = 0x004eff62;
+ *((int *)&__m128_op1[2]) = 0x00d2ff76;
+ *((int *)&__m128_op1[1]) = 0xff700028;
+ *((int *)&__m128_op1[0]) = 0x00be00a0;
+ *((int *)&__m128_result[3]) = 0xb7032c34;
+ *((int *)&__m128_result[2]) = 0x093d35ab;
+ *((int *)&__m128_result[1]) = 0xe7a6533b;
+ *((int *)&__m128_result[0]) = 0x800001b8;
+ __m128_out = __lsx_vfmul_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfsub_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x7fff0101;
+ *((int *)&__m128_op0[2]) = 0x81010102;
+ *((int *)&__m128_op0[1]) = 0x7fffffff;
+ *((int *)&__m128_op0[0]) = 0x81010102;
+ *((int *)&__m128_op1[3]) = 0x00000fff;
+ *((int *)&__m128_op1[2]) = 0xffffe000;
+ *((int *)&__m128_op1[1]) = 0x00001020;
+ *((int *)&__m128_op1[0]) = 0x20204000;
+ *((int *)&__m128_result[3]) = 0x7fff0101;
+ *((int *)&__m128_result[2]) = 0xffffe000;
+ *((int *)&__m128_result[1]) = 0x7fffffff;
+ *((int *)&__m128_result[0]) = 0xa0204000;
+ __m128_out = __lsx_vfsub_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0xffffffff;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0xffffffff;
+ *((int *)&__m128_op1[3]) = 0x00000fff;
+ *((int *)&__m128_op1[2]) = 0xffffe000;
+ *((int *)&__m128_op1[1]) = 0x00001020;
+ *((int *)&__m128_op1[0]) = 0x20204000;
+ *((int *)&__m128_result[3]) = 0x80000fff;
+ *((int *)&__m128_result[2]) = 0xffffffff;
+ *((int *)&__m128_result[1]) = 0x80001020;
+ *((int *)&__m128_result[0]) = 0xffffffff;
+ __m128_out = __lsx_vfsub_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfsub_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x54feed87;
+ *((int *)&__m128_op0[2]) = 0xbc3f2be1;
+ *((int *)&__m128_op0[1]) = 0x8064d8f6;
+ *((int *)&__m128_op0[0]) = 0xa494afcb;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0xff800000;
+ __m128_out = __lsx_vfdiv_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0xd8248069;
+ *((int *)&__m128_op0[0]) = 0x7f678077;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0xd8248069;
+ *((int *)&__m128_op1[0]) = 0x7f678077;
+ *((int *)&__m128_result[3]) = 0x7fc00000;
+ *((int *)&__m128_result[2]) = 0x7fc00000;
+ *((int *)&__m128_result[1]) = 0x3f800000;
+ *((int *)&__m128_result[0]) = 0x3f800000;
+ __m128_out = __lsx_vfdiv_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7fc00000;
+ *((int *)&__m128_result[2]) = 0x7fc00000;
+ *((int *)&__m128_result[1]) = 0x7fc00000;
+ *((int *)&__m128_result[0]) = 0x7fc00000;
+ __m128_out = __lsx_vfdiv_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00070000;
+ *((int *)&__m128_op0[2]) = 0x00040000;
+ *((int *)&__m128_op0[1]) = 0x00030000;
+ *((int *)&__m128_op0[0]) = 0x00010000;
+ *((int *)&__m128_op1[3]) = 0x00070000;
+ *((int *)&__m128_op1[2]) = 0x00040000;
+ *((int *)&__m128_op1[1]) = 0x00030000;
+ *((int *)&__m128_op1[0]) = 0x00010000;
+ *((int *)&__m128_result[3]) = 0x3f800000;
+ *((int *)&__m128_result[2]) = 0x3f800000;
+ *((int *)&__m128_result[1]) = 0x3f800000;
+ *((int *)&__m128_result[0]) = 0x3f800000;
+ __m128_out = __lsx_vfdiv_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00010001;
+ *((int *)&__m128_op1[2]) = 0x0001007c;
+ *((int *)&__m128_op1[1]) = 0x00010001;
+ *((int *)&__m128_op1[0]) = 0x00010001;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfdiv_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00001fff;
+ *((int *)&__m128_op0[2]) = 0x00001fff;
+ *((int *)&__m128_op0[1]) = 0x00000003;
+ *((int *)&__m128_op0[0]) = 0xfffffffc;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0xfffffffc;
+ __m128_out = __lsx_vfdiv_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7fc00000;
+ *((int *)&__m128_result[2]) = 0x7fc00000;
+ *((int *)&__m128_result[1]) = 0x7fc00000;
+ *((int *)&__m128_result[0]) = 0x7fc00000;
+ __m128_out = __lsx_vfdiv_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfclass_d.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfclass_d.c
new file mode 100644
index 000000000..9706d7adc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfclass_d.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 *)&__m128d_op0[1]) = 0x0001ffff0001ffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0001ffff0001ffff;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000000000100;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000000000100;
+ __m128i_out = __lsx_vfclass_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000000000200;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000000000200;
+ __m128i_out = __lsx_vfclass_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000000000200;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000000000200;
+ __m128i_out = __lsx_vfclass_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000000000002;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000000000002;
+ __m128i_out = __lsx_vfclass_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xff00ff00ff00ff00;
+ *((unsigned long *)&__m128d_op0[0]) = 0xff00000000000000;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000000000008;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000000000008;
+ __m128i_out = __lsx_vfclass_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000000000200;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000000000200;
+ __m128i_out = __lsx_vfclass_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x14ccc6320176a4d2;
+ *((unsigned long *)&__m128d_op0[0]) = 0x685670d37e80682a;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000000000080;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000000000080;
+ __m128i_out = __lsx_vfclass_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000000000200;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000000000200;
+ __m128i_out = __lsx_vfclass_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000000000200;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000000000200;
+ __m128i_out = __lsx_vfclass_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfclass_s.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfclass_s.c
new file mode 100644
index 000000000..7166f954b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfclass_s.c
@@ -0,0 +1,74 @@
+/* { 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;
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x7fff8000;
+ *((int *)&__m128_op0[1]) = 0x00010081;
+ *((int *)&__m128_op0[0]) = 0x00000005;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000020000000002;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000010000000100;
+ __m128i_out = __lsx_vfclass_s (__m128_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((int *)&__m128_op0[3]) = 0xfe02fe02;
+ *((int *)&__m128_op0[2]) = 0xfe02fe02;
+ *((int *)&__m128_op0[1]) = 0xfe02fe02;
+ *((int *)&__m128_op0[0]) = 0xfe02fe02;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000000800000008;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000000800000008;
+ __m128i_out = __lsx_vfclass_s (__m128_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((int *)&__m128_op0[3]) = 0x0000000c;
+ *((int *)&__m128_op0[2]) = 0x7fff000c;
+ *((int *)&__m128_op0[1]) = 0x10001000;
+ *((int *)&__m128_op0[0]) = 0x10001000;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000010000000002;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000008000000080;
+ __m128i_out = __lsx_vfclass_s (__m128_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000020000000200;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000020000000200;
+ __m128i_out = __lsx_vfclass_s (__m128_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000020000000200;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000020000000200;
+ __m128i_out = __lsx_vfclass_s (__m128_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ *((int *)&__m128_op0[3]) = 0x0c0b0a09;
+ *((int *)&__m128_op0[2]) = 0x0b0a0908;
+ *((int *)&__m128_op0[1]) = 0x0a090807;
+ *((int *)&__m128_op0[0]) = 0x09080706;
+ *((unsigned long *)&__m128i_result[1]) = 0x0000008000000080;
+ *((unsigned long *)&__m128i_result[0]) = 0x0000008000000080;
+ __m128i_out = __lsx_vfclass_s (__m128_op0);
+ ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vflogb_d.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vflogb_d.c
new file mode 100644
index 000000000..cc36bf136
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vflogb_d.c
@@ -0,0 +1,76 @@
+/* { 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 *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000002;
+ *((unsigned long *)&__m128d_result[1]) = 0xfff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xc090c40000000000;
+ __m128d_out = __lsx_vflogb_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xfff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xfff0000000000000;
+ __m128d_out = __lsx_vflogb_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xfff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xfff0000000000000;
+ __m128d_out = __lsx_vflogb_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xfff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xfff0000000000000;
+ __m128d_out = __lsx_vflogb_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xfff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xfff0000000000000;
+ __m128d_out = __lsx_vflogb_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xfff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xfff0000000000000;
+ __m128d_out = __lsx_vflogb_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xfff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xfff0000000000000;
+ __m128d_out = __lsx_vflogb_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xfffffffffffbfffc;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000001000000048;
+ *((unsigned long *)&__m128d_result[1]) = 0xfffffffffffbfffc;
+ *((unsigned long *)&__m128d_result[0]) = 0xc090380000000000;
+ __m128d_out = __lsx_vflogb_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vflogb_s.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vflogb_s.c
new file mode 100644
index 000000000..624589620
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vflogb_s.c
@@ -0,0 +1,185 @@
+/* { 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;
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00003004;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0xc3080000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffffffff;
+ *((int *)&__m128_op0[2]) = 0xffffffff;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0xffffffff;
+ *((int *)&__m128_result[2]) = 0xffffffff;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0xff800000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0xffffffff;
+ *((int *)&__m128_op0[0]) = 0xffffffff;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0xffffffff;
+ *((int *)&__m128_result[0]) = 0xffffffff;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x01010101;
+ *((int *)&__m128_op0[2]) = 0x01010101;
+ *((int *)&__m128_op0[1]) = 0x01010101;
+ *((int *)&__m128_op0[0]) = 0x01010101;
+ *((int *)&__m128_result[3]) = 0xc2fa0000;
+ *((int *)&__m128_result[2]) = 0xc2fa0000;
+ *((int *)&__m128_result[1]) = 0xc2fa0000;
+ *((int *)&__m128_result[0]) = 0xc2fa0000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x01ff01ff;
+ *((int *)&__m128_op0[2]) = 0x01ff01ff;
+ *((int *)&__m128_op0[1]) = 0x01ff01ff;
+ *((int *)&__m128_op0[0]) = 0x01ff01ff;
+ *((int *)&__m128_result[3]) = 0xc2f80000;
+ *((int *)&__m128_result[2]) = 0xc2f80000;
+ *((int *)&__m128_result[1]) = 0xc2f80000;
+ *((int *)&__m128_result[0]) = 0xc2f80000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0xd46cdc13;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0x7fc00000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00fe00fe;
+ *((int *)&__m128_op0[2]) = 0x000200fe;
+ *((int *)&__m128_op0[1]) = 0x00fe00fe;
+ *((int *)&__m128_op0[0]) = 0x000200fe;
+ *((int *)&__m128_result[3]) = 0xc2fc0000;
+ *((int *)&__m128_result[2]) = 0xc3040000;
+ *((int *)&__m128_result[1]) = 0xc2fc0000;
+ *((int *)&__m128_result[0]) = 0xc3040000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x01010101;
+ *((int *)&__m128_op0[0]) = 0x00000100;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0xc2fa0000;
+ *((int *)&__m128_result[0]) = 0xc30d0000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000014;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000014;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xc3110000;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0xc3110000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x4e3e1337;
+ *((int *)&__m128_op0[0]) = 0x38bb47d2;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0x41e80000;
+ *((int *)&__m128_result[0]) = 0xc1600000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0xff800000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0xff800000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0xff800000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00003ff8;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0xff800000;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0xc3080000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xf1f181a2;
+ *((int *)&__m128_op0[2]) = 0xf1f1f1b0;
+ *((int *)&__m128_op0[1]) = 0xf1f1f1f1;
+ *((int *)&__m128_op0[0]) = 0xf180f1f1;
+ *((int *)&__m128_result[3]) = 0x7fc00000;
+ *((int *)&__m128_result[2]) = 0x7fc00000;
+ *((int *)&__m128_result[1]) = 0x7fc00000;
+ *((int *)&__m128_result[0]) = 0x7fc00000;
+ __m128_out = __lsx_vflogb_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmax_d.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmax_d.c
new file mode 100644
index 000000000..442473fb4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmax_d.c
@@ -0,0 +1,200 @@
+/* { 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 *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000010;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0400040004000400;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0400040004000400;
+ *((unsigned long *)&__m128d_result[1]) = 0x0400040004000400;
+ *((unsigned long *)&__m128d_result[0]) = 0x0400040004000400;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x01ff01ff01ff01ff;
+ *((unsigned long *)&__m128d_op0[0]) = 0x01ff01ff01ff01ff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x01ff01ff01ff01ff;
+ *((unsigned long *)&__m128d_result[0]) = 0x01ff01ff01ff01ff;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xfffcfffcfffcfffc;
+ *((unsigned long *)&__m128d_op0[0]) = 0xfffcfffcfffcfffc;
+ *((unsigned long *)&__m128d_op1[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[1]) = 0xfffcfffcfffcfffc;
+ *((unsigned long *)&__m128d_result[0]) = 0xfffcfffcfffcfffc;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x000000000000ffff;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x000000000000ffff;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x6363636363636363;
+ *((unsigned long *)&__m128d_op0[0]) = 0x6363636363636363;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000001;
+ *((unsigned long *)&__m128d_op1[0]) = 0xfdfef9ff0efff900;
+ *((unsigned long *)&__m128d_result[1]) = 0x6363636363636363;
+ *((unsigned long *)&__m128d_result[0]) = 0x6363636363636363;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xd70b30c96ea9f4e8;
+ *((unsigned long *)&__m128d_op0[0]) = 0xa352bfac9269e0aa;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x98147a504d145000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x377b810912c0e000;
+ *((unsigned long *)&__m128d_op1[1]) = 0xfffffffffffffff7;
+ *((unsigned long *)&__m128d_op1[0]) = 0xfffffffffffffff7;
+ *((unsigned long *)&__m128d_result[1]) = 0x98147a504d145000;
+ *((unsigned long *)&__m128d_result[0]) = 0x377b810912c0e000;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x4399d3221a29d3f2;
+ *((unsigned long *)&__m128d_op0[0]) = 0xc3818bffe7b7a7b8;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x4399d3221a29d3f2;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x17c64aaef639f093;
+ *((unsigned long *)&__m128d_op0[0]) = 0xdb8f439722ec502d;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x17c64aaef639f093;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x10f881a20ffd02b0;
+ *((unsigned long *)&__m128d_op0[0]) = 0x00000000ff800000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x10f881a20ffd02b0;
+ *((unsigned long *)&__m128d_result[0]) = 0x00000000ff800000;
+ __m128d_out = __lsx_vfmax_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmin_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfmin_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000006f00001f0a;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000c000ffffc000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000006f00001f0a;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000958affff995d;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000006f00001f0a;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000958affff995d;
+ __m128d_out = __lsx_vfmin_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmin_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmin_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmin_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x8000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x1748c4f9ed1a5870;
+ *((unsigned long *)&__m128d_result[1]) = 0x8000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmin_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmin_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmax_s.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmax_s.c
new file mode 100644
index 000000000..876588827
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmax_s.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;
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x0000ffff;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x0000ffff;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0xc2409eda;
+ *((int *)&__m128_op1[2]) = 0xb019323f;
+ *((int *)&__m128_op1[1]) = 0x460f3b39;
+ *((int *)&__m128_op1[0]) = 0x3ef4be3a;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x460f3b39;
+ *((int *)&__m128_result[0]) = 0x3ef4be3a;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000001;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000001;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000001;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000001;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0xfefd7f7f;
+ *((int *)&__m128_op1[2]) = 0x7f7f7f7e;
+ *((int *)&__m128_op1[1]) = 0xdffdbffe;
+ *((int *)&__m128_op1[0]) = 0xba6f5543;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x7f7f7f7e;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xff84fff4;
+ *((int *)&__m128_op0[2]) = 0xff84fff4;
+ *((int *)&__m128_op0[1]) = 0xffffffff;
+ *((int *)&__m128_op0[0]) = 0xfffffff0;
+ *((int *)&__m128_op1[3]) = 0xff84fff4;
+ *((int *)&__m128_op1[2]) = 0xff84fff4;
+ *((int *)&__m128_op1[1]) = 0xffffffff;
+ *((int *)&__m128_op1[0]) = 0xfffffff0;
+ *((int *)&__m128_result[3]) = 0xffc4fff4;
+ *((int *)&__m128_result[2]) = 0xffc4fff4;
+ *((int *)&__m128_result[1]) = 0xffffffff;
+ *((int *)&__m128_result[0]) = 0xfffffff0;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00007fff;
+ *((int *)&__m128_op1[2]) = 0x00007fff;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00007fff;
+ *((int *)&__m128_result[2]) = 0x00007fff;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0xffffffff;
+ *((int *)&__m128_op0[1]) = 0xffffffff;
+ *((int *)&__m128_op0[0]) = 0xffffffff;
+ *((int *)&__m128_op1[3]) = 0xffffffff;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000001;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0xffffffff;
+ *((int *)&__m128_op1[2]) = 0xffffffff;
+ *((int *)&__m128_op1[1]) = 0xffffffff;
+ *((int *)&__m128_op1[0]) = 0xffffffff;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000001;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x01010001;
+ *((int *)&__m128_op0[0]) = 0x01010001;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00020000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00020000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00020000;
+ *((int *)&__m128_result[1]) = 0x01010001;
+ *((int *)&__m128_result[0]) = 0x01010001;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000020;
+ *((int *)&__m128_op1[2]) = 0x00000020;
+ *((int *)&__m128_op1[1]) = 0x0000001f;
+ *((int *)&__m128_op1[0]) = 0x0000001f;
+ *((int *)&__m128_result[3]) = 0x00000020;
+ *((int *)&__m128_result[2]) = 0x00000020;
+ *((int *)&__m128_result[1]) = 0x0000001f;
+ *((int *)&__m128_result[0]) = 0x0000001f;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0xf3040705;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0xf3040705;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0xf3040705;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000004;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000004;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000004;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000004;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000004;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000004;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmax_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x0000ffff;
+ *((int *)&__m128_op0[2]) = 0x0000ffff;
+ *((int *)&__m128_op0[1]) = 0x0000ffff;
+ *((int *)&__m128_op0[0]) = 0x0000fffe;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmin_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffffffff;
+ *((int *)&__m128_op0[2]) = 0xffffffe5;
+ *((int *)&__m128_op0[1]) = 0xffffffff;
+ *((int *)&__m128_op0[0]) = 0xffffffe5;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmin_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmin_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x13121110;
+ *((int *)&__m128_op0[2]) = 0x1211100f;
+ *((int *)&__m128_op0[1]) = 0x11100f0e;
+ *((int *)&__m128_op0[0]) = 0x100f0e0d;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmin_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffffffff;
+ *((int *)&__m128_op0[2]) = 0xffffffff;
+ *((int *)&__m128_op0[1]) = 0xffffffff;
+ *((int *)&__m128_op0[0]) = 0xfffffff3;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000008;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000088;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000008;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000088;
+ __m128_out = __lsx_vfmin_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x52525252;
+ *((int *)&__m128_op0[2]) = 0xadadadad;
+ *((int *)&__m128_op0[1]) = 0x52525252;
+ *((int *)&__m128_op0[0]) = 0xadadadad;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0xffffffff;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0xffffffff;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0xadadadad;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0xadadadad;
+ __m128_out = __lsx_vfmin_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x0000ffff;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x0000ffff;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x0000ffff;
+ __m128_out = __lsx_vfmin_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmaxa_d.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmaxa_d.c
new file mode 100644
index 000000000..c2766d5c6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmaxa_d.c
@@ -0,0 +1,155 @@
+/* { 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 *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000800000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000800000000000;
+ __m128d_out = __lsx_vfmaxa_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmaxa_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmaxa_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x01203f1e3d1c3b1a;
+ *((unsigned long *)&__m128d_op0[0]) = 0x3918371635143312;
+ *((unsigned long *)&__m128d_op1[1]) = 0x00000af555555555;
+ *((unsigned long *)&__m128d_op1[0]) = 0x00000af555555555;
+ *((unsigned long *)&__m128d_result[1]) = 0x01203f1e3d1c3b1a;
+ *((unsigned long *)&__m128d_result[0]) = 0x3918371635143312;
+ __m128d_out = __lsx_vfmaxa_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000010000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000010000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000010000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000010000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000010000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000010000000000;
+ __m128d_out = __lsx_vfmaxa_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmaxa_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmaxa_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmaxa_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x10f8000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0xfff8ffa2fffdffb0;
+ *((unsigned long *)&__m128d_op1[0]) = 0x00000000ff800000;
+ *((unsigned long *)&__m128d_result[1]) = 0x10f8000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x00000000ff800000;
+ __m128d_out = __lsx_vfmaxa_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000200000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op1[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000200000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmina_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000100000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000080000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x80000000fff6fc00;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000080000000;
+ __m128d_out = __lsx_vfmina_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000080000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmina_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000158;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmina_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op1[0]) = 0xfffe0004fffe0004;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmina_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xff800000ff800000;
+ *((unsigned long *)&__m128d_op0[0]) = 0xff800000ff800000;
+ *((unsigned long *)&__m128d_op1[1]) = 0x002a001a001a000b;
+ *((unsigned long *)&__m128d_op1[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x002a001a001a000b;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfmina_d (__m128d_op0, __m128d_op1);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmaxa_s.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmaxa_s.c
new file mode 100644
index 000000000..5fcdedd3f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfmaxa_s.c
@@ -0,0 +1,230 @@
+/* { 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;
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmaxa_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0xf436f3f5;
+ *((int *)&__m128_op0[0]) = 0x2f4ef4a8;
+ *((int *)&__m128_op1[3]) = 0xff800000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0xff800000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0xff800000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0xff800000;
+ *((int *)&__m128_result[0]) = 0x2f4ef4a8;
+ __m128_out = __lsx_vfmaxa_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000800;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000800;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000800;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000800;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmaxa_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0xc0c0c000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00800080;
+ *((int *)&__m128_op1[2]) = 0x00800080;
+ *((int *)&__m128_op1[1]) = 0x0080006b;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00800080;
+ *((int *)&__m128_result[2]) = 0xc0c0c000;
+ *((int *)&__m128_result[1]) = 0x0080006b;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmaxa_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffffffff;
+ *((int *)&__m128_op0[2]) = 0xffffffff;
+ *((int *)&__m128_op0[1]) = 0xffffffff;
+ *((int *)&__m128_op0[0]) = 0xffffffff;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmaxa_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x80000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x80000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmaxa_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmaxa_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmina_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0xffffffff;
+ *((int *)&__m128_op1[2]) = 0xffffffff;
+ *((int *)&__m128_op1[1]) = 0xffffffff;
+ *((int *)&__m128_op1[0]) = 0xffffffff;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmina_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmina_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_op1[3]) = 0xff01ff01;
+ *((int *)&__m128_op1[2]) = 0x0000ff7d;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x0000fffc;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmina_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0xdfa6e0c6;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0xd46cdc13;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmina_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x01010101;
+ *((int *)&__m128_op0[2]) = 0x01010101;
+ *((int *)&__m128_op0[1]) = 0x010101fe;
+ *((int *)&__m128_op0[0]) = 0x0101fe87;
+ *((int *)&__m128_op1[3]) = 0x00000000;
+ *((int *)&__m128_op1[2]) = 0x00000000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmina_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffffffff;
+ *((int *)&__m128_op0[2]) = 0xffffffff;
+ *((int *)&__m128_op0[1]) = 0xffffffff;
+ *((int *)&__m128_op0[0]) = 0xffffffff;
+ *((int *)&__m128_op1[3]) = 0xffff0000;
+ *((int *)&__m128_op1[2]) = 0xffff0000;
+ *((int *)&__m128_op1[1]) = 0x00000000;
+ *((int *)&__m128_op1[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0xffffffff;
+ *((int *)&__m128_result[2]) = 0xffffffff;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfmina_s (__m128_op0, __m128_op1);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfsqrt_d.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfsqrt_d.c
new file mode 100644
index 000000000..8a35dfe24
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfsqrt_d.c
@@ -0,0 +1,216 @@
+/* { 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 *)&__m128d_op0[1]) = 0xffffffffa486c90f;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000058bcc201;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffa486c90f;
+ *((unsigned long *)&__m128d_result[0]) = 0x1f52d710bf295626;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffff01ff01;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffff01ff01;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000be00be;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x1f1b917c9f3d5e05;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x0000000000000000;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffff00000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000001400000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffff00000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x1f81e3779b97f4a8;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xff800000ff800000;
+ *((unsigned long *)&__m128d_op0[0]) = 0xff800000ff800000;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff8000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff8000000000000;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x001effae001effae;
+ *((unsigned long *)&__m128d_op0[0]) = 0x001effae001effae;
+ *((unsigned long *)&__m128d_result[1]) = 0x2006454690d3de87;
+ *((unsigned long *)&__m128d_result[0]) = 0x2006454690d3de87;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xc0b4d1a5f8babad3;
+ *((unsigned long *)&__m128d_op0[0]) = 0xbbc8ecc5f3ced5f3;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff8000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff8000000000000;
+ __m128d_out = __lsx_vfsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xff800000ff800000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff8000000000000;
+ __m128d_out = __lsx_vfrsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0001ffff00000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0001ffff0001ffff;
+ *((unsigned long *)&__m128d_result[1]) = 0x5ff6a0a40ea8f47c;
+ *((unsigned long *)&__m128d_result[0]) = 0x5ff6a0a40e9da42a;
+ __m128d_out = __lsx_vfrsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x000000000000000f;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x61608654a2d4f6da;
+ __m128d_out = __lsx_vfrsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffff0000ffff0000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffff0000ffff0000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff0000000000000;
+ __m128d_out = __lsx_vfrsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x00fe000100cf005f;
+ *((unsigned long *)&__m128d_op0[0]) = 0x7fff7fff7fff7fff;
+ *((unsigned long *)&__m128d_result[1]) = 0x5f675e96e29a5a60;
+ *((unsigned long *)&__m128d_result[0]) = 0x7fff7fff7fff7fff;
+ __m128d_out = __lsx_vfrsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff0000000000000;
+ __m128d_out = __lsx_vfrsqrt_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0x7ff8000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff8000000000000;
+ __m128d_out = __lsx_vfrecip_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff0000000000000;
+ __m128d_out = __lsx_vfrecip_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x00003f8000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x00003f8000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff0000000000000;
+ __m128d_out = __lsx_vfrecip_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff0000000000000;
+ __m128d_out = __lsx_vfrecip_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x0000000000000000;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff0000000000000;
+ __m128d_out = __lsx_vfrecip_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_op0[0]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[1]) = 0xffffffffffffffff;
+ *((unsigned long *)&__m128d_result[0]) = 0xffffffffffffffff;
+ __m128d_out = __lsx_vfrecip_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x00000000fffa0000;
+ *((unsigned long *)&__m128d_op0[0]) = 0x00000000fffa0000;
+ *((unsigned long *)&__m128d_result[1]) = 0x7ff0000000000000;
+ *((unsigned long *)&__m128d_result[0]) = 0x7ff0000000000000;
+ __m128d_out = __lsx_vfrecip_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0xff800000ff800000;
+ *((unsigned long *)&__m128d_op0[0]) = 0xe593c8c4e593c8c4;
+ *((unsigned long *)&__m128d_result[1]) = 0x805ffffe01001fe0;
+ *((unsigned long *)&__m128d_result[0]) = 0x9a49e11102834d70;
+ __m128d_out = __lsx_vfrecip_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ *((unsigned long *)&__m128d_op0[1]) = 0x5252525252525252;
+ *((unsigned long *)&__m128d_op0[0]) = 0x5252dcdcdcdcdcdc;
+ *((unsigned long *)&__m128d_result[1]) = 0x2d8bf1f8fc7e3f20;
+ *((unsigned long *)&__m128d_result[0]) = 0x2d8b24b936d1b24d;
+ __m128d_out = __lsx_vfrecip_d (__m128d_op0);
+ ASSERTEQ_64 (__LINE__, __m128d_result, __m128d_out);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfsqrt_s.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfsqrt_s.c
new file mode 100644
index 000000000..ffd80540b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vfsqrt_s.c
@@ -0,0 +1,372 @@
+/* { 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;
+
+ *((int *)&__m128_op0[3]) = 0xfe07e5fe;
+ *((int *)&__m128_op0[2]) = 0xfefdddfe;
+ *((int *)&__m128_op0[1]) = 0x00020100;
+ *((int *)&__m128_op0[0]) = 0xfedd0c00;
+ *((int *)&__m128_result[3]) = 0x7fc00000;
+ *((int *)&__m128_result[2]) = 0x7fc00000;
+ *((int *)&__m128_result[1]) = 0x1e801ffc;
+ *((int *)&__m128_result[0]) = 0x7fc00000;
+ __m128_out = __lsx_vfsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xff00ff00;
+ *((int *)&__m128_op0[2]) = 0xff00ff00;
+ *((int *)&__m128_op0[1]) = 0xff00ff00;
+ *((int *)&__m128_op0[0]) = 0xff00ff00;
+ *((int *)&__m128_result[3]) = 0x7fc00000;
+ *((int *)&__m128_result[2]) = 0x7fc00000;
+ *((int *)&__m128_result[1]) = 0x7fc00000;
+ *((int *)&__m128_result[0]) = 0x7fc00000;
+ __m128_out = __lsx_vfsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x8c7fc73a;
+ *((int *)&__m128_op0[2]) = 0x137e54af;
+ *((int *)&__m128_op0[1]) = 0xbc84cf6f;
+ *((int *)&__m128_op0[0]) = 0x76208329;
+ *((int *)&__m128_result[3]) = 0x7fc00000;
+ *((int *)&__m128_result[2]) = 0x297f29fe;
+ *((int *)&__m128_result[1]) = 0x7fc00000;
+ *((int *)&__m128_result[0]) = 0x5acab5a5;
+ __m128_out = __lsx_vfsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffff9727;
+ *((int *)&__m128_op0[2]) = 0xffff9727;
+ *((int *)&__m128_op0[1]) = 0xfffffe79;
+ *((int *)&__m128_op0[0]) = 0xffffba5f;
+ *((int *)&__m128_result[3]) = 0xffff9727;
+ *((int *)&__m128_result[2]) = 0xffff9727;
+ *((int *)&__m128_result[1]) = 0xfffffe79;
+ *((int *)&__m128_result[0]) = 0xffffba5f;
+ __m128_out = __lsx_vfsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x00000000;
+ *((int *)&__m128_result[2]) = 0x00000000;
+ *((int *)&__m128_result[1]) = 0x00000000;
+ *((int *)&__m128_result[0]) = 0x00000000;
+ __m128_out = __lsx_vfsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0xfff8fff8;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0xfff80000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0xfff8fff8;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0xfff80000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffffffff;
+ *((int *)&__m128_op0[2]) = 0xffffffff;
+ *((int *)&__m128_op0[1]) = 0xffffffff;
+ *((int *)&__m128_op0[0]) = 0xffffffff;
+ *((int *)&__m128_result[3]) = 0xffffffff;
+ *((int *)&__m128_result[2]) = 0xffffffff;
+ *((int *)&__m128_result[1]) = 0xffffffff;
+ *((int *)&__m128_result[0]) = 0xffffffff;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x1f1b917c;
+ *((int *)&__m128_op0[0]) = 0x9f3d5e05;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x4fa432d6;
+ *((int *)&__m128_result[0]) = 0x7fc00000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffffffff;
+ *((int *)&__m128_op0[2]) = 0xffffffff;
+ *((int *)&__m128_op0[1]) = 0x12835580;
+ *((int *)&__m128_op0[0]) = 0xb880eb98;
+ *((int *)&__m128_result[3]) = 0xffffffff;
+ *((int *)&__m128_result[2]) = 0xffffffff;
+ *((int *)&__m128_result[1]) = 0x55fcbad1;
+ *((int *)&__m128_result[0]) = 0x7fc00000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x06070607;
+ *((int *)&__m128_op0[2]) = 0x00000807;
+ *((int *)&__m128_op0[1]) = 0x0707f8f8;
+ *((int *)&__m128_op0[0]) = 0x03e8157e;
+ *((int *)&__m128_result[3]) = 0x5c303f97;
+ *((int *)&__m128_result[2]) = 0x61ff9049;
+ *((int *)&__m128_result[1]) = 0x5bafa1dd;
+ *((int *)&__m128_result[0]) = 0x5d3e1e1d;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xfff7fffe;
+ *((int *)&__m128_op0[2]) = 0xfffa01ff;
+ *((int *)&__m128_op0[1]) = 0xfffbfffe;
+ *((int *)&__m128_op0[0]) = 0xfffe01ff;
+ *((int *)&__m128_result[3]) = 0xfff7fffe;
+ *((int *)&__m128_result[2]) = 0xfffa01ff;
+ *((int *)&__m128_result[1]) = 0xfffbfffe;
+ *((int *)&__m128_result[0]) = 0xfffe01ff;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x45000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x44000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x3cb504f3;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x3d3504f3;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00020001;
+ *((int *)&__m128_op0[0]) = 0x00020002;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x607fffc0;
+ *((int *)&__m128_result[0]) = 0x607fff80;
+ __m128_out = __lsx_vfrsqrt_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000002;
+ *((int *)&__m128_op0[2]) = 0x00000002;
+ *((int *)&__m128_op0[1]) = 0x00000003;
+ *((int *)&__m128_op0[0]) = 0x00000003;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrecip_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xf6e91c00;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x51cfd7c0;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x880c91b8;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x2d1da85b;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrecip_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrecip_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrecip_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xfffffffa;
+ *((int *)&__m128_op0[2]) = 0xfffffffa;
+ *((int *)&__m128_op0[1]) = 0xfffffffa;
+ *((int *)&__m128_op0[0]) = 0xfffffffa;
+ *((int *)&__m128_result[3]) = 0xfffffffa;
+ *((int *)&__m128_result[2]) = 0xfffffffa;
+ *((int *)&__m128_result[1]) = 0xfffffffa;
+ *((int *)&__m128_result[0]) = 0xfffffffa;
+ __m128_out = __lsx_vfrecip_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrecip_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0xffff0001;
+ *((int *)&__m128_op0[2]) = 0xffff0001;
+ *((int *)&__m128_op0[1]) = 0xffff0001;
+ *((int *)&__m128_op0[0]) = 0xffff0001;
+ *((int *)&__m128_result[3]) = 0xffff0001;
+ *((int *)&__m128_result[2]) = 0xffff0001;
+ *((int *)&__m128_result[1]) = 0xffff0001;
+ *((int *)&__m128_result[0]) = 0xffff0001;
+ __m128_out = __lsx_vfrecip_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x0a000000;
+ *((int *)&__m128_op0[2]) = 0x0a000000;
+ *((int *)&__m128_op0[1]) = 0x0a000000;
+ *((int *)&__m128_op0[0]) = 0x0a000000;
+ *((int *)&__m128_result[3]) = 0x75000000;
+ *((int *)&__m128_result[2]) = 0x75000000;
+ *((int *)&__m128_result[1]) = 0x75000000;
+ *((int *)&__m128_result[0]) = 0x75000000;
+ __m128_out = __lsx_vfrecip_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ *((int *)&__m128_op0[3]) = 0x00000000;
+ *((int *)&__m128_op0[2]) = 0x00000000;
+ *((int *)&__m128_op0[1]) = 0x00000000;
+ *((int *)&__m128_op0[0]) = 0x00000000;
+ *((int *)&__m128_result[3]) = 0x7f800000;
+ *((int *)&__m128_result[2]) = 0x7f800000;
+ *((int *)&__m128_result[1]) = 0x7f800000;
+ *((int *)&__m128_result[0]) = 0x7f800000;
+ __m128_out = __lsx_vfrecip_s (__m128_op0);
+ ASSERTEQ_32 (__LINE__, __m128_result, __m128_out);
+
+ return 0;
+}
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。