Projects
openEuler:24.03:SP1:Everything:64G
gcc
_service:tar_scm:LoongArch-Add-tests-for-SX-vec...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:LoongArch-Add-tests-for-SX-vector-vbitclr-vbitclri-v.patch of Package gcc
From 0b75b581703b0eb1eb9ca9e898255de7f4cb51ad Mon Sep 17 00:00:00 2001 From: Xiaolong Chen <chenxiaolong@loongson.cn> Date: Tue, 12 Sep 2023 11:20:44 +0800 Subject: [PATCH 092/124] LoongArch: Add tests for SX vector vbitclr/vbitclri/vbitrev/vbitrevi/ vbitsel/vbitseli/vbitset/vbitseti/vclo/vclz/vpcnt instructions. gcc/testsuite/ChangeLog: * gcc.target/loongarch/vector/lsx/lsx-vbitclr.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vbitclri.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vbitrev.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vbitrevi.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vbitsel.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vbitseli.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vbitset.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vbitseti.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vclo.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vclz.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vpcnt.c: New test. Signed-off-by: Peng Fan <fanpeng@loongson.cn> Signed-off-by: ticat_fp <fanpeng@loongson.cn> --- .../loongarch/vector/lsx/lsx-vbitclr.c | 461 ++++++++++++++++++ .../loongarch/vector/lsx/lsx-vbitclri.c | 279 +++++++++++ .../loongarch/vector/lsx/lsx-vbitrev.c | 407 ++++++++++++++++ .../loongarch/vector/lsx/lsx-vbitrevi.c | 336 +++++++++++++ .../loongarch/vector/lsx/lsx-vbitsel.c | 109 +++++ .../loongarch/vector/lsx/lsx-vbitseli.c | 84 ++++ .../loongarch/vector/lsx/lsx-vbitset.c | 371 ++++++++++++++ .../loongarch/vector/lsx/lsx-vbitseti.c | 279 +++++++++++ .../loongarch/vector/lsx/lsx-vclo.c | 266 ++++++++++ .../loongarch/vector/lsx/lsx-vclz.c | 265 ++++++++++ .../loongarch/vector/lsx/lsx-vpcnt.c | 350 +++++++++++++ 11 files changed, 3207 insertions(+) create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitclr.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitclri.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitrev.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitrevi.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitsel.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitseli.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitset.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitseti.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vclo.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vclz.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vpcnt.c diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitclr.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitclr.c new file mode 100644 index 000000000..411dcaa40 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitclr.c @@ -0,0 +1,461 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x000000e0000000e0; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x00e0000000e00000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x000000e0000000e0; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000004000; + *((unsigned long *)&__m128i_op1[0]) = 0xfff8004000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x19df307a5d04acbb; + *((unsigned long *)&__m128i_op0[0]) = 0x5ed032b06bde1ab6; + *((unsigned long *)&__m128i_op1[1]) = 0x0080000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0080000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x19de307a5d04acba; + *((unsigned long *)&__m128i_result[0]) = 0x5ed032b06bde1ab6; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0018001800180018; + *((unsigned long *)&__m128i_op1[0]) = 0x0018001800180018; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xd8248069ffe78077; + *((unsigned long *)&__m128i_op1[1]) = 0x85bd6b0e94d89998; + *((unsigned long *)&__m128i_op1[0]) = 0xd83c8081ffff808f; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0xd82480697f678077; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000000006597cc3d; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001; + *((unsigned long *)&__m128i_op1[1]) = 0x7505853d654185f5; + *((unsigned long *)&__m128i_op1[0]) = 0x01010000fefe0101; + *((unsigned long *)&__m128i_result[1]) = 0x000000006595cc1d; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffff0000ffff0000; + *((unsigned long *)&__m128i_op0[0]) = 0xffff0000ffff0000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xfffe0000fffe0000; + *((unsigned long *)&__m128i_result[0]) = 0xfffe0000fffe0000; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_op0[0]) = 0x80000000fff7fc01; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000100000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000080000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x80000000fff6fc00; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000fffff800; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x00000000fffefffe; + *((unsigned long *)&__m128i_result[0]) = 0x00000000fffef800; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000001000100; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000001000100; + *((unsigned long *)&__m128i_result[1]) = 0xfffffffefffffffe; + *((unsigned long *)&__m128i_result[0]) = 0xfffffffefffffffe; + __m128i_out = __lsx_vbitclr_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x4101010141010100; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[1]) = 0x4101010141010100; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x23b57fa16d39f7c8; + *((unsigned long *)&__m128i_op1[0]) = 0x161c0c363c200824; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x8000ffff00000000; + *((unsigned long *)&__m128i_op0[0]) = 0x8000ffff00000000; + *((unsigned long *)&__m128i_op1[1]) = 0x3f8000003f800000; + *((unsigned long *)&__m128i_op1[0]) = 0x3f8000003f800000; + *((unsigned long *)&__m128i_result[1]) = 0x0000fefe00000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000fefe00000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0x1ffffffff8001000; + *((unsigned long *)&__m128i_op1[0]) = 0xf0bd80bd80bd8000; + *((unsigned long *)&__m128i_result[1]) = 0x7fff7ffffffefffe; + *((unsigned long *)&__m128i_result[0]) = 0xdfffdfffdffffffe; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000037; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000001f0a; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000036; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000100010001007c; + *((unsigned long *)&__m128i_op0[0]) = 0x0001000100010001; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x000100000001007c; + *((unsigned long *)&__m128i_result[0]) = 0x0001000000010000; + __m128i_out = __lsx_vbitclr_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfefa000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xfefa000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x67b7cf643c9d636a; + *((unsigned long *)&__m128i_op0[0]) = 0x39d70e366f547977; + *((unsigned long *)&__m128i_op1[1]) = 0x0002ffff00000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x66b34f643c9c626a; + *((unsigned long *)&__m128i_result[0]) = 0x38d60e366e547876; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x2020202020202020; + *((unsigned long *)&__m128i_op0[0]) = 0x2020202020207fff; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000007fff; + *((unsigned long *)&__m128i_result[1]) = 0x2020202020202020; + *((unsigned long *)&__m128i_result[0]) = 0x2020202020207f7f; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x8080808080808080; + *((unsigned long *)&__m128i_op1[0]) = 0x8080808080808080; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7ff8000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x7ff8000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000005; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000005; + *((unsigned long *)&__m128i_result[1]) = 0x7ef8000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x7ef8000000000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffff0000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000077f97; + *((unsigned long *)&__m128i_result[1]) = 0xfffffffefffffffe; + *((unsigned long *)&__m128i_result[0]) = 0xfffffffeff7f0000; + __m128i_out = __lsx_vbitclr_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x14ccc6320176a4d2; + *((unsigned long *)&__m128i_op0[0]) = 0x685670d37e80682a; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x000000007fffffff; + *((unsigned long *)&__m128i_result[1]) = 0x14ccc6320076a4d2; + *((unsigned long *)&__m128i_result[0]) = 0x685670d27e00682a; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x003fffff00000000; + *((unsigned long *)&__m128i_op1[0]) = 0x003fffff00000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000001000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000001000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x00001b4a00007808; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000001000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000001000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0100010001000100; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x000000007fff7fff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000001000100; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x5d7f5d807fea807f; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x5d7f5d007f6a007f; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x00000000fffefffe; + *((unsigned long *)&__m128i_result[0]) = 0x00000000fffefffe; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x207fffff22bd04fb; + *((unsigned long *)&__m128i_op0[0]) = 0x207fffff22bd04fb; + *((unsigned long *)&__m128i_op1[1]) = 0x0001000002000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0001000002000000; + *((unsigned long *)&__m128i_result[1]) = 0x207fffff22bd04fa; + *((unsigned long *)&__m128i_result[0]) = 0x207fffff22bd04fa; + __m128i_out = __lsx_vbitclr_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0xfffefffefffefffe; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000014; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000014; + *((unsigned long *)&__m128i_op1[1]) = 0x0001000101010001; + *((unsigned long *)&__m128i_op1[0]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000014; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000014; + __m128i_out = __lsx_vbitclr_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x000000000000ffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000100000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0001000100000000; + *((unsigned long *)&__m128i_op1[1]) = 0x6363636363636363; + *((unsigned long *)&__m128i_op1[0]) = 0x6363636363636363; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000000; + *((unsigned long *)&__m128i_result[0]) = 0x0001000100000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x00007fff7fff8000; + *((unsigned long *)&__m128i_op1[1]) = 0x00000000b81c8382; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000077af9450; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x00007efe7f7f8000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0001000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0001000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000000000667ae56; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000020; + *((unsigned long *)&__m128i_op1[1]) = 0x00000000000004ff; + *((unsigned long *)&__m128i_op1[0]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x000000000667ae56; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000020; + __m128i_out = __lsx_vbitclr_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclr_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitclri.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitclri.c new file mode 100644 index 000000000..5d7d66e06 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitclri.c @@ -0,0 +1,279 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vbitclri_h (__m128i_op0, 0xc); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000b0000000b; + *((unsigned long *)&__m128i_op0[0]) = 0x000201000000000b; + *((unsigned long *)&__m128i_result[1]) = 0x0000000b0000000b; + *((unsigned long *)&__m128i_result[0]) = 0x000201000000000b; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x4); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x004200a000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x004200a000200000; + *((unsigned long *)&__m128i_result[1]) = 0x004200a000000000; + *((unsigned long *)&__m128i_result[0]) = 0x004200a000200000; + __m128i_out = __lsx_vbitclri_h (__m128i_op0, 0x4); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x00000000efffffff; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x1c); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000002ff5; + *((unsigned long *)&__m128i_op0[0]) = 0xc2cf2471e9b7d7a4; + *((unsigned long *)&__m128i_result[1]) = 0x00000000000027f5; + *((unsigned long *)&__m128i_result[0]) = 0xc2cf2471e9b7d7a4; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0xb); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7505443065413aed; + *((unsigned long *)&__m128i_op0[0]) = 0x0100d6effefd0498; + *((unsigned long *)&__m128i_result[1]) = 0x7404443064403aec; + *((unsigned long *)&__m128i_result[0]) = 0x0000d6eefefc0498; + __m128i_out = __lsx_vbitclri_b (__m128i_op0, 0x0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x9); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x36); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x64b680a2ae3af8ca; + *((unsigned long *)&__m128i_op0[0]) = 0x161c0c363c200826; + *((unsigned long *)&__m128i_result[1]) = 0x64b680a2ae3af8c8; + *((unsigned long *)&__m128i_result[0]) = 0x161c0c363c200824; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffffffffffffffe; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xbfffbfffbfffbffe; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_h (__m128i_op0, 0xe); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xff807f807f807f80; + *((unsigned long *)&__m128i_op0[0]) = 0xff807f807f807f80; + *((unsigned long *)&__m128i_result[1]) = 0xfb807b807b807b80; + *((unsigned long *)&__m128i_result[0]) = 0xfb807b807b807b80; + __m128i_out = __lsx_vbitclri_b (__m128i_op0, 0x2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x1000100010001000; + *((unsigned long *)&__m128i_op0[0]) = 0x1000100010001000; + *((unsigned long *)&__m128i_result[1]) = 0x1000100010001000; + *((unsigned long *)&__m128i_result[0]) = 0x1000100010001000; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x4); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x19); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_h (__m128i_op0, 0x3); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xfbffffffffffffff; + *((unsigned long *)&__m128i_result[0]) = 0xfbffffffffffffff; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x3a); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x9941d1d5f4ba9d08; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x9941d155f43a9d08; + __m128i_out = __lsx_vbitclri_h (__m128i_op0, 0x7); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xffffffbfffffffbf; + *((unsigned long *)&__m128i_result[0]) = 0xffffffbfffffffbf; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x6); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x03f1e3d28b1a8a1a; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x03f1e3d28b1a8a1a; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x5); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffda6f; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffe3d7; + *((unsigned long *)&__m128i_result[1]) = 0xfefffffffeffda6f; + *((unsigned long *)&__m128i_result[0]) = 0xfefffffffeffe3d7; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x18); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x26); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x30); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000040; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000040; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000040; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000040; + __m128i_out = __lsx_vbitclri_b (__m128i_op0, 0x4); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x8080808080638063; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x8080808080638063; + __m128i_out = __lsx_vbitclri_h (__m128i_op0, 0x8); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0004000400040004; + *((unsigned long *)&__m128i_op0[0]) = 0x0004000400040004; + *((unsigned long *)&__m128i_result[1]) = 0x0004000400040004; + *((unsigned long *)&__m128i_result[0]) = 0x0004000400040004; + __m128i_out = __lsx_vbitclri_h (__m128i_op0, 0xd); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x1c); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000005; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000005; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x13); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_b (__m128i_op0, 0x6); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x19); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x11); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_d (__m128i_op0, 0x5); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000800000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_w (__m128i_op0, 0x3); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000200008; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000200000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000200008; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000200000; + __m128i_out = __lsx_vbitclri_b (__m128i_op0, 0x0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_b (__m128i_op0, 0x5); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000200000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0002000200000001; + *((unsigned long *)&__m128i_result[1]) = 0x0000000200000000; + *((unsigned long *)&__m128i_result[0]) = 0x0002000200000001; + __m128i_out = __lsx_vbitclri_b (__m128i_op0, 0x7); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xdfdfdfdfdfdfdfdf; + *((unsigned long *)&__m128i_result[0]) = 0xdfdfdfdfdfdfdfdf; + __m128i_out = __lsx_vbitclri_b (__m128i_op0, 0x5); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitclri_h (__m128i_op0, 0xb); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitrev.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitrev.c new file mode 100644 index 000000000..ba4f4b6dc --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitrev.c @@ -0,0 +1,407 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x1b71a083b3dec3cd; + *((unsigned long *)&__m128i_op1[0]) = 0x373a13323b4cdbc1; + *((unsigned long *)&__m128i_result[1]) = 0x0802010808400820; + *((unsigned long *)&__m128i_result[0]) = 0x8004080408100802; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000800000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vbitrev_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x8000800080008000; + *((unsigned long *)&__m128i_result[0]) = 0x8000800080008000; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000501000002; + *((unsigned long *)&__m128i_op0[0]) = 0x0001000100000008; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000040100; + *((unsigned long *)&__m128i_op1[0]) = 0x0001000100010000; + *((unsigned long *)&__m128i_result[1]) = 0x0101010400100203; + *((unsigned long *)&__m128i_result[0]) = 0x0103010301020109; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffffffffffffffe; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffbe6ed563; + *((unsigned long *)&__m128i_op1[1]) = 0xd0b1ffffffffffff; + *((unsigned long *)&__m128i_op1[0]) = 0x9d519ee8d2d84f1d; + *((unsigned long *)&__m128i_result[1]) = 0xfefd7f7f7f7f7f7e; + *((unsigned long *)&__m128i_result[0]) = 0xdffdbffeba6f5543; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x7da9b23a624082fd; + *((unsigned long *)&__m128i_op1[0]) = 0x00000000ffff0000; + *((unsigned long *)&__m128i_result[1]) = 0x2002040404010420; + *((unsigned long *)&__m128i_result[0]) = 0x0101010180800101; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000fffe0000ffff; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[0]) = 0x0001ffff0001fffe; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0e7ffffc01fffffc; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000003f803f4; + *((unsigned long *)&__m128i_result[1]) = 0x1000000010000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100100000; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0400040004000400; + *((unsigned long *)&__m128i_op0[0]) = 0x040004000400040d; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0501050105010501; + *((unsigned long *)&__m128i_result[0]) = 0x050105010501050c; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vbitrev_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x000000000000ffff; + *((unsigned long *)&__m128i_op1[1]) = 0x8000000080000000; + *((unsigned long *)&__m128i_op1[0]) = 0x8000000080000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[0]) = 0x000100010001fffe; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffffffefffffffe; + *((unsigned long *)&__m128i_op0[0]) = 0xfffffffefffffffe; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000007f00000000; + *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[0]) = 0x7ffffffeffffffff; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0040000000400000; + *((unsigned long *)&__m128i_op0[0]) = 0x0040000000400000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0141010101410101; + *((unsigned long *)&__m128i_result[0]) = 0x0141010101410101; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x65b780a3ae3bf8cb; + *((unsigned long *)&__m128i_op0[0]) = 0x161d0c363c200826; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x65b780a2ae3bf8ca; + *((unsigned long *)&__m128i_result[0]) = 0x161d0c373c200827; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xff00ff00ff00ff00; + *((unsigned long *)&__m128i_op0[0]) = 0xff00ff00ff00ff00; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xfe01fe01fe01fe01; + *((unsigned long *)&__m128i_result[0]) = 0xfe01fe01fe01fe01; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x000000003bfb4000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0040004000400040; + *((unsigned long *)&__m128i_op1[0]) = 0x0040004000400040; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101; + *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000021ffffffdf; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000100000e60; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x1ff85ffe2ae5d973; + *((unsigned long *)&__m128i_result[1]) = 0x00010020fffeffde; + *((unsigned long *)&__m128i_result[0]) = 0x0100400100200e68; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x00d3012acc56f9bb; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000001021; + *((unsigned long *)&__m128i_result[1]) = 0x0108020410400208; + *((unsigned long *)&__m128i_result[0]) = 0x0101010101010102; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x000000ff0000ff86; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101; + *((unsigned long *)&__m128i_result[0]) = 0x010101fe0101fe87; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x343d8dc5b0ed5a08; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101; + *((unsigned long *)&__m128i_result[0]) = 0x353c8cc4b1ec5b09; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0037ffc8d7ff2800; + *((unsigned long *)&__m128i_op0[0]) = 0xff00ff00ffffff00; + *((unsigned long *)&__m128i_op1[1]) = 0x0038d800ff000000; + *((unsigned long *)&__m128i_op1[0]) = 0x00fffe00fffffe00; + *((unsigned long *)&__m128i_result[1]) = 0x0137ffc9d7fe2801; + *((unsigned long *)&__m128i_result[0]) = 0x7f00ff017fffff01; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000200000002000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001200100012001; + *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000ff00ff; + *((unsigned long *)&__m128i_result[1]) = 0xfffffffefffffffe; + *((unsigned long *)&__m128i_result[0]) = 0xfffffffe7fffffff; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001000100010002; + *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[0]) = 0xfffffffffffffffc; + *((unsigned long *)&__m128i_result[1]) = 0x8000000080000000; + *((unsigned long *)&__m128i_result[0]) = 0x8000000010000000; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffdfffdfffdfffd; + *((unsigned long *)&__m128i_op0[0]) = 0xfffdfffdfffdfffd; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xfffdfffcfffdfffc; + *((unsigned long *)&__m128i_result[0]) = 0xfffdfffcfffdfffc; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0001ffff0101ffff; + *((unsigned long *)&__m128i_op0[0]) = 0x0001ffff0001ffff; + *((unsigned long *)&__m128i_op1[1]) = 0x0001000101010001; + *((unsigned long *)&__m128i_op1[0]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[1]) = 0x0103fefd0303fefd; + *((unsigned long *)&__m128i_result[0]) = 0x0103fefd0103fefd; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000800000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000800000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x6a5d5b056f2f4978; + *((unsigned long *)&__m128i_op1[0]) = 0x17483c07141b5971; + *((unsigned long *)&__m128i_result[1]) = 0x0000002001000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000008000020000; + __m128i_out = __lsx_vbitrev_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xfffefffefffefffe; + *((unsigned long *)&__m128i_result[0]) = 0xfffefffefffefffe; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0x00000001ce28f9c0; + *((unsigned long *)&__m128i_op1[0]) = 0x00000004e06b0890; + *((unsigned long *)&__m128i_result[1]) = 0xfefefefdbffefdfe; + *((unsigned long *)&__m128i_result[0]) = 0xfefefeeffef7fefe; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xff800000ff800000; + *((unsigned long *)&__m128i_op0[0]) = 0xff800000ff800000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_op1[0]) = 0x003ffffe00800000; + *((unsigned long *)&__m128i_result[1]) = 0xff810001ff810002; + *((unsigned long *)&__m128i_result[0]) = 0x7f804000ff810001; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xff1affff01001fe0; + *((unsigned long *)&__m128i_op0[0]) = 0xff1aff6d02834d70; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000034; + *((unsigned long *)&__m128i_result[1]) = 0xfe1bfefe00011ee1; + *((unsigned long *)&__m128i_result[0]) = 0xfe1bfe6c03824c60; + __m128i_out = __lsx_vbitrev_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x41945926d8000000; + *((unsigned long *)&__m128i_op1[1]) = 0x00001e5410082727; + *((unsigned long *)&__m128i_op1[0]) = 0x00007f7f00107f7f; + *((unsigned long *)&__m128i_result[1]) = 0x0001001001000080; + *((unsigned long *)&__m128i_result[0]) = 0x4195d926d8018000; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7f8000007f800000; + *((unsigned long *)&__m128i_op0[0]) = 0x7f8000007f800000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x7f8100017f810001; + *((unsigned long *)&__m128i_result[0]) = 0x7f8100017f810001; + __m128i_out = __lsx_vbitrev_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x545501550001113a; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x8000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0xd45501550001113a; + __m128i_out = __lsx_vbitrev_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitrevi.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitrevi.c new file mode 100644 index 000000000..9739182cd --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitrevi.c @@ -0,0 +1,336 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000003004; + *((unsigned long *)&__m128i_result[1]) = 0x0000400000004000; + *((unsigned long *)&__m128i_result[0]) = 0x0000400000007004; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0xe); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xfeffffffffffffff; + *((unsigned long *)&__m128i_result[0]) = 0xfeffffffffffffff; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x38); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0x0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x4000400040004000; + *((unsigned long *)&__m128i_result[0]) = 0x4000400040004000; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xe); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000000007fff8000; + *((unsigned long *)&__m128i_op0[0]) = 0x0001008100000005; + *((unsigned long *)&__m128i_result[1]) = 0x0800080077ff8800; + *((unsigned long *)&__m128i_result[0]) = 0x0801088108000805; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xb); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0202020202020202; + *((unsigned long *)&__m128i_result[0]) = 0x0202020202020202; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xe86ce7eb5e9ce950; + *((unsigned long *)&__m128i_result[1]) = 0x0404040404040404; + *((unsigned long *)&__m128i_result[0]) = 0xec68e3ef5a98ed54; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000200010; + *((unsigned long *)&__m128i_result[1]) = 0x0000400000004000; + *((unsigned long *)&__m128i_result[0]) = 0x0000400000204010; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0xe); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0400040004000400; + *((unsigned long *)&__m128i_result[0]) = 0x0400040004000400; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xa); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffff02; + *((unsigned long *)&__m128i_result[1]) = 0x0400040004000400; + *((unsigned long *)&__m128i_result[0]) = 0x04000400fbfffb02; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xa); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0010000000100000; + *((unsigned long *)&__m128i_result[0]) = 0x0010000000100000; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0x14); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x000000000000000d; + *((unsigned long *)&__m128i_result[1]) = 0x0400040004000400; + *((unsigned long *)&__m128i_result[0]) = 0x040004000400040d; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xa); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000000004f804f81; + *((unsigned long *)&__m128i_op0[0]) = 0x000000004f804f80; + *((unsigned long *)&__m128i_result[1]) = 0x000000004fc04f81; + *((unsigned long *)&__m128i_result[0]) = 0x000000004fc04f80; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x16); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0040004000400040; + *((unsigned long *)&__m128i_result[0]) = 0x0040004000400040; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0x6); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x1010101010101010; + *((unsigned long *)&__m128i_result[0]) = 0xefefefefefefefef; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x4); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x4040404040404040; + *((unsigned long *)&__m128i_result[0]) = 0x4040404040404040; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x6); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x21201f1e1d1c1b1a; + *((unsigned long *)&__m128i_op0[0]) = 0x1918171615141312; + *((unsigned long *)&__m128i_result[1]) = 0x01203f1e3d1c3b1a; + *((unsigned long *)&__m128i_result[0]) = 0x3918371635143312; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xd); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7ff0000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x61608654a2d4f6da; + *((unsigned long *)&__m128i_result[1]) = 0xfff0800080008000; + *((unsigned long *)&__m128i_result[0]) = 0xe160065422d476da; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xf); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x37c0001000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x37c0001000000000; + *((unsigned long *)&__m128i_result[1]) = 0x77c0401040004000; + *((unsigned long *)&__m128i_result[0]) = 0x77c0401040004000; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xe); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x77c0404a4000403a; + *((unsigned long *)&__m128i_op0[0]) = 0x77c03fd640003fc6; + *((unsigned long *)&__m128i_result[1]) = 0x75c0404a4200403a; + *((unsigned long *)&__m128i_result[0]) = 0x75c03fd642003fc6; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0x19); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x3); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_op0[0]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[1]) = 0x0808080808280808; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808280808; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x15); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xfffffefffffffeff; + *((unsigned long *)&__m128i_result[0]) = 0x00000100fffffeff; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0x8); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000010000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000010000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0404050404040404; + *((unsigned long *)&__m128i_result[0]) = 0x0404050404040404; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x1000100010001000; + *((unsigned long *)&__m128i_result[0]) = 0x1000100010001000; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xc); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xbfbfbfbfbfbfbfbf; + *((unsigned long *)&__m128i_result[0]) = 0xbfbfbfbfbfbfbfbf; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x6); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000040000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000040000000; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x1e); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000020000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000020000; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x11); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x2000200020002000; + *((unsigned long *)&__m128i_result[0]) = 0x2000200020002000; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0xd); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x441ba9fcffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x181b2541ffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x401fadf8fbfbfbfb; + *((unsigned long *)&__m128i_result[0]) = 0x1c1f2145fbfbfbfb; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000100; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000100; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x8); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffff00000000; + *((unsigned long *)&__m128i_result[1]) = 0xffffefff00001000; + *((unsigned long *)&__m128i_result[0]) = 0xffffefff00001000; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0xc); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x8080808080808080; + *((unsigned long *)&__m128i_result[0]) = 0x8080808080808080; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x7); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000200000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000200000000; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x21); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000002000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000002000; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0xd); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000010000000100; + *((unsigned long *)&__m128i_result[0]) = 0x0000010000000100; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0x8); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xd6a09e662ab46b31; + *((unsigned long *)&__m128i_op0[0]) = 0x34b8122ef4054bb3; + *((unsigned long *)&__m128i_result[1]) = 0xd6e09e262af46b71; + *((unsigned long *)&__m128i_result[0]) = 0x34f8126ef4454bf3; + __m128i_out = __lsx_vbitrevi_h (__m128i_op0, 0x6); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000008; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000200008; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000200000; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x15); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfefefefdbffefdfe; + *((unsigned long *)&__m128i_op0[0]) = 0xfefefeeffef7feff; + *((unsigned long *)&__m128i_result[1]) = 0xfcfcfcffbdfcfffc; + *((unsigned long *)&__m128i_result[0]) = 0xfcfcfcedfcf5fcfd; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000555889; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000002580f01; + *((unsigned long *)&__m128i_result[1]) = 0x0010000000455889; + *((unsigned long *)&__m128i_result[0]) = 0x0010000002480f01; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0x14); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00060fbf00040fbf; + *((unsigned long *)&__m128i_op0[0]) = 0x00020fbf00000fbf; + *((unsigned long *)&__m128i_result[1]) = 0x00060fbf02040fbf; + *((unsigned long *)&__m128i_result[0]) = 0x00020fbf02000fbf; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x19); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000000007fffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x400000003fffffff; + *((unsigned long *)&__m128i_result[0]) = 0x4000000040000000; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0x1e); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x021b7d24c9678a35; + *((unsigned long *)&__m128i_op0[0]) = 0x030298a6a1030a49; + *((unsigned long *)&__m128i_result[1]) = 0x00197f26cb658837; + *((unsigned long *)&__m128i_result[0]) = 0x01009aa4a301084b; + __m128i_out = __lsx_vbitrevi_b (__m128i_op0, 0x1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + int_out = __lsx_vpickve2gr_h (__m128i_op0, 0x3); + *((unsigned long *)&__m128i_op0[1]) = 0x0000c6c60000c6c6; + *((unsigned long *)&__m128i_op0[0]) = 0x8000c6c58000c6b2; + *((unsigned long *)&__m128i_result[1]) = 0x0000c6c40000c6c6; + *((unsigned long *)&__m128i_result[0]) = 0x8000c6c78000c6b2; + __m128i_out = __lsx_vbitrevi_d (__m128i_op0, 0x21); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xffffff7fffffff7f; + *((unsigned long *)&__m128i_result[0]) = 0xffffff7fffffff7f; + __m128i_out = __lsx_vbitrevi_w (__m128i_op0, 0x7); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitsel.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitsel.c new file mode 100644 index 000000000..52ac9939f --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitsel.c @@ -0,0 +1,109 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op2[1]) = 0x0000000000007fff; + *((unsigned long *)&__m128i_op2[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitsel_v (__m128i_op0, __m128i_op1, __m128i_op2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op2[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op2[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitsel_v (__m128i_op0, __m128i_op1, __m128i_op2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000005050000; + *((unsigned long *)&__m128i_op0[0]) = 0x0505000005050505; + *((unsigned long *)&__m128i_op1[1]) = 0x000d02540000007e; + *((unsigned long *)&__m128i_op1[0]) = 0x0000001400140014; + *((unsigned long *)&__m128i_op2[1]) = 0x0505050505050505; + *((unsigned long *)&__m128i_op2[0]) = 0x03574e38e496cbc9; + *((unsigned long *)&__m128i_result[1]) = 0x0005000400000004; + *((unsigned long *)&__m128i_result[0]) = 0x0400001001150404; + __m128i_out = __lsx_vbitsel_v (__m128i_op0, __m128i_op1, __m128i_op2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + int_out = __lsx_vpickve2gr_w (__m128i_op0, 0x2); + *((unsigned long *)&__m128i_op0[1]) = 0x0080001300000013; + *((unsigned long *)&__m128i_op0[0]) = 0x0080001300000013; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op2[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op2[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0080001300000013; + *((unsigned long *)&__m128i_result[0]) = 0x0080001300000013; + __m128i_out = __lsx_vbitsel_v (__m128i_op0, __m128i_op1, __m128i_op2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op2[1]) = 0x43d3e0000013e000; + *((unsigned long *)&__m128i_op2[0]) = 0x43d3e0000013e000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitsel_v (__m128i_op0, __m128i_op1, __m128i_op2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffe0001fffe0001; + *((unsigned long *)&__m128i_op0[0]) = 0xfffe0001fffe0001; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op2[1]) = 0xfffe0001fffe0001; + *((unsigned long *)&__m128i_op2[0]) = 0xfffe0001fffe0001; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitsel_v (__m128i_op0, __m128i_op1, __m128i_op2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffffacdb6dbecac; + *((unsigned long *)&__m128i_op0[0]) = 0x1f5533a694f902c0; + *((unsigned long *)&__m128i_op1[1]) = 0x62cbf96e4acfaf40; + *((unsigned long *)&__m128i_op1[0]) = 0xf0bc9a5278285a4a; + *((unsigned long *)&__m128i_op2[1]) = 0xfffffacdb6dbecac; + *((unsigned long *)&__m128i_op2[0]) = 0x1f5533a694f902c0; + *((unsigned long *)&__m128i_result[1]) = 0x62cbf84c02cbac00; + *((unsigned long *)&__m128i_result[0]) = 0x1014120210280240; + __m128i_out = __lsx_vbitsel_v (__m128i_op0, __m128i_op1, __m128i_op2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffff59; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op2[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op2[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffff59; + __m128i_out = __lsx_vbitsel_v (__m128i_op0, __m128i_op1, __m128i_op2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitseli.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitseli.c new file mode 100644 index 000000000..f2d6fb042 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitseli.c @@ -0,0 +1,84 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0xfffcfffcfffcfffc; + *((unsigned long *)&__m128i_op0[0]) = 0xfffcfffcfffcfffc; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x6664666466646664; + *((unsigned long *)&__m128i_result[0]) = 0x6664666466646664; + __m128i_out = __lsx_vbitseli_b (__m128i_op0, __m128i_op1, 0x66); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xfffffffffffffff7; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffff00000001; + *((unsigned long *)&__m128i_op1[0]) = 0xffffff0000010000; + *((unsigned long *)&__m128i_result[1]) = 0xffffffff00000001; + *((unsigned long *)&__m128i_result[0]) = 0x5d5d5d5d5d5d5d55; + __m128i_out = __lsx_vbitseli_b (__m128i_op0, __m128i_op1, 0x5d); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + int_out = __lsx_vpickve2gr_w (__m128i_op0, 0x2); + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000004; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000004; + *((unsigned long *)&__m128i_result[1]) = 0x5959595959595959; + *((unsigned long *)&__m128i_result[0]) = 0x5959595959595959; + __m128i_out = __lsx_vbitseli_b (__m128i_op0, __m128i_op1, 0x59); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0xfffd000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xfffd000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitseli_b (__m128i_op0, __m128i_op1, 0x3a); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vbitseli_b (__m128i_op0, __m128i_op1, 0xaa); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0b4c600000000002; + *((unsigned long *)&__m128i_op1[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_op1[0]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[0]) = 0x0004280808080808; + __m128i_out = __lsx_vbitseli_b (__m128i_op0, __m128i_op1, 0xa4); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000004000000040; + *((unsigned long *)&__m128i_op0[0]) = 0x00007770ffff9411; + *((unsigned long *)&__m128i_op1[1]) = 0x000000400000004c; + *((unsigned long *)&__m128i_op1[0]) = 0x00007770ffff941d; + *((unsigned long *)&__m128i_result[1]) = 0x000000400000004c; + *((unsigned long *)&__m128i_result[0]) = 0x000047404f4f040d; + __m128i_out = __lsx_vbitseli_b (__m128i_op0, __m128i_op1, 0x4f); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitset.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitset.c new file mode 100644 index 000000000..e05af675e --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitset.c @@ -0,0 +1,371 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vbitset_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vbitset_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffe000ffffe000; + *((unsigned long *)&__m128i_op0[0]) = 0xffffe000ffffe000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xffffe001ffffe001; + *((unsigned long *)&__m128i_result[0]) = 0xffffe001ffffe001; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000038335ca2777; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000800800000; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vbitset_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xf51cf8dad6040188; + *((unsigned long *)&__m128i_op0[0]) = 0x0982e2daf234ed87; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xf51df8dbd6050189; + *((unsigned long *)&__m128i_result[0]) = 0x0983e2dbf235ed87; + __m128i_out = __lsx_vbitset_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfc01fcfefc02fdf7; + *((unsigned long *)&__m128i_op0[0]) = 0xfe00fcfffe01fd01; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffff00000001; + *((unsigned long *)&__m128i_op1[0]) = 0x5d5d5d5d5d5d5d55; + *((unsigned long *)&__m128i_result[1]) = 0xfc01fcfefc02fdf7; + *((unsigned long *)&__m128i_result[0]) = 0xfe00fcfffe21fd01; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000fff7fc01; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffff00000000; + *((unsigned long *)&__m128i_op1[0]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x80000000fff7fc01; + __m128i_out = __lsx_vbitset_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vbitset_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xfffffffe00000004; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101; + *((unsigned long *)&__m128i_result[0]) = 0xffffffff01010105; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x00000001c00ffffe; + *((unsigned long *)&__m128i_op1[0]) = 0x00000001fffffffe; + *((unsigned long *)&__m128i_result[1]) = 0x0101010201808040; + *((unsigned long *)&__m128i_result[0]) = 0x0101010280808040; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x3f8000003f800000; + *((unsigned long *)&__m128i_op0[0]) = 0x3f8000003f800000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x3f8000003f800001; + *((unsigned long *)&__m128i_result[0]) = 0x3f8000003f800001; + __m128i_out = __lsx_vbitset_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x00000000010a000b; + *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[0]) = 0x0001000104000800; + __m128i_out = __lsx_vbitset_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000897957687; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000408; + *((unsigned long *)&__m128i_result[1]) = 0x0000010000000080; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100000100; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0xfffe0001fffe0001; + *((unsigned long *)&__m128i_op1[0]) = 0xfffe0001fffe0001; + *((unsigned long *)&__m128i_result[1]) = 0x0000000200000002; + *((unsigned long *)&__m128i_result[0]) = 0x0000000200000002; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffff994cb09c; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffc3639d96; + *((unsigned long *)&__m128i_op1[1]) = 0x20de27761210386d; + *((unsigned long *)&__m128i_op1[0]) = 0x34632935195a123c; + *((unsigned long *)&__m128i_result[1]) = 0xffffffff994db09c; + *((unsigned long *)&__m128i_result[0]) = 0xffffffffc7639d96; + __m128i_out = __lsx_vbitset_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000545cab1d; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000081a83bea; + *((unsigned long *)&__m128i_op1[1]) = 0x13f9c5b60028a415; + *((unsigned long *)&__m128i_op1[0]) = 0x545cab1d81a83bea; + *((unsigned long *)&__m128i_result[1]) = 0x00400000547cab1d; + *((unsigned long *)&__m128i_result[0]) = 0x2000000081a83fea; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000038003; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000040033; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000008; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100080000; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_op0[0]) = 0x0808080808080808; + *((unsigned long *)&__m128i_op1[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_op1[0]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[1]) = 0x0909090909090909; + *((unsigned long *)&__m128i_result[0]) = 0x0909090909090909; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x00a600e000a600e0; + *((unsigned long *)&__m128i_op1[0]) = 0x01500178010000f8; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000001; + *((unsigned long *)&__m128i_result[0]) = 0x0100000001000000; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101; + *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0xfefbff06fffa0004; + *((unsigned long *)&__m128i_op1[0]) = 0xfefeff04fffd0004; + *((unsigned long *)&__m128i_result[1]) = 0x4008804080040110; + *((unsigned long *)&__m128i_result[0]) = 0x4040801080200110; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101; + *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vbitset_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vbitset_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x8000000080000000; + *((unsigned long *)&__m128i_op0[0]) = 0x8000000080000000; + *((unsigned long *)&__m128i_op1[1]) = 0x8000000080000000; + *((unsigned long *)&__m128i_op1[0]) = 0x8000000080000000; + *((unsigned long *)&__m128i_result[1]) = 0x8101010181010101; + *((unsigned long *)&__m128i_result[0]) = 0x8101010181010101; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000020000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000020000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101030101; + *((unsigned long *)&__m128i_result[0]) = 0x0101010101030101; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vbitset_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000100; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101; + *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xd78cfd70b5f65d76; + *((unsigned long *)&__m128i_op0[0]) = 0x5779108fdedda7e4; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xd78cfd70b5f65d77; + *((unsigned long *)&__m128i_result[0]) = 0x5779108fdedda7e5; + __m128i_out = __lsx_vbitset_d (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000008; + *((unsigned long *)&__m128i_op1[0]) = 0x00004a1e00004a1e; + *((unsigned long *)&__m128i_result[1]) = 0x0000000100000100; + *((unsigned long *)&__m128i_result[0]) = 0x4000000040000000; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0007000000050000; + *((unsigned long *)&__m128i_op1[0]) = 0x0003000100010001; + *((unsigned long *)&__m128i_result[1]) = 0x0080000100200001; + *((unsigned long *)&__m128i_result[0]) = 0x0008000200020002; + __m128i_out = __lsx_vbitset_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffff80ffff7e02; + *((unsigned long *)&__m128i_op0[0]) = 0x00feff8000ff80ff; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x0280000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xffffff81ffff7f03; + *((unsigned long *)&__m128i_result[0]) = 0x04ffff8101ff81ff; + __m128i_out = __lsx_vbitset_b (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x4480000044800000; + *((unsigned long *)&__m128i_op0[0]) = 0x45c0000044800000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x00fe00fe7fffffff; + *((unsigned long *)&__m128i_result[1]) = 0x4481000144810001; + *((unsigned long *)&__m128i_result[0]) = 0x45c04000c4808000; + __m128i_out = __lsx_vbitset_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x3a8000003a800000; + *((unsigned long *)&__m128i_op0[0]) = 0x3bc000003a800000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[0]) = 0x00fe00fe7fffffff; + *((unsigned long *)&__m128i_result[1]) = 0x3a8100013a810001; + *((unsigned long *)&__m128i_result[0]) = 0x7bc04000ba808000; + __m128i_out = __lsx_vbitset_h (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op1[1]) = 0x0000cecd00004657; + *((unsigned long *)&__m128i_op1[0]) = 0x0000c90000011197; + *((unsigned long *)&__m128i_result[1]) = 0x0000200000800000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000100800000; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7f8000007f800000; + *((unsigned long *)&__m128i_op0[0]) = 0x7f8000007f800000; + *((unsigned long *)&__m128i_op1[1]) = 0x7f8000007f800000; + *((unsigned long *)&__m128i_op1[0]) = 0x7f8000007f800000; + *((unsigned long *)&__m128i_result[1]) = 0x7f8000017f800001; + *((unsigned long *)&__m128i_result[0]) = 0x7f8000017f800001; + __m128i_out = __lsx_vbitset_w (__m128i_op0, __m128i_op1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitseti.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitseti.c new file mode 100644 index 000000000..540a724a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vbitseti.c @@ -0,0 +1,279 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0020002000200020; + *((unsigned long *)&__m128i_result[0]) = 0x0020002000200020; + __m128i_out = __lsx_vbitseti_h (__m128i_op0, 0x5); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000ff00ff; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0040000000ff00ff; + *((unsigned long *)&__m128i_result[0]) = 0x0040000000000000; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x36); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x54beed87bc3f2be1; + *((unsigned long *)&__m128i_op0[0]) = 0x8024d8f6a494afcb; + *((unsigned long *)&__m128i_result[1]) = 0x54feed87bc3f2be1; + *((unsigned long *)&__m128i_result[0]) = 0x8064d8f6a494afcb; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x36); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x000000000000c400; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x001000100010c410; + __m128i_out = __lsx_vbitseti_h (__m128i_op0, 0x4); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x2e2b34ca59fa4c88; + *((unsigned long *)&__m128i_op0[0]) = 0x3b2c8aefd44be966; + *((unsigned long *)&__m128i_result[1]) = 0x3e2b34ca59fa4c88; + *((unsigned long *)&__m128i_result[0]) = 0x3b2c8aefd44be966; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x1c); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000017fda829; + *((unsigned long *)&__m128i_result[1]) = 0x0040004000400040; + *((unsigned long *)&__m128i_result[0]) = 0x0040004017fda869; + __m128i_out = __lsx_vbitseti_h (__m128i_op0, 0x6); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x800000ff000000ff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x800000ff080000ff; + *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x1b); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001000000010000; + *((unsigned long *)&__m128i_result[0]) = 0x0001000000010000; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x10); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0004000000040000; + *((unsigned long *)&__m128i_result[0]) = 0x0004000000040000; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x12); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vbitseti_b (__m128i_op0, 0x2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xf51cf8dad6040188; + *((unsigned long *)&__m128i_op0[0]) = 0x0982e2daf234ed87; + *((unsigned long *)&__m128i_result[1]) = 0xf51cf8dad6040188; + *((unsigned long *)&__m128i_result[0]) = 0x0982eadaf234ed87; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x2b); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0002000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0002000000000000; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x31); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000006; + *((unsigned long *)&__m128i_result[1]) = 0x8000000080000000; + *((unsigned long *)&__m128i_result[0]) = 0x8000000080000006; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x1f); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000080000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000080000000000; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x2b); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7fff7fff7fff7fff; + *((unsigned long *)&__m128i_op0[0]) = 0x000000010000003f; + *((unsigned long *)&__m128i_result[1]) = 0x7fff7fff7fff7fff; + *((unsigned long *)&__m128i_result[0]) = 0x000000030000003f; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x1); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xe5e5e5e5e5e5e5e5; + *((unsigned long *)&__m128i_op0[0]) = 0xe5e5e5e5e4e4e46d; + *((unsigned long *)&__m128i_result[1]) = 0xe5e5e5e5e5e5e5e5; + *((unsigned long *)&__m128i_result[0]) = 0xe5e5e5e5e4e4e46d; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x1a); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7fffffff7fffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x7fffffff7fffffff; + *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vbitseti_b (__m128i_op0, 0x0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x1000100010001000; + *((unsigned long *)&__m128i_result[0]) = 0x1000100010001000; + __m128i_out = __lsx_vbitseti_h (__m128i_op0, 0xc); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0800080008000800; + *((unsigned long *)&__m128i_result[0]) = 0x0800080008000800; + __m128i_out = __lsx_vbitseti_h (__m128i_op0, 0xb); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0100000001000000; + *((unsigned long *)&__m128i_result[0]) = 0x0100000001000000; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x18); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000007fff; + *((unsigned long *)&__m128i_result[1]) = 0x2020202020202020; + *((unsigned long *)&__m128i_result[0]) = 0x2020202020207fff; + __m128i_out = __lsx_vbitseti_b (__m128i_op0, 0x5); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000100000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000100013fa0; + *((unsigned long *)&__m128i_result[1]) = 0x0000000900000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000900013fa0; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x23); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x3ff0000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x40f3fa0000000000; + *((unsigned long *)&__m128i_result[1]) = 0x3ff0008000800080; + *((unsigned long *)&__m128i_result[0]) = 0x40f3fa8000800080; + __m128i_out = __lsx_vbitseti_h (__m128i_op0, 0x7); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000ffff0000ffff; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000ffff0000ffff; + *((unsigned long *)&__m128i_result[0]) = 0x0000040000000000; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x2a); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xc000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0404040404040404; + *((unsigned long *)&__m128i_result[0]) = 0xc404040404040404; + __m128i_out = __lsx_vbitseti_b (__m128i_op0, 0x2); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000040804000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000040804000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000040a04000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000040a04000; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x15); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x9); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long *)&__m128i_op0[0]) = 0x1f81e3779b97f4a8; + *((unsigned long *)&__m128i_result[1]) = 0xffffffff02000000; + *((unsigned long *)&__m128i_result[0]) = 0x1f81e3779b97f4a8; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x19); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000008000000080; + *((unsigned long *)&__m128i_result[0]) = 0x0000008000000080; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x7); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[1]) = 0x0100010001000101; + *((unsigned long *)&__m128i_result[0]) = 0x0100010001000101; + __m128i_out = __lsx_vbitseti_h (__m128i_op0, 0x8); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vbitseti_b (__m128i_op0, 0x3); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000010000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000010000000; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x1c); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0002711250a27112; + *((unsigned long *)&__m128i_op0[0]) = 0x00d2701294027112; + *((unsigned long *)&__m128i_result[1]) = 0x080a791a58aa791a; + *((unsigned long *)&__m128i_result[0]) = 0x08da781a9c0a791a; + __m128i_out = __lsx_vbitseti_b (__m128i_op0, 0x3); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0303030303030303; + *((unsigned long *)&__m128i_op0[0]) = 0x0303030303030303; + *((unsigned long *)&__m128i_result[1]) = 0x1313131313131313; + *((unsigned long *)&__m128i_result[0]) = 0x1313131313131313; + __m128i_out = __lsx_vbitseti_b (__m128i_op0, 0x4); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0001000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0001000000000000; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x30); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000002000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000002000000000; + __m128i_out = __lsx_vbitseti_d (__m128i_op0, 0x25); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfff0000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xfff0000000000000; + *((unsigned long *)&__m128i_result[1]) = 0xfff0008000000080; + *((unsigned long *)&__m128i_result[0]) = 0xfff0008000000080; + __m128i_out = __lsx_vbitseti_w (__m128i_op0, 0x7); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vclo.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vclo.c new file mode 100644 index 000000000..2c1099a04 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vclo.c @@ -0,0 +1,266 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0x0000005555555554; + *((unsigned long *)&__m128i_op0[0]) = 0x0000005555555554; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000040; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000040; + __m128i_out = __lsx_vclo_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xe2ecd48adedc7c82; + *((unsigned long *)&__m128i_op0[0]) = 0x25d666472b01d18d; + *((unsigned long *)&__m128i_result[1]) = 0x0303020102020001; + *((unsigned long *)&__m128i_result[0]) = 0x0002000000000201; + __m128i_out = __lsx_vclo_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000fefefe6a; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000c2bac2c2; + *((unsigned long *)&__m128i_result[1]) = 0x0000000007070700; + *((unsigned long *)&__m128i_result[0]) = 0x0000000002010202; + __m128i_out = __lsx_vclo_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x3d3d3d3d3d3d3d3d; + *((unsigned long *)&__m128i_op0[0]) = 0x3d3d3d3d3d3d3d3d; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000007e8a60; + *((unsigned long *)&__m128i_op0[0]) = 0x000000000001edde; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000003; + __m128i_out = __lsx_vclo_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000002000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000002000000020; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x05d0ae6002e8748e; + *((unsigned long *)&__m128i_op0[0]) = 0xcd1de80217374041; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000200000000; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7ff0000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x7ff0000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x000000001fffff59; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vclo_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000000000000aaaa; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_wu (__m128i_op0, 0x2); + *((unsigned long *)&__m128i_op0[1]) = 0xffffe500ffffc085; + *((unsigned long *)&__m128i_op0[0]) = 0xffffc000ffffc005; + *((unsigned long *)&__m128i_result[1]) = 0x0000001300000012; + *((unsigned long *)&__m128i_result[0]) = 0x0000001200000012; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x003fffff00000000; + *((unsigned long *)&__m128i_op0[0]) = 0x003fffff00000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000001000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000001000000000; + __m128i_out = __lsx_vclo_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x7fff7fff7fff7fff; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffc0ff80ff800000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000005; + *((unsigned long *)&__m128i_result[1]) = 0x0000000a00000009; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x8080808080808080; + *((unsigned long *)&__m128i_op0[0]) = 0x8080808080808080; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101; + *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vclo_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000008; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x413e276583869d79; + *((unsigned long *)&__m128i_op0[0]) = 0x7f7f017f9d8726d3; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffffffffffbfffc; + *((unsigned long *)&__m128i_op0[0]) = 0xc090380000000000; + *((unsigned long *)&__m128i_result[1]) = 0x000000200000000d; + *((unsigned long *)&__m128i_result[0]) = 0x0000000200000000; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0001000100010012; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000fec20704; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclo_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffffffffffffff4; + *((unsigned long *)&__m128i_op0[0]) = 0xfffffffffffffff4; + *((unsigned long *)&__m128i_result[1]) = 0x000000200000001c; + *((unsigned long *)&__m128i_result[0]) = 0x000000200000001c; + __m128i_out = __lsx_vclo_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vclz.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vclz.c new file mode 100644 index 000000000..12df2c670 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vclz.c @@ -0,0 +1,265 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x000000ff000000ff; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0010000800100008; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000000001fc1a568; + *((unsigned long *)&__m128i_op0[0]) = 0x02693fe0e7beb077; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000030000; + *((unsigned long *)&__m128i_result[0]) = 0x0006000200000000; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000002000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000002000000020; + __m128i_out = __lsx_vclz_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000002000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000002000000020; + __m128i_out = __lsx_vclz_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000002000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000002000000020; + __m128i_out = __lsx_vclz_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000002000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000002000000020; + __m128i_out = __lsx_vclz_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7f7f000b000b000b; + *((unsigned long *)&__m128i_op0[0]) = 0x000b000b010a000b; + *((unsigned long *)&__m128i_result[1]) = 0x0101080408040804; + *((unsigned long *)&__m128i_result[0]) = 0x0804080407040804; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x1ffffffff8001000; + *((unsigned long *)&__m128i_op0[0]) = 0xf0bd80bd80bd8000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000003; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclz_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000100010000fe7c; + *((unsigned long *)&__m128i_op0[0]) = 0x000100010000fe01; + *((unsigned long *)&__m128i_result[1]) = 0x000f000f00100000; + *((unsigned long *)&__m128i_result[0]) = 0x000f000f00100000; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x41dfffff00000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0100000008080808; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000040; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000040; + __m128i_out = __lsx_vclz_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000040; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000040; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000039; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000039; + __m128i_out = __lsx_vclz_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000002000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000002000000020; + __m128i_out = __lsx_vclz_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00ff000100ff00fe; + *((unsigned long *)&__m128i_op0[0]) = 0x00ff003000ff00a0; + *((unsigned long *)&__m128i_result[1]) = 0x0008000f00080008; + *((unsigned long *)&__m128i_result[0]) = 0x0008000a00080008; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfe813f00fe813f00; + *((unsigned long *)&__m128i_op0[0]) = 0xfe813f00fe813f00; + *((unsigned long *)&__m128i_result[1]) = 0x0000000200000002; + *((unsigned long *)&__m128i_result[0]) = 0x0000000200000002; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000bffffffe; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000040; + __m128i_out = __lsx_vclz_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000c0c00000000; + *((unsigned long *)&__m128i_op0[0]) = 0xfffffffffffffffe; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000014; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vclz_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x6363636363636363; + *((unsigned long *)&__m128i_op0[0]) = 0x6363636363636363; + *((unsigned long *)&__m128i_result[1]) = 0x0101010101010101; + *((unsigned long *)&__m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x687a8373f249bc44; + *((unsigned long *)&__m128i_op0[0]) = 0x7861145d9241a14a; + *((unsigned long *)&__m128i_result[1]) = 0x0101000100010001; + *((unsigned long *)&__m128i_result[0]) = 0x0101030100010001; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000040; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000040; + __m128i_out = __lsx_vclz_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000002000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000002000000020; + __m128i_out = __lsx_vclz_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000001fffffffe; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0808080700000000; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0001000100010001; + *((unsigned long *)&__m128i_op0[0]) = 0x0001000100010001; + *((unsigned long *)&__m128i_result[1]) = 0x0000000f0000000f; + *((unsigned long *)&__m128i_result[0]) = 0x0000000f0000000f; + __m128i_out = __lsx_vclz_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x000000000000001f; + *((unsigned long *)&__m128i_op0[0]) = 0x000000008000001e; + *((unsigned long *)&__m128i_result[1]) = 0x000000200000001b; + *((unsigned long *)&__m128i_result[0]) = 0x0000002000000000; + __m128i_out = __lsx_vclz_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000005; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000005; + *((unsigned long *)&__m128i_result[1]) = 0x0808080808080805; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080805; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0808080808080808; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vclz_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000000000; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vclz_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vpcnt.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vpcnt.c new file mode 100644 index 000000000..66982d89f --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vpcnt.c @@ -0,0 +1,350 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include <lsxintrin.h> + +int +main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i = 1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_hu (__m128i_op0, 0x7); + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffffffffefefefe; + *((unsigned long *)&__m128i_op0[0]) = 0x000000000000ffff; + *((unsigned long *)&__m128i_result[1]) = 0x000000000000003c; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000010; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7f8000007f800000; + *((unsigned long *)&__m128i_op0[0]) = 0x7f8000007f800000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000800000008; + *((unsigned long *)&__m128i_result[0]) = 0x0000000800000008; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7f8000007f800000; + *((unsigned long *)&__m128i_op0[0]) = 0x7f80000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0701000007010000; + *((unsigned long *)&__m128i_result[0]) = 0x0701000000000000; + __m128i_out = __lsx_vpcnt_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x807f7f8000ffff00; + *((unsigned long *)&__m128i_op0[0]) = 0x0000ffff00feff00; + *((unsigned long *)&__m128i_result[1]) = 0x0107070100080800; + *((unsigned long *)&__m128i_result[0]) = 0x0000080800070800; + __m128i_out = __lsx_vpcnt_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x5252525252525252; + *((unsigned long *)&__m128i_op0[0]) = 0x5252525252525252; + *((unsigned long *)&__m128i_result[1]) = 0x0303030303030303; + *((unsigned long *)&__m128i_result[0]) = 0x0303030303030303; + __m128i_out = __lsx_vpcnt_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000100010; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xe0404041e0404041; + *((unsigned long *)&__m128i_op0[0]) = 0x803f800080000000; + *((unsigned long *)&__m128i_result[1]) = 0x000000000000000e; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000009; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0007000000040000; + *((unsigned long *)&__m128i_op0[0]) = 0x0003000000010000; + *((unsigned long *)&__m128i_result[1]) = 0x0003000000010000; + *((unsigned long *)&__m128i_result[0]) = 0x0002000000010000; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x1111111111111111; + *((unsigned long *)&__m128i_op0[0]) = 0x1111111111111111; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000010; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000010; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0ba00ba00ba00ba0; + *((unsigned long *)&__m128i_op0[0]) = 0x0ba00ba00ba011eb; + *((unsigned long *)&__m128i_result[1]) = 0x0000000a0000000a; + *((unsigned long *)&__m128i_result[0]) = 0x0000000a0000000d; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfbfbfb17fbfb38ea; + *((unsigned long *)&__m128i_op0[0]) = 0xfbfb47fbfbfb0404; + *((unsigned long *)&__m128i_result[1]) = 0x000000000000002f; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000029; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xffffbfc0ffffbfc0; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000032; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x21201f1e19181716; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0003000900050007; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000005; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000005; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000002; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000002; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfff0800080008000; + *((unsigned long *)&__m128i_op0[0]) = 0xe160065422d476da; + *((unsigned long *)&__m128i_result[1]) = 0x0000000d00000002; + *((unsigned long *)&__m128i_result[0]) = 0x0000000b00000010; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffff0000ffff0000; + *((unsigned long *)&__m128i_op0[0]) = 0xffff000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000001000000010; + *((unsigned long *)&__m128i_result[0]) = 0x0000001000000000; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000040; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000040; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000010100000101; + *((unsigned long *)&__m128i_op0[0]) = 0x0000010100000101; + *((unsigned long *)&__m128i_result[1]) = 0x0000000200000002; + *((unsigned long *)&__m128i_result[0]) = 0x0000000200000002; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vpcnt_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000020000; + *((unsigned long *)&__m128i_op0[0]) = 0x0103000201030002; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000001; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000008; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xfffffffffffffffc; + *((unsigned long *)&__m128i_op0[0]) = 0xfffffffffffffffc; + *((unsigned long *)&__m128i_result[1]) = 0x000000200000001e; + *((unsigned long *)&__m128i_result[0]) = 0x000000200000001e; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xbbe5560400010001; + *((unsigned long *)&__m128i_op0[0]) = 0xe7e5dabf00010001; + *((unsigned long *)&__m128i_result[1]) = 0x000b000500010001; + *((unsigned long *)&__m128i_result[0]) = 0x000b000c00010001; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0010001000100010; + *((unsigned long *)&__m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long *)&__m128i_op0[0]) = 0x7fffffff7fffffff; + *((unsigned long *)&__m128i_result[1]) = 0x0000002000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000001f0000001f; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x9c9c9c9c9c9c9c9c; + *((unsigned long *)&__m128i_op0[0]) = 0x9c9c9c9c9c9c9c9c; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000020; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000020; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_h (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000600007fff; + *((unsigned long *)&__m128i_op0[0]) = 0x00000008ffffa209; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000011; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000016; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000467fef81; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000013; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_d (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x00000000fe03fe01; + *((unsigned long *)&__m128i_op0[0]) = 0x00000000fe01fe01; + *((unsigned long *)&__m128i_result[1]) = 0x0000000007020701; + *((unsigned long *)&__m128i_result[0]) = 0x0000000007010701; + __m128i_out = __lsx_vpcnt_b (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0x7f80000000000000; + *((unsigned long *)&__m128i_op0[0]) = 0x0000000000000000; + *((unsigned long *)&__m128i_result[1]) = 0x0000000800000000; + *((unsigned long *)&__m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + *((unsigned long *)&__m128i_op0[1]) = 0xf654ad7447e59090; + *((unsigned long *)&__m128i_op0[0]) = 0x27b1b106b8145f50; + *((unsigned long *)&__m128i_result[1]) = 0x000000120000000d; + *((unsigned long *)&__m128i_result[0]) = 0x0000000e0000000e; + __m128i_out = __lsx_vpcnt_w (__m128i_op0); + ASSERTEQ_64 (__LINE__, __m128i_result, __m128i_out); + + return 0; +} -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2