From patchwork Thu Sep 7 07:13:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenxiaolong X-Patchwork-Id: 137622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp2789766vqo; Thu, 7 Sep 2023 00:20:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAUU++/ERbkBoBcqCx+sDXb9Cvd3DaTYXcKVKWyGH9qJWbxPyUuNAuseE0tL3/Z8uPdruK X-Received: by 2002:a17:906:2209:b0:9a2:295a:9bc5 with SMTP id s9-20020a170906220900b009a2295a9bc5mr4906349ejs.21.1694071239902; Thu, 07 Sep 2023 00:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694071239; cv=none; d=google.com; s=arc-20160816; b=yMgNr/9WISzWp5f7RXwv5KGWF2MHWWP1GGlfe7nUPjjMSG4lj9svpB8XJrWWEXhpu2 b+mgUZ7ntq2fe6tc2I3hkz2ApLFjzmybqRT4qsbocPA2zaU0LSQPbjhmNqEG8s9obsIt RMuTsbpuT7fT4xYzBsMd2t+XTOKj0eXam1c2udeNCebaB6lQXtJDKTCajoyvjC2DlTfG 0pBrwG1VVoDNYtdZWAekkKRXOhSjctj9GI4d5MT+XavuqYEAQoo7L0jVP6ZGt1Kf2gwo vprb90/ZdWRBcs1LcMrmghScqKzzav1wATr7vJMeE99x5QFH23XKpoLknMf9FC/VLgZ4 /0VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dmarc-filter:delivered-to; bh=qI1Kuboyhmh08fujIX6KMUTZnuHSCFGwgPSKKPyho2s=; fh=BpFCyCzVJo4znJIvOjeDfKzcGsF6Q+JgJbJ+1ev/kM4=; b=IZgmHMZXBdaKcvOaQOIzheSBvYgJwQMuuxvI8KU2XQUIwvxkKNS15Yz0FmmgoEY8IA ng4ojgrC8TzFLuwSvTYcMnuTtYIF/81wZgAGeA7HQy8mzXBr83SQ8GfQ87kZxv1LcP6A x/cIUbHH+u5JRlixkRDMEfP7+w9wRi8wLmeKV9Sn/xY/xelZ7GZxv2ZMoArkY/8mtt8F xd+8/sUPyJpwDI01hEYCyAVqu2HMxbWH1F2LMRf4RWpsx4JU+HF0IQCEZf6m6UoNjzmu tcUP2P7ZL+gYYh6Lj097IBAZuZjtIXq6cjDyDHSjPO6ibBH+9WRUsMrCquNiO+Iwzx1a 2mcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j18-20020a170906279200b0099364d9f0easi10142865ejc.479.2023.09.07.00.20.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 00:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 795AA388267C for ; Thu, 7 Sep 2023 07:15:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id F0E5F3889E13 for ; Thu, 7 Sep 2023 07:13:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F0E5F3889E13 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.10.130.252]) by gateway (Coremail) with SMTP id _____8BxnusnePlk1ichAA--.63759S3; Thu, 07 Sep 2023 15:13:43 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxDc8eePlkeDVwAA--.7050S5; Thu, 07 Sep 2023 15:13:42 +0800 (CST) From: Xiaolong Chen To: gcc-patches@gcc.gnu.org Subject: [PATCH v1 2/4] LoongArch:Add vector subtraction arithmetic operation SX instruction. Date: Thu, 7 Sep 2023 15:13:09 +0800 Message-Id: <20230907071311.23302-2-chenxiaolong@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230907071311.23302-1-chenxiaolong@loongson.cn> References: <20230907071311.23302-1-chenxiaolong@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxDc8eePlkeDVwAA--.7050S5 X-CM-SenderInfo: hfkh05xldrz0tqj6z05rqj20fqof0/1tbiAQAHBWT5TbUBhwAAsg X-Coremail-Antispam: 1Uk129KBj9DXoWkKr1kJFy7Zw4UuFy3Gw1DCFX_yoW8KFy7Ar g_JFnxJFykWF4SvrnrXr1DZr98uw4UXanF9a1UAF1qq3Wktw18Ca45AFyIvr17Jw1DZ3Wr ZFyDZry8Crn8GF1UKosvyTuYvTs0mTUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1T uYvTs0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9f nUUIcSsGvfJTRUUUb28YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4 v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E 14v26r4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44 I27wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2 jsIE14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20x vY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I 3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIx AIcVC0I7IYx2IY67AKxVW8JVW5JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAI cVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2js IEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07j8CztUUUUU= X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xiaolong Chen , xuchenghua@loongson.cn, chenglulu@loongson.cn, i@xen0n.name Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776362444679615369 X-GMAIL-MSGID: 1776362444679615369 gcc/testsuite/ChangeLog: * gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vhsubw-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmsub.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vssub-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vssub-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vsub.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vsubi.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vsubwev-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vsubwod-2.c: New test. --- .../loongarch/vector/lsx/lsx-vhsubw-1.c | 326 +++++++++++++ .../loongarch/vector/lsx/lsx-vhsubw-2.c | 352 ++++++++++++++ .../loongarch/vector/lsx/lsx-vmsub.c | 460 ++++++++++++++++++ .../loongarch/vector/lsx/lsx-vssub-1.c | 397 +++++++++++++++ .../loongarch/vector/lsx/lsx-vssub-2.c | 407 ++++++++++++++++ .../loongarch/vector/lsx/lsx-vsub.c | 380 +++++++++++++++ .../loongarch/vector/lsx/lsx-vsubi.c | 328 +++++++++++++ .../loongarch/vector/lsx/lsx-vsubwev-1.c | 325 +++++++++++++ .../loongarch/vector/lsx/lsx-vsubwev-2.c | 416 ++++++++++++++++ .../loongarch/vector/lsx/lsx-vsubwod-1.c | 325 +++++++++++++ .../loongarch/vector/lsx/lsx-vsubwod-2.c | 307 ++++++++++++ 11 files changed, 4023 insertions(+) create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsub.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsub.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubi.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-2.c diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c new file mode 100644 index 00000000000..8f7bbc0ad2d --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-1.c @@ -0,0 +1,326 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x00000000fffffc00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000010000; + __m128i_out = __lsx_vhsubw_h_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]) = 0x00007f8000007f80; + *((unsigned long*)& __m128i_op1[0]) = 0x00007f8000007f80; + *((unsigned long*)& __m128i_result[1]) = 0x0000008000000080; + *((unsigned long*)& __m128i_result[0]) = 0x0000008000000080; + __m128i_out = __lsx_vhsubw_h_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]) = 0xffffffffffffff00; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff07effffe; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010000; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100110002; + __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_wu(__m128i_op0,0x2); + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ffffff01; + *((unsigned long*)& __m128i_op0[0]) = 0xffffeff400000df4; + *((unsigned long*)& __m128i_op1[1]) = 0x0000006f00001f0a; + *((unsigned long*)& __m128i_op1[0]) = 0x0000958affff995d; + *((unsigned long*)& __m128i_result[1]) = 0x0000ff91fffffff5; + *((unsigned long*)& __m128i_result[0]) = 0xffff00650001ffb0; + __m128i_out = __lsx_vhsubw_h_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]) = 0x0000bfffffffe0f6; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000010001000a; + __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x41dfffffffc00000; + *((unsigned long*)& __m128i_op0[0]) = 0xbff0000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0008000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0101010101010101; + *((unsigned long*)& __m128i_result[1]) = 0x0039ffffffff0000; + *((unsigned long*)& __m128i_result[0]) = 0xffbeffffffffffff; + __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op0[0]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000008140c80; + *((unsigned long*)& __m128i_result[1]) = 0x0037ffdfffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0037ffdfffeb007f; + __m128i_out = __lsx_vhsubw_h_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_vhsubw_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x98147a504d145000; + *((unsigned long*)& __m128i_op0[0]) = 0x377b810912c0e000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x4e3e133738bb47d2; + *((unsigned long*)& __m128i_result[1]) = 0xff98007a004d0050; + *((unsigned long*)& __m128i_result[0]) = 0xfff9ff4a0057000e; + __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000501ffff0005; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000600000001; + __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00020000ffff0001; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100000001; + __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000ffae001effae; + *((unsigned long*)& __m128i_op0[0]) = 0x001effae001effae; + *((unsigned long*)& __m128i_op1[1]) = 0x5252525252525252; + *((unsigned long*)& __m128i_op1[0]) = 0x5252525252525252; + *((unsigned long*)& __m128i_result[1]) = 0xffaeffadffaeffad; + *((unsigned long*)& __m128i_result[0]) = 0xffaeffadffaeffad; + __m128i_out = __lsx_vhsubw_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000201000000000b; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000fc0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000200000000; + __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffff01ff01; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffff02; + __m128i_out = __lsx_vhsubw_w_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]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000; + __m128i_out = __lsx_vhsubw_w_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_vhsubw_w_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]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vhsubw_w_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]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffff01; + __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x9727b8499727b849; + *((unsigned long*)& __m128i_op0[0]) = 0x12755900b653f081; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x7d7f13fc7c7ffbf4; + *((unsigned long*)& __m128i_result[1]) = 0xffff9727ffff9727; + *((unsigned long*)& __m128i_result[0]) = 0xfffffe79ffffba5f; + __m128i_out = __lsx_vhsubw_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000100010; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000100010; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vhsubw_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000006f00001f0a; + *((unsigned long*)& __m128i_op0[0]) = 0x0000958affff995d; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000100c6ffef10c; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffff70; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff9001a47e; + __m128i_out = __lsx_vhsubw_d_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]) = 0x00000000000000a6; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffff59; + __m128i_out = __lsx_vhsubw_d_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]) = 0x0000000400000004; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000400000004; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffc; + __m128i_out = __lsx_vhsubw_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000001; + *((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]) = 0x0000000100000001; + __m128i_out = __lsx_vhsubw_q_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]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000; + __m128i_out = __lsx_vhsubw_q_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_vhsubw_q_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_vhsubw_q_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]) = 0x002affd600000001; + *((unsigned long*)& __m128i_op1[0]) = 0xcbc2723a4f12a5f8; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x343d8dc5b0ed5a08; + __m128i_out = __lsx_vhsubw_q_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_vhsubw_q_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]) = 0x00000000ffff53d9; + *((unsigned long*)& __m128i_op1[0]) = 0xffff0001ffff9515; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000fffe00006aea; + __m128i_out = __lsx_vhsubw_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000455555555; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x000003fe0000141e; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffc01ffffebe2; + __m128i_out = __lsx_vhsubw_q_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_vhsubw_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op0[0]) = 0xc8847ef6ed3f2000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000002000000020; + *((unsigned long*)& __m128i_op1[0]) = 0x0000001f0000001f; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x67eb8590b2ebafe1; + __m128i_out = __lsx_vhsubw_q_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]) = 0x56a09e662ab46b31; + *((unsigned long*)& __m128i_op1[0]) = 0xb4b8122ef4054bb3; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x4b47edd10bfab44d; + __m128i_out = __lsx_vhsubw_q_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-vhsubw-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-2.c new file mode 100644 index 00000000000..927ecac59a0 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vhsubw-2.c @@ -0,0 +1,352 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0xffffffff00000001; + *((unsigned long*)& __m128i_op0[0]) = 0xffffff0000010000; + *((unsigned long*)& __m128i_op1[1]) = 0xfe00fe00fe00fd01; + *((unsigned long*)& __m128i_op1[0]) = 0xfe00fffefe0100f6; + *((unsigned long*)& __m128i_result[1]) = 0x00ff00ff0000ffff; + *((unsigned long*)& __m128i_result[0]) = 0x00ff0001ffffff0a; + __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000017161515; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000095141311; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x76f424887fffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000170014; + *((unsigned long*)& __m128i_result[0]) = 0xff0cff78ff96ff14; + __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xff7cffd6ffc700b0; + __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00ff00ff00ff00ff; + __m128i_out = __lsx_vhsubw_hu_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000ffff0000ffff; + __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00ffff0000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00ffff0000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x7f8000007f800000; + *((unsigned long*)& __m128i_op1[0]) = 0x7f80000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000000ff00000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000ff00000000; + __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000020; + *((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_vhsubw_wu_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffff0001ffff0001; + *((unsigned long*)& __m128i_result[0]) = 0xffff0001ffff0001; + __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0101010101010101; + *((unsigned long*)& __m128i_op0[0]) = 0x0101010101010101; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000010100000101; + *((unsigned long*)& __m128i_result[0]) = 0x0000010100000101; + __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfefeff00fefeff00; + *((unsigned long*)& __m128i_op0[0]) = 0xfefeff00fefeff00; + *((unsigned long*)& __m128i_op1[1]) = 0x8080808080808080; + *((unsigned long*)& __m128i_op1[0]) = 0x8080808080808080; + *((unsigned long*)& __m128i_result[1]) = 0x00007e7e00007e7e; + *((unsigned long*)& __m128i_result[0]) = 0x00007e7e00007e7e; + __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xa2e3a36363636363; + *((unsigned long*)& __m128i_op0[0]) = 0xa2e3a36463636363; + *((unsigned long*)& __m128i_op1[1]) = 0x7f8000007f800000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000a2e300006363; + *((unsigned long*)& __m128i_result[0]) = 0x0000a2e300006363; + __m128i_out = __lsx_vhsubw_wu_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x52527d7d52527d7d; + *((unsigned long*)& __m128i_op0[0]) = 0x52527d7d52527d7d; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000052527d7d; + *((unsigned long*)& __m128i_result[0]) = 0x0000000052527d7d; + __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000002400180004; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000024; + __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffff02; + *((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_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000001; + *((unsigned long*)& __m128i_op0[0]) = 0xffffff0000010000; + *((unsigned long*)& __m128i_op1[1]) = 0xabff54f1ffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xa5f7458b000802ff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000fff7fc01; + __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff00000002; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000002; + __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000800000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000800000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000014eb54ab; + *((unsigned long*)& __m128i_op0[0]) = 0x14eb6a002a406a00; + *((unsigned long*)& __m128i_op1[1]) = 0xffff80008a7555aa; + *((unsigned long*)& __m128i_op1[0]) = 0x0a7535006af05cf9; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff758aaa56; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffa9fb0d07; + __m128i_out = __lsx_vhsubw_du_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000000; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffff01ff01; + *((unsigned long*)& __m128i_op1[1]) = 0x0f180000ffe00000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000001ca02f854; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100013fa0; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000001ca02f854; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100013fa0; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000004b01; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffb4ff; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00001b4a00007808; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffe4b5ffff87f8; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3fc03fc000000003; + *((unsigned long*)& __m128i_op0[0]) = 0x7f7f1fd800000004; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x3fc03fc000000004; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xc080800000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xc080800000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x7efefefe82010201; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x418181017dfefdff; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op0[0]) = 0xc8847ef6ed3f2000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x67eb85afb2ebb000; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff800000ff800000; + *((unsigned long*)& __m128i_op0[0]) = 0xe593c8c4e593c8c4; + *((unsigned long*)& __m128i_op1[1]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ff8000010f78; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xff7f0080ff7ef088; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000155; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000000f0000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffff10000; + __m128i_out = __lsx_vhsubw_qu_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsub.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsub.c new file mode 100644 index 00000000000..af71b6f2d8c --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsub.c @@ -0,0 +1,460 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_h(__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]) = 0xfeffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xfeffffffffff0002; + *((unsigned long*)& __m128i_op2[1]) = 0x54beed87bc3f2be1; + *((unsigned long*)& __m128i_op2[0]) = 0x8024d8f6a494afcb; + *((unsigned long*)& __m128i_result[1]) = 0xa8beed87bc3f2be1; + *((unsigned long*)& __m128i_result[0]) = 0x0024d8f6a494006a; + __m128i_out = __lsx_vmsub_b(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000fc0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_wu(__m128i_op0,0x3); + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000ffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_op2[1]) = 0x0000ffff00000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_result[1]) = 0x0001ffff00000000; + *((unsigned long*)& __m128i_result[0]) = 0x0001ffff0001ffff; + __m128i_out = __lsx_vmsub_w(__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]) = 0x0001000100000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_b(__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]) = 0x0000000000200010; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0xfffffff0ffe04000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000001fc0000; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000200010; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000200010; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + 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_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0400040004000400; + *((unsigned long*)& __m128i_result[0]) = 0x040004000400040d; + __m128i_out = __lsx_vmsub_w(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xb327b9363c99d32e; + *((unsigned long*)& __m128i_op0[0]) = 0xa1e7b475d925730f; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000003f80b0; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ff800000; + *((unsigned long*)& __m128i_op2[1]) = 0x00007f8000007f80; + *((unsigned long*)& __m128i_op2[0]) = 0x00007f8000007f80; + *((unsigned long*)& __m128i_result[1]) = 0xb327b9363c992b2e; + *((unsigned long*)& __m128i_result[0]) = 0xa1e7b475d925730f; + __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00ff000000ff0000; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffff800; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00ff000000ff0000; + __m128i_out = __lsx_vmsub_b(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0002000200020002; + *((unsigned long*)& __m128i_op0[0]) = 0x0002000200020002; + *((unsigned long*)& __m128i_op1[1]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op1[0]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op2[1]) = 0x000000004c7f4c7f; + *((unsigned long*)& __m128i_op2[0]) = 0xe0c0c0c0d1c7d1c6; + *((unsigned long*)& __m128i_result[1]) = 0x061006100613030c; + *((unsigned long*)& __m128i_result[0]) = 0x4d6814ef9c77ce46; + __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x7ffe7ffe7ffe7ffe; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000002bfd9461; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000f00; + *((unsigned long*)& __m128i_op2[0]) = 0x00000000ffffff00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000002bfd9461; + __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3727f00000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xc7e01fcfe0000000; + *((unsigned long*)& __m128i_op1[1]) = 0x3727112c00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x39201f7120000040; + *((unsigned long*)& __m128i_op2[1]) = 0x00007fff00007fff; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xe5b9012c00000000; + *((unsigned long*)& __m128i_result[0]) = 0xc7e01fcfe0000000; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000004; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffff0204; + *((unsigned long*)& __m128i_op1[1]) = 0x0000442900007b4c; + *((unsigned long*)& __m128i_op1[0]) = 0x0000e22b0000efa4; + *((unsigned long*)& __m128i_op2[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000442800007b50; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffff0204; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op2[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op2[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffefffffffe; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000002f; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000029; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000003a24; + *((unsigned long*)& __m128i_op2[0]) = 0x003dbe88077c78c1; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000002f; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000029; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x7f8000007f800000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x7f8000007f800000; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xff0000007f800000; + __m128i_out = __lsx_vmsub_d(__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]) = 0x0fff0fff0fff0fff; + *((unsigned long*)& __m128i_op1[0]) = 0x0fff0fff0fff0fff; + *((unsigned long*)& __m128i_op2[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op2[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0fff0fff0fff0fff; + *((unsigned long*)& __m128i_result[0]) = 0x0fff0fff0fff0fff; + __m128i_out = __lsx_vmsub_d(__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]) = 0x0000003f0000ffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffc3ffff003e; + *((unsigned long*)& __m128i_op2[1]) = 0x0000003f0000ffff; + *((unsigned long*)& __m128i_op2[0]) = 0xffffffc3ffff003e; + *((unsigned long*)& __m128i_result[1]) = 0x0000f07f0000ffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffff177fffff0fc; + __m128i_out = __lsx_vmsub_h(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffbfffefffc9510; + *((unsigned long*)& __m128i_op0[0]) = 0xfffbfffefffc9510; + *((unsigned long*)& __m128i_op1[1]) = 0x0c0b0a090b0a0908; + *((unsigned long*)& __m128i_op1[0]) = 0x0a09080709080706; + *((unsigned long*)& __m128i_op2[1]) = 0xfffbfffefffc9510; + *((unsigned long*)& __m128i_op2[0]) = 0xfffbfffefffc9510; + *((unsigned long*)& __m128i_result[1]) = 0x29c251319c3a5c90; + *((unsigned long*)& __m128i_result[0]) = 0x62fb9272df7da6b0; + __m128i_out = __lsx_vmsub_d(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_b(__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]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_d(__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]) = 0x8f8f8f8f8f8f8f8f; + *((unsigned long*)& __m128i_op1[0]) = 0x8f8f8f8f8f8f8f8f; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op0[0]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op2[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op2[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x800000007fffffff; + *((unsigned long*)& __m128i_result[0]) = 0x800000007fffffff; + __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000010000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000010000000000; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000010000000000; + __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000001400000014; + *((unsigned long*)& __m128i_op0[0]) = 0x0000001400000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000053a4f452; + *((unsigned long*)& __m128i_result[1]) = 0x0000001400000014; + *((unsigned long*)& __m128i_result[0]) = 0x0000001400000000; + __m128i_out = __lsx_vmsub_b(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00680486ffffffda; + *((unsigned long*)& __m128i_op0[0]) = 0xffff913bfffffffd; + *((unsigned long*)& __m128i_op1[1]) = 0x00680486ffffffda; + *((unsigned long*)& __m128i_op1[0]) = 0xffff913bfffffffd; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x000000003ddc5dac; + *((unsigned long*)& __m128i_result[1]) = 0x00680486ffffffda; + *((unsigned long*)& __m128i_result[0]) = 0xffff913bb9951901; + __m128i_out = __lsx_vmsub_w(__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]) = 0x0000002000000020; + *((unsigned long*)& __m128i_op2[0]) = 0x0000001f0000001f; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_w(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_b(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0021b761002c593c; + *((unsigned long*)& __m128i_op0[0]) = 0x002584710016cc56; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000001e03; + *((unsigned long*)& __m128i_result[1]) = 0x0021b761002c593c; + *((unsigned long*)& __m128i_result[0]) = 0x002584710016ea59; + __m128i_out = __lsx_vmsub_h(__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]) = 0x0000000000000290; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000290; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_h(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op2[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op2[0]) = 0x0002000400000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[0]) = 0x0003000500000001; + __m128i_out = __lsx_vmsub_w(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000001700000017; + *((unsigned long*)& __m128i_op0[0]) = 0x59f7fd8759f7fd87; + *((unsigned long*)& __m128i_op1[1]) = 0x0000ffae001effae; + *((unsigned long*)& __m128i_op1[0]) = 0x001effae001effae; + *((unsigned long*)& __m128i_op2[1]) = 0x0000001700000017; + *((unsigned long*)& __m128i_op2[0]) = 0x59f7fd8759f7fd87; + *((unsigned long*)& __m128i_result[1]) = 0xfd200ed2fd370775; + *((unsigned long*)& __m128i_result[0]) = 0x96198318780e32c5; + __m128i_out = __lsx_vmsub_d(__m128i_op0,__m128i_op1,__m128i_op2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0004000400040004; + *((unsigned long*)& __m128i_op0[0]) = 0x0004000400040004; + *((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]) = 0x0004000400040004; + *((unsigned long*)& __m128i_result[0]) = 0x0004000400040004; + __m128i_out = __lsx_vmsub_w(__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]) = 0xfe3bfb01fe3bfe01; + *((unsigned long*)& __m128i_op2[0]) = 0xfe03fe3ffe01fa21; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmsub_w(__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-vssub-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-1.c new file mode 100644 index 00000000000..b4bcfaa137e --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-1.c @@ -0,0 +1,397 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vssub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00001801f0307f80; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00001801f0307f80; + __m128i_out = __lsx_vssub_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]) = 0xfffffffff8f8dada; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff01018888; + *((unsigned long*)& __m128i_result[1]) = 0x0101010108082626; + *((unsigned long*)& __m128i_result[0]) = 0x01010101ffff7878; + __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00fe000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xfe80000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x027e0000000000ff; + __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffb4ff; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffff98dea; + *((unsigned long*)& __m128i_op1[1]) = 0x3ff0000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x40f3fa0000000000; + *((unsigned long*)& __m128i_result[1]) = 0xc00fffffffffb4ff; + *((unsigned long*)& __m128i_result[0]) = 0xbf0c05fffff98dea; + __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000002f; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000029; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffff00; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffff00; + *((unsigned long*)& __m128i_result[1]) = 0x010101010101012f; + *((unsigned long*)& __m128i_result[0]) = 0x0101010101010129; + __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1000100010001000; + *((unsigned long*)& __m128i_op0[0]) = 0x1000100010001000; + *((unsigned long*)& __m128i_op1[1]) = 0xfefefefefefefefe; + *((unsigned long*)& __m128i_op1[0]) = 0xfefefefefefefefe; + *((unsigned long*)& __m128i_result[1]) = 0x1202120212021202; + *((unsigned long*)& __m128i_result[0]) = 0x1202120212021202; + __m128i_out = __lsx_vssub_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]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_result[0]) = 0x00ff00ff00ff00ff; + __m128i_out = __lsx_vssub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0fffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x8000800080008000; + *((unsigned long*)& __m128i_op1[0]) = 0x41957fff7fff7fff; + *((unsigned long*)& __m128i_result[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_result[0]) = 0xbf6b810181018101; + __m128i_out = __lsx_vssub_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]) = 0xfff8ffa2fffdffb0; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ff800000; + *((unsigned long*)& __m128i_result[1]) = 0x0108015e01030150; + *((unsigned long*)& __m128i_result[0]) = 0x00000000017f0000; + __m128i_out = __lsx_vssub_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_vssub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x007fffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x007fffff00000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xf436f3f52f4ef4a8; + *((unsigned long*)& __m128i_op1[1]) = 0xff80000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xff80000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0080000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xf4b6f3f52f4ef4a8; + __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000fe00ff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffff01ff01; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000101fd01fe; + __m128i_out = __lsx_vssub_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]) = 0x0040004000400040; + *((unsigned long*)& __m128i_op1[0]) = 0x0040004000400040; + *((unsigned long*)& __m128i_result[1]) = 0xffc0ffc0ffc0ffc0; + *((unsigned long*)& __m128i_result[0]) = 0xffc0ffc0ffc0ffc0; + __m128i_out = __lsx_vssub_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_vssub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff010181010102; + *((unsigned long*)& __m128i_op0[0]) = 0x7fffffff81010102; + *((unsigned long*)& __m128i_op1[1]) = 0x003f0000ffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x003f0000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x7fc0010181020103; + *((unsigned long*)& __m128i_result[0]) = 0x7fc0ffff81020103; + __m128i_out = __lsx_vssub_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_vssub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000001e03; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000011e04; + __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x6363636363abdf16; + *((unsigned long*)& __m128i_op0[0]) = 0x41f8e08016161198; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000246d9755; + *((unsigned long*)& __m128i_op1[0]) = 0x000000002427c2ee; + *((unsigned long*)& __m128i_result[1]) = 0x636363633f3e47c1; + *((unsigned long*)& __m128i_result[0]) = 0x41f8e080f1ef4eaa; + __m128i_out = __lsx_vssub_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]) = 0x0001fffe00014b41; + *((unsigned long*)& __m128i_op1[0]) = 0x0001fffe0001ffde; + *((unsigned long*)& __m128i_result[1]) = 0xffff0002ffffb4bf; + *((unsigned long*)& __m128i_result[0]) = 0xffff0002ffff0022; + __m128i_out = __lsx_vssub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000001fc0000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000002010; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000001fbdff0; + __m128i_out = __lsx_vssub_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_vssub_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_vssub_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x03f1e3d28b1a8a1a; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000001d5d4; + *((unsigned long*)& __m128i_op1[0]) = 0x000000150d707009; + *((unsigned long*)& __m128i_result[1]) = 0x00000000fffe2a2c; + *((unsigned long*)& __m128i_result[0]) = 0x03f1e3bd80000000; + __m128i_out = __lsx_vssub_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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vssub_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]) = 0xffd5002affffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x343d8dc6b0ed5a08; + *((unsigned long*)& __m128i_result[1]) = 0x002affd600000001; + *((unsigned long*)& __m128i_result[0]) = 0xcbc2723a4f12a5f8; + __m128i_out = __lsx_vssub_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000001; + *((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_vssub_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffff7ffffffffe; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000fffffffe; + *((unsigned long*)& __m128i_op1[1]) = 0xffffff7ffffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000fffffffe; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_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_vssub_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]) = 0x0000002000000020; + *((unsigned long*)& __m128i_op1[0]) = 0x0000002000000020; + *((unsigned long*)& __m128i_result[1]) = 0xffffffdfffffffe0; + *((unsigned long*)& __m128i_result[0]) = 0xffffffdfffffffe0; + __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000c2f90000bafa; + *((unsigned long*)& __m128i_op1[1]) = 0x0000c2f90000bafa; + *((unsigned long*)& __m128i_op1[0]) = 0x8000c2fa8000c2fa; + *((unsigned long*)& __m128i_result[1]) = 0xffff3d06ffff4506; + *((unsigned long*)& __m128i_result[0]) = 0x7ffffffe7ffff800; + __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffff3fffffff3; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffff3fffffff3; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfffffff3fffffff4; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff3fffffff4; + __m128i_out = __lsx_vssub_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]) = 0x7ef8000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x8108000000000000; + __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000063b2ac27; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffaa076aeb; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffff53d9; + *((unsigned long*)& __m128i_op1[0]) = 0xffff0001ffff9515; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff63b3584e; + *((unsigned long*)& __m128i_result[0]) = 0x0000fffdaa07d5d6; + __m128i_out = __lsx_vssub_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffff81; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000005; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffff7c; + __m128i_out = __lsx_vssub_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_vssub_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]) = 0xff7cffd6ffc700b0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x008300290038ff50; + __m128i_out = __lsx_vssub_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]) = 0x00000000c0dec4d1; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff3f213b2f; + __m128i_out = __lsx_vssub_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-vssub-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-2.c new file mode 100644 index 00000000000..d5d11fab0f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vssub-2.c @@ -0,0 +1,407 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x7f801fa06451ef11; + *((unsigned long*)& __m128i_op0[0]) = 0x68bcf93435ed25ed; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffb64c; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000003900; + *((unsigned long*)& __m128i_result[0]) = 0x68bcf93435ed25ed; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x460f3b393ef4be3a; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x04e00060ffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x04e00060ffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x04e00060ffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x04e00060ffffffff; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x004200a000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x004200a000200001; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000000001c; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000000001c; + *((unsigned long*)& __m128i_result[1]) = 0x004200a000000000; + *((unsigned long*)& __m128i_result[0]) = 0x004200a000200000; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0c03e17edd781b11; + *((unsigned long*)& __m128i_op0[0]) = 0x342caf9be5579ebe; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000000f909; + *((unsigned long*)& __m128i_result[1]) = 0x0c03e17edd781b11; + *((unsigned long*)& __m128i_result[0]) = 0x342caf9be55700b5; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000200010; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000200010; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x11000f2010000e20; + *((unsigned long*)& __m128i_op0[0]) = 0x0f000d200e000c20; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x11000f2010000e20; + *((unsigned long*)& __m128i_result[0]) = 0x0f000d200e000c20; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x001ffff0003ffff0; + *((unsigned long*)& __m128i_op0[0]) = 0x000fffefffefffef; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x001ffff0003ffff0; + *((unsigned long*)& __m128i_result[0]) = 0x000fffefffefffef; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000014; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000014; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000005; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000005; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x4e3e13368c17f6e6; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000005; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1111311111114111; + *((unsigned long*)& __m128i_op0[0]) = 0x1111311111112111; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000007fff; + *((unsigned long*)& __m128i_result[1]) = 0x1111311111114111; + *((unsigned long*)& __m128i_result[0]) = 0x1111311111110000; + __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfefefefefefefefe; + *((unsigned long*)& __m128i_op0[0]) = 0xfefefefefefefefe; + *((unsigned long*)& __m128i_op1[1]) = 0x0002000200020002; + *((unsigned long*)& __m128i_op1[0]) = 0x0202fe02fd020102; + *((unsigned long*)& __m128i_result[1]) = 0xfefcfefcfefcfefc; + *((unsigned long*)& __m128i_result[0]) = 0xfcfc00fc01fcfdfc; + __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x00004000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xbfd10d0d7b6b6b73; + *((unsigned long*)& __m128i_op0[0]) = 0xc5c53492f25acbf2; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000f3040705; + *((unsigned long*)& __m128i_result[1]) = 0xbfd10d0d7b6b6b73; + *((unsigned long*)& __m128i_result[0]) = 0xc5c534920000c4ed; + __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000200; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000200; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffff0000; + *((unsigned long*)& __m128i_op1[0]) = 0x00ff000000ff0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_op0[0]) = 0x00ff00ff000000ff; + *((unsigned long*)& __m128i_op1[1]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_op1[0]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_result[1]) = 0x00ff000000ff0000; + *((unsigned long*)& __m128i_result[0]) = 0x00ff000000000000; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xc14eef7fc14ea000; + *((unsigned long*)& __m128i_op1[0]) = 0x000ea000010fa101; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + int_out = __lsx_vpickve2gr_b(__m128i_op0,0xb); + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000bd3d; + *((unsigned long*)& __m128i_op0[0]) = 0x000000007fff0000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000c7fff000c; + *((unsigned long*)& __m128i_op1[0]) = 0x1000100010001000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000006ffef000; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffc2ffe700000007; + *((unsigned long*)& __m128i_op0[0]) = 0x0000ffc100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x41dfffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xbde2ffe800000007; + *((unsigned long*)& __m128i_result[0]) = 0x0000ffc100010001; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000f3040705; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00000000f3040705; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xa000308000008002; + *((unsigned long*)& __m128i_op1[0]) = 0x0500847b00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffffff; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x4f4f4f4f4f4f4f4f; + *((unsigned long*)& __m128i_op1[0]) = 0x4f4f4f4f4f4f4f4f; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000ff000000ff00; + *((unsigned long*)& __m128i_op1[1]) = 0x3fffff0000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x3fffff0000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x006f0efe258ca851; + *((unsigned long*)& __m128i_op1[1]) = 0x0000006f00001f0a; + *((unsigned long*)& __m128i_op1[0]) = 0x0000958affff995d; + *((unsigned long*)& __m128i_result[1]) = 0xffffff90ffffe0f5; + *((unsigned long*)& __m128i_result[0]) = 0x006e7973258d0ef4; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ca02f854; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000d0000000d; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x6363635663636356; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000080; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000080; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000080; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000080; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vssub_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsub.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsub.c new file mode 100644 index 00000000000..41b75c05fa6 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsub.c @@ -0,0 +1,380 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vsub_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]) = 0x000000000000ff02; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000000001fe; + __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffe000ffffe000; + *((unsigned long*)& __m128i_op0[0]) = 0xc6ffe000c6fde000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x8080808080808081; + *((unsigned long*)& __m128i_result[1]) = 0xffffe000ffffe000; + *((unsigned long*)& __m128i_result[0]) = 0x467f6080467d607f; + __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000010000; + *((unsigned long*)& __m128i_op0[0]) = 0x00ff00ff00fe00ff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000010000; + *((unsigned long*)& __m128i_result[0]) = 0x00ff00fe00fe00ff; + __m128i_out = __lsx_vsub_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_vsub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff00007fff0000; + *((unsigned long*)& __m128i_op0[0]) = 0x7fff00007fff0000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x7fff00007fff0000; + *((unsigned long*)& __m128i_result[0]) = 0x7fff00007fff0000; + __m128i_out = __lsx_vsub_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_vsub_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_vsub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000c0dec4d1; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000040223c2e; + __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfd200ed2fd370775; + *((unsigned long*)& __m128i_op0[0]) = 0x96198318780e32c5; + *((unsigned long*)& __m128i_op1[1]) = 0xffffe65ecc1be5bc; + *((unsigned long*)& __m128i_op1[0]) = 0xffffe65ecc1be5bc; + *((unsigned long*)& __m128i_result[1]) = 0xfe212874311c22b9; + *((unsigned long*)& __m128i_result[0]) = 0x971a9dbaacf34d09; + __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_wu(__m128i_op0,0x0); + *((unsigned long*)& __m128i_op0[1]) = 0x4f4f4f4f4f4f4f4f; + *((unsigned long*)& __m128i_op0[0]) = 0x4f4f4f4f4f4f4f4f; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x4f4f4f4f4f4f4f4f; + *((unsigned long*)& __m128i_result[0]) = 0x4f4f4f4f4f4f4f4f; + __m128i_out = __lsx_vsub_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0404038383838404; + *((unsigned long*)& __m128i_op0[0]) = 0x0404038383838404; + *((unsigned long*)& __m128i_op1[1]) = 0xf000e001bf84df83; + *((unsigned long*)& __m128i_op1[0]) = 0xfff8e001ff84e703; + *((unsigned long*)& __m128i_result[1]) = 0x14042382c3ffa481; + *((unsigned long*)& __m128i_result[0]) = 0x040c238283ff9d01; + __m128i_out = __lsx_vsub_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]) = 0x0141010101410101; + *((unsigned long*)& __m128i_op1[0]) = 0x0141010101410101; + *((unsigned long*)& __m128i_result[1]) = 0xfebffefffebffeff; + *((unsigned long*)& __m128i_result[0]) = 0xfebffefffebffeff; + __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1111111111111111; + *((unsigned long*)& __m128i_op0[0]) = 0x1111111111111111; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x1111111111111111; + *((unsigned long*)& __m128i_result[0]) = 0x1111111111111111; + __m128i_out = __lsx_vsub_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_vsub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffefffefffefffe; + *((unsigned long*)& __m128i_op0[0]) = 0xfffefffefffefffe; + *((unsigned long*)& __m128i_op1[1]) = 0x000700000004fdff; + *((unsigned long*)& __m128i_op1[0]) = 0x000300000000fdff; + *((unsigned long*)& __m128i_result[1]) = 0xfff7fffefffa01ff; + *((unsigned long*)& __m128i_result[0]) = 0xfffbfffefffe01ff; + __m128i_out = __lsx_vsub_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]) = 0x0001000000010000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000cd630000cd63; + *((unsigned long*)& __m128i_result[1]) = 0xffff0000ffff0000; + *((unsigned long*)& __m128i_result[0]) = 0x0000329d0000329d; + __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x08080807f7f7f7f8; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000202020200; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000100; + *((unsigned long*)& __m128i_result[1]) = 0x08080805f5f5f5f8; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ff00; + __m128i_out = __lsx_vsub_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]) = 0x00060eb000000006; + *((unsigned long*)& __m128i_op1[0]) = 0x0000075c00000cf0; + *((unsigned long*)& __m128i_result[1]) = 0xfffaf1500000fffa; + *((unsigned long*)& __m128i_result[0]) = 0x0000f8a40000f310; + __m128i_out = __lsx_vsub_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffff100fffc; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000200000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffdf100fffc; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsub_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_vsub_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000007f7f7f7f; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffff0; + *((unsigned long*)& __m128i_result[1]) = 0x000000007f7f7f7f; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000010; + __m128i_out = __lsx_vsub_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_vsub_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000800000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000800000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000800000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000800000000000; + __m128i_out = __lsx_vsub_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_vsub_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00001802041b0013; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x00001802041b0014; + __m128i_out = __lsx_vsub_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffff000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x000f7d1000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x773324887fffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfff082efffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x88cbdb7780000001; + __m128i_out = __lsx_vsub_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_vsub_q(__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]) = 0x0000000001f50000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffe0b0000; + __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[1]) = 0xfff0000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xfff0000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000fffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0010000000000001; + __m128i_out = __lsx_vsub_q(__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_vsub_q(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000800080; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000b; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000800080; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000b; + __m128i_out = __lsx_vsub_q(__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_vsub_q(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffeb; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffeb; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000014; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000015; + __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0007000000050000; + *((unsigned long*)& __m128i_op0[0]) = 0x0003000100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0001fffe0001fefc; + *((unsigned long*)& __m128i_result[1]) = 0x0006000100040001; + *((unsigned long*)& __m128i_result[0]) = 0x00010002ffff0105; + __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000003fffffffd; + *((unsigned long*)& __m128i_op0[0]) = 0x00000003fffffffd; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00000003fffffffe; + *((unsigned long*)& __m128i_result[0]) = 0x00000003fffffffd; + __m128i_out = __lsx_vsub_q(__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_vsub_q(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000feff23560000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000fd1654860000; + *((unsigned long*)& __m128i_op1[1]) = 0x6363636363abdf16; + *((unsigned long*)& __m128i_op1[0]) = 0x41f8e08016161198; + *((unsigned long*)& __m128i_result[1]) = 0x9c9d9b9bbfaa20e9; + *((unsigned long*)& __m128i_result[0]) = 0xbe081c963e6fee68; + __m128i_out = __lsx_vsub_q(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubi.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubi.c new file mode 100644 index 00000000000..cda4ffd52f1 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubi.c @@ -0,0 +1,328 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0xfff489b693120950; + *((unsigned long*)& __m128i_op0[0]) = 0xfffc45a851c40c18; + *((unsigned long*)& __m128i_result[1]) = 0xe0d56a9774f3ea31; + *((unsigned long*)& __m128i_result[0]) = 0xe0dd268932a5edf9; + __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x1f); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffff88; + *((unsigned long*)& __m128i_result[1]) = 0xe5e5e5e5e5e5e5e5; + *((unsigned long*)& __m128i_result[0]) = 0xe5e5e5e5e4e4e46d; + __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x1b); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000897957687; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000408; + *((unsigned long*)& __m128i_result[1]) = 0xf7f7f7ff8e8c6d7e; + *((unsigned long*)& __m128i_result[0]) = 0xf7f7f7f7f7f7fbff; + __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + int_out = __lsx_vpickve2gr_w(__m128i_op0,0x1); + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xe6e6e6e6e6e6e6e6; + *((unsigned long*)& __m128i_result[0]) = 0xe6e6e6e6e6e6e6e6; + __m128i_out = __lsx_vsubi_bu(__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]) = 0xf8f8f8f8f8f8f8f8; + *((unsigned long*)& __m128i_result[0]) = 0xf8f8f8f8f8f8f8f8; + __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x8); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x2e34594c3b000000; + *((unsigned long*)& __m128i_result[1]) = 0xe9e9e9e9e9e9e9e9; + *((unsigned long*)& __m128i_result[0]) = 0x171d423524e9e9e9; + __m128i_out = __lsx_vsubi_bu(__m128i_op0,0x17); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffe2ffe2ffe2ffe2; + *((unsigned long*)& __m128i_result[0]) = 0xffe2ffe2ffe2ffe2; + __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x1e); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x9795698585057dec; + *((unsigned long*)& __m128i_op0[0]) = 0x87f82867431a1d08; + *((unsigned long*)& __m128i_result[1]) = 0x9780697084f07dd7; + *((unsigned long*)& __m128i_result[0]) = 0x87e3285243051cf3; + __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x15); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffcfffcfffcfffc; + *((unsigned long*)& __m128i_result[0]) = 0xfffcfffcfffcfffc; + __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000101; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffcfffcfffc00fd; + *((unsigned long*)& __m128i_result[0]) = 0xfffcfffcfffcfffc; + __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x371fe00000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x371fe00000000000; + *((unsigned long*)& __m128i_result[1]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_result[0]) = 0x370bdfecffecffec; + __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x14); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000040600000406; + *((unsigned long*)& __m128i_op0[0]) = 0x020202020202fe02; + *((unsigned long*)& __m128i_result[1]) = 0xfff503fbfff503fb; + *((unsigned long*)& __m128i_result[0]) = 0x01f701f701f7fdf7; + __m128i_out = __lsx_vsubi_hu(__m128i_op0,0xb); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfffdfffdfffdfffd; + *((unsigned long*)& __m128i_result[0]) = 0xfffdfffdfffdfffd; + __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x803e0000803e0000; + *((unsigned long*)& __m128i_op0[0]) = 0x803e0000803e0000; + *((unsigned long*)& __m128i_result[1]) = 0x803bfffd803bfffd; + *((unsigned long*)& __m128i_result[0]) = 0x803bfffd803bfffd; + __m128i_out = __lsx_vsubi_hu(__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]) = 0xfffdfffdfffdfffd; + *((unsigned long*)& __m128i_result[0]) = 0xfffdfffdfffdfffd; + __m128i_out = __lsx_vsubi_hu(__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]) = 0xffedffedffedffed; + *((unsigned long*)& __m128i_result[0]) = 0xffedffedffedffed; + __m128i_out = __lsx_vsubi_hu(__m128i_op0,0x13); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffe4ffe4ffe4ffe4; + *((unsigned long*)& __m128i_result[0]) = 0xffe4ffe4ffe4ffe4; + __m128i_out = __lsx_vsubi_hu(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubi_wu(__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]) = 0xffffffefffffffef; + *((unsigned long*)& __m128i_result[0]) = 0xffffffefffffffef; + __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffe6ffffffe6; + *((unsigned long*)& __m128i_result[0]) = 0xffffffe6ffffffe6; + __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x19); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffff1fffffff1; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff1fffffff1; + __m128i_out = __lsx_vsubi_wu(__m128i_op0,0xf); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfffffff6fffffff6; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff6fffffff6; + __m128i_out = __lsx_vsubi_wu(__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]) = 0xffffffe4ffffffe4; + *((unsigned long*)& __m128i_result[0]) = 0xffffffe4ffffffe4; + __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x1c); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffe1ffffffe1; + *((unsigned long*)& __m128i_result[0]) = 0xffffffe1ffffffe1; + __m128i_out = __lsx_vsubi_wu(__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]) = 0xfffffff1fffffff1; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff1fffffff1; + __m128i_out = __lsx_vsubi_wu(__m128i_op0,0xf); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffab7e71e33848; + *((unsigned long*)& __m128i_result[1]) = 0xffffffe1ffffffe1; + *((unsigned long*)& __m128i_result[0]) = 0xffffab5f71e33829; + __m128i_out = __lsx_vsubi_wu(__m128i_op0,0x1f); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xa8beed87bc3f2be1; + *((unsigned long*)& __m128i_op0[0]) = 0x0024d8f6a494006a; + *((unsigned long*)& __m128i_result[1]) = 0xa8beed87bc3f2bd3; + *((unsigned long*)& __m128i_result[0]) = 0x0024d8f6a494005c; + __m128i_out = __lsx_vsubi_du(__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]) = 0xffffffffffffffeb; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffeb; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x15); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffe1; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffe1; + __m128i_out = __lsx_vsubi_du(__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]) = 0xfffffffffffffff7; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff7; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffe5; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffe5; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x1a); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xf2f2e5e5e5e5e5e5; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xf2f2e5e5e5e5e5dc; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff7; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3fffff0000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x3fffff0000000000; + *((unsigned long*)& __m128i_result[1]) = 0x3ffffeffffffffe5; + *((unsigned long*)& __m128i_result[0]) = 0x3ffffeffffffffe5; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x1b); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000007b; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000070; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff5; + __m128i_out = __lsx_vsubi_du(__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]) = 0xfffffffffffffff0; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff0; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x10); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffe6; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffe6; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x1a); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x000100010000fffb; + *((unsigned long*)& __m128i_result[0]) = 0x000100010000fffb; + __m128i_out = __lsx_vsubi_du(__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]) = 0xffffffffffffffeb; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffeb; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x15); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffa; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffa; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfffdfffe80008000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffe2; + *((unsigned long*)& __m128i_result[0]) = 0xfffdfffe80007fe2; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x1e); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x001a001a001a001a; + *((unsigned long*)& __m128i_op0[0]) = 0x001a001a001a001a; + *((unsigned long*)& __m128i_result[1]) = 0x001a001a001a000b; + *((unsigned long*)& __m128i_result[0]) = 0x001a001a001a000b; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0xf); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000234545b; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000c0dec4d1; + *((unsigned long*)& __m128i_result[1]) = 0x0000000002345454; + *((unsigned long*)& __m128i_result[0]) = 0x00000000c0dec4ca; + __m128i_out = __lsx_vsubi_du(__m128i_op0,0x7); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0f8d33000f8d3300; + *((unsigned long*)& __m128i_op0[0]) = 0x0003b80000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0f8d33000f8d32fd; + *((unsigned long*)& __m128i_result[0]) = 0x0003b7fffffffffd; + __m128i_out = __lsx_vsubi_du(__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_vsubi_du(__m128i_op0,0x0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c new file mode 100644 index 00000000000..f181389badb --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-1.c @@ -0,0 +1,325 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x43d3e0000013e000; + *((unsigned long*)& __m128i_op0[0]) = 0x43d3e0000013e000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffd3000000130000; + *((unsigned long*)& __m128i_result[0]) = 0xffd3000000130000; + __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ffff53d9; + *((unsigned long*)& __m128i_op0[0]) = 0xffff0001ffff9515; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x000100010000ffda; + *((unsigned long*)& __m128i_result[0]) = 0x0000000200000016; + __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffbfbfbfc0; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffbfbfbfc0; + *((unsigned long*)& __m128i_op1[1]) = 0x4040404040404040; + *((unsigned long*)& __m128i_op1[0]) = 0x4040404040404040; + *((unsigned long*)& __m128i_result[1]) = 0xffbfffbfff7fff80; + *((unsigned long*)& __m128i_result[0]) = 0xffbfffbfff7fff80; + __m128i_out = __lsx_vsubwev_h_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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000808000020200; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000ff8000020000; + __m128i_out = __lsx_vsubwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x413e276583869d79; + *((unsigned long*)& __m128i_op0[0]) = 0x7f7f017f9d8726d3; + *((unsigned long*)& __m128i_op1[1]) = 0x7c7cd2eb63637c52; + *((unsigned long*)& __m128i_op1[0]) = 0x82ffd2210127add2; + *((unsigned long*)& __m128i_result[1]) = 0xffc2007aff230027; + *((unsigned long*)& __m128i_result[0]) = 0x0080005eff600001; + __m128i_out = __lsx_vsubwev_h_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]) = 0xffffffffffffffee; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000011ff040; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010012; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffe1ffc0; + __m128i_out = __lsx_vsubwev_h_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_vsubwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000004000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffc000000000; + __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000d; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000d; + __m128i_out = __lsx_vsubwev_w_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_vsubwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000ffff00; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000100c6ffef10c; + *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffff01; + *((unsigned long*)& __m128i_result[0]) = 0xffffeff400000df4; + __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000002050320; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000002050320; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000001c88bf0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000320; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000007730; + __m128i_out = __lsx_vsubwev_w_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_vsubwev_w_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]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000005; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000005; + __m128i_out = __lsx_vsubwev_w_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_vsubwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000001030103; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000103; + __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x33eac9fdca42f660; + *((unsigned long*)& __m128i_op0[0]) = 0xaa472d26fe867091; + *((unsigned long*)& __m128i_op1[1]) = 0x33eac9fdca42f660; + *((unsigned long*)& __m128i_op1[0]) = 0xaa472d26fe867091; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vsubwev_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000208000002080; + *((unsigned long*)& __m128i_op0[0]) = 0x0000208000002080; + *((unsigned long*)& __m128i_op1[1]) = 0x0000208000002080; + *((unsigned long*)& __m128i_op1[0]) = 0x0000208000002080; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000004; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000004; + __m128i_out = __lsx_vsubwev_d_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]) = 0x000000ff0000857a; + *((unsigned long*)& __m128i_op1[0]) = 0x05fafe0101fe000e; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffff7a86; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffe01fff2; + __m128i_out = __lsx_vsubwev_d_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]) = 0xf654ad7447e59090; + *((unsigned long*)& __m128i_op1[0]) = 0x27b1b106b8145f50; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffb81a6f70; + *((unsigned long*)& __m128i_result[0]) = 0x0000000047eba0b0; + __m128i_out = __lsx_vsubwev_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000c01020d8009; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000003004; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000c01020d5005; + __m128i_out = __lsx_vsubwev_q_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]) = 0x0000000000fe00ff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffff01ff01; + __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000d; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000000000d; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x4f804f804f804f80; + *((unsigned long*)& __m128i_op0[0]) = 0x4f804f804f804f80; + *((unsigned long*)& __m128i_op1[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x4f804f804f804f80; + __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xb9fe3640e4eb1b18; + *((unsigned long*)& __m128i_op0[0]) = 0x800000005b4b1b18; + *((unsigned long*)& __m128i_op1[1]) = 0xffffb9fe00003640; + *((unsigned long*)& __m128i_op1[0]) = 0xffffe4eb00001b18; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x80001b155b4b0000; + __m128i_out = __lsx_vsubwev_q_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]) = 0x0000000100000008; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100080000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffefff80000; + __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x3fc03fc000000004; + *((unsigned long*)& __m128i_op1[1]) = 0x3fc03fc000000003; + *((unsigned long*)& __m128i_op1[0]) = 0x7f7f1fd800000004; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xc0411fe800000000; + __m128i_out = __lsx_vsubwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff00e400ff00e400; + *((unsigned long*)& __m128i_op0[0]) = 0xff01e41ffff0e440; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffefffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffefffffffe; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xff01e420fff0e442; + __m128i_out = __lsx_vsubwev_q_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_vsubwev_q_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-vsubwev-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-2.c new file mode 100644 index 00000000000..29d73c81683 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwev-2.c @@ -0,0 +1,416 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vsubwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00ff00ff00000083; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000004; + *((unsigned long*)& __m128i_result[1]) = 0xff01ff010000ff7d; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000fffc; + __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1000100010001000; + *((unsigned long*)& __m128i_op0[0]) = 0x1000100010001000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0xffff00fc0000ff02; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000ffff; + *((unsigned long*)& __m128i_result[0]) = 0xff01ff040000fffe; + __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffacdb6dbecac; + *((unsigned long*)& __m128i_op0[0]) = 0x1f5533a694f902c0; + *((unsigned long*)& __m128i_op1[1]) = 0x21011f3f193d173b; + *((unsigned long*)& __m128i_op1[0]) = 0xff39ff37ff35ff33; + *((unsigned long*)& __m128i_result[1]) = 0x00fe008e009e0071; + *((unsigned long*)& __m128i_result[0]) = 0x001c006f00c4008d; + __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x9c9ca19d509ae734; + *((unsigned long*)& __m128i_op0[0]) = 0xd1b09480f2123460; + *((unsigned long*)& __m128i_op1[1]) = 0x9c9c9c9c9c9c9c9c; + *((unsigned long*)& __m128i_op1[0]) = 0x9c9c9c9c9c9c9c9c; + *((unsigned long*)& __m128i_result[1]) = 0x00000001fffeff98; + *((unsigned long*)& __m128i_result[0]) = 0x0014ffe4ff76ffc4; + __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x34947b4b11684f92; + *((unsigned long*)& __m128i_op1[0]) = 0xee297a731e5c5f86; + *((unsigned long*)& __m128i_result[1]) = 0xff6cffb5ff98ff6e; + *((unsigned long*)& __m128i_result[0]) = 0xffd7ff8dffa4ff7a; + __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffff8f8dada; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff01018888; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffff3ea5016b; + *((unsigned long*)& __m128i_op1[0]) = 0xfffefffe3f6fb04d; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000d96f; + *((unsigned long*)& __m128i_result[0]) = 0x00000001ffffd83b; + __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000f0009d3c; + *((unsigned long*)& __m128i_op0[0]) = 0x000000016fff9d3d; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000bd0; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000000007f0; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000916c; + *((unsigned long*)& __m128i_result[0]) = 0x000000010000954d; + __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000100010000fe01; + *((unsigned long*)& __m128i_op1[1]) = 0x000000050000007b; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000500000005; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffbffffff85; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffc0000fdfc; + __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000032; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000032; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffff80df00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xa5c4c774856ba837; + *((unsigned long*)& __m128i_op1[0]) = 0x2a569f8081c3bbe9; + *((unsigned long*)& __m128i_result[1]) = 0xffffb96bffff57c9; + *((unsigned long*)& __m128i_result[0]) = 0xffff6080ffff4417; + __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000063b2ac27; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffaa076aeb; + *((unsigned long*)& __m128i_result[1]) = 0x00000000ffff53d9; + *((unsigned long*)& __m128i_result[0]) = 0xffff0001ffff9515; + __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_w_hu(__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]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000ffff0000ffff; + __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00060fbf00040fbf; + *((unsigned long*)& __m128i_op0[0]) = 0x00020fbf00000fbf; + *((unsigned long*)& __m128i_op1[1]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op1[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_result[1]) = 0xffffac5cffffac5c; + *((unsigned long*)& __m128i_result[0]) = 0xffffac5cffffac5c; + __m128i_out = __lsx_vsubwev_w_hu(__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]) = 0xffaefffbffaefffb; + *((unsigned long*)& __m128i_op1[0]) = 0xffaefffbffaefffb; + *((unsigned long*)& __m128i_result[1]) = 0xffff0005ffff0005; + *((unsigned long*)& __m128i_result[0]) = 0xffff000500000004; + __m128i_out = __lsx_vsubwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000a1630000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000a1630000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_d_wu(__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]) = 0x00000001fffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0x00000001fffffffe; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000001fd0; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000001fd0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_d_wu(__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]) = 0xff7ffffef77fffdd; + *((unsigned long*)& __m128i_op1[0]) = 0xf77edf9cffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000008800022; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000001; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffda6f; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffe3d7; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffda6e; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffe3d6; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x8000807f00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x80006b0080808080; + *((unsigned long*)& __m128i_op1[1]) = 0xffff00011cf0c569; + *((unsigned long*)& __m128i_op1[0]) = 0xc0000002b0995850; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffe30f3a97; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffcfe72830; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ff9f5c25; + *((unsigned long*)& __m128i_op0[0]) = 0x58fa6b4000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ff9f5c25; + *((unsigned long*)& __m128i_op1[0]) = 0x58fa6b4000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x8080808080808080; + *((unsigned long*)& __m128i_op0[0]) = 0x8080808080808080; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xcda585aebbb2836a; + *((unsigned long*)& __m128i_result[1]) = 0x0000000080808080; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffc4cdfd16; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + int_out = __lsx_vpickve2gr_w(__m128i_op0,0x2); + *((unsigned long*)& __m128i_op0[1]) = 0x801dd5cb0004e058; + *((unsigned long*)& __m128i_op0[0]) = 0x77eb15638eeb5fc2; + *((unsigned long*)& __m128i_op1[1]) = 0x000000200000001b; + *((unsigned long*)& __m128i_op1[0]) = 0x0000002000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000000000004e03d; + *((unsigned long*)& __m128i_result[0]) = 0x000000008eeb5fc2; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000c0000bd49; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000c7fff000c; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0xfffff00010000fff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000100c6ffef00d; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000006f00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000c00000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000000006f; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000001f0a; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000bfffffffe0f6; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffcfffcfffcfffd; + *((unsigned long*)& __m128i_op0[0]) = 0xfffcfffdfffcfffd; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfffcfffdfffcfffd; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffff7e00000081; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0a0a0a0a0a0a0a0a; + *((unsigned long*)& __m128i_op0[0]) = 0x0a0a0a0a0a0a0a0a; + *((unsigned long*)& __m128i_op1[1]) = 0xffffb96bffff57c9; + *((unsigned long*)& __m128i_op1[0]) = 0xffff6080ffff4417; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0a0aa9890a0ac5f3; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op0[0]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op1[1]) = 0x0010001000100010; + *((unsigned long*)& __m128i_op1[0]) = 0x0010001000100010; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x36fbdfdcffdcffdc; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffefffefffeffff; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffff000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000a752a55; + *((unsigned long*)& __m128i_op1[0]) = 0x0a753500a9fa0d06; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xf589caff5605f2fa; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x087c000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000087c; + *((unsigned long*)& __m128i_op1[1]) = 0x10f8000100000001; + *((unsigned long*)& __m128i_op1[0]) = 0x00000001000010f8; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffefffff784; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffff000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffff000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0001000000000000; + __m128i_out = __lsx_vsubwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c new file mode 100644 index 00000000000..a40ec44d4bb --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-1.c @@ -0,0 +1,325 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vsubwod_h_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_vsubwod_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3ff0000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x40f3fa0000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xc485edbcc0000000; + *((unsigned long*)& __m128i_result[1]) = 0x003f000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x007c000d00400000; + __m128i_out = __lsx_vsubwod_h_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]) = 0x841f000fc28f801f; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x007c0000003e0080; + __m128i_out = __lsx_vsubwod_h_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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vsubwod_h_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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000; + __m128i_out = __lsx_vsubwod_w_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_vsubwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000017fff9000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000210011084; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000007fff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000001001; + __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff80000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xff80000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffff8000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffff8000000000; + __m128i_out = __lsx_vsubwod_w_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_vsubwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffffefefe6a; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000c2bac2c2; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffefe; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffc2ba; + __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000027f000000fe; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xfe80000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000018000000000; + __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000001f0a; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffff7a53; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffffff; + __m128i_out = __lsx_vsubwod_w_h(__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]) = 0xffa6ff91fdd8ef77; + *((unsigned long*)& __m128i_op1[0]) = 0x061202bffb141c38; + *((unsigned long*)& __m128i_result[1]) = 0x0000005a00000228; + *((unsigned long*)& __m128i_result[0]) = 0xfffff9ee000004ec; + __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000002000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000001fe02000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000002000; + *((unsigned long*)& __m128i_op1[0]) = 0x000000001fe02000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_w_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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x30eb020302101b03; + *((unsigned long*)& __m128i_op0[0]) = 0x020310d0c0030220; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000002345454; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000c0dec4ca; + *((unsigned long*)& __m128i_result[1]) = 0x000030ebffffffdc; + *((unsigned long*)& __m128i_result[0]) = 0x00000203ffffff25; + __m128i_out = __lsx_vsubwod_w_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]) = 0x380fdfdfc0000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffc7f100004000; + __m128i_out = __lsx_vsubwod_w_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_vsubwod_w_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_vsubwod_d_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_vsubwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00005dcbe7e830c0; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000015d926c7; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000000e41b; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000005dcb; + __m128i_out = __lsx_vsubwod_d_w(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00f0008100800080; + *((unsigned long*)& __m128i_op0[0]) = 0x00f000807000009e; + *((unsigned long*)& __m128i_op1[1]) = 0x0003c853c843c87e; + *((unsigned long*)& __m128i_op1[0]) = 0x0003c853c843c87e; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000ec382e; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000ec382d; + __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfcfcfcfcfcfcfcfd; + *((unsigned long*)& __m128i_op0[0]) = 0xfcfcfcfcfcfc0000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00009c7c00007176; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffcfcfcfc; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffcfc6080; + __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xc0b4d1a5f8babad3; + *((unsigned long*)& __m128i_op0[0]) = 0xbbc8ecc5f3ced5f3; + *((unsigned long*)& __m128i_op1[1]) = 0xffaefffbffaefffb; + *((unsigned long*)& __m128i_op1[0]) = 0xffaefffbffaefffb; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffc105d1aa; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffbc19ecca; + __m128i_out = __lsx_vsubwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000101fd01fe; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000fe00ff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vsubwod_q_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_vsubwod_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffff0000000ad3d; + *((unsigned long*)& __m128i_op0[0]) = 0xfffff000fffff000; + *((unsigned long*)& __m128i_op1[1]) = 0x1000100010001000; + *((unsigned long*)& __m128i_op1[0]) = 0x1000100010001000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xefffdffff0009d3d; + __m128i_out = __lsx_vsubwod_q_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]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ff0000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffff00ffffff01; + __m128i_out = __lsx_vsubwod_q_d(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000100010001007c; + __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x5f675e96e29a5a60; + *((unsigned long*)& __m128i_op0[0]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op1[1]) = 0x00fe000100cf005f; + *((unsigned long*)& __m128i_op1[0]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x5e695e95e1cb5a01; + __m128i_out = __lsx_vsubwod_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x7efefefe82010201; + *((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_vsubwod_q_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_vsubwod_q_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-vsubwod-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-2.c new file mode 100644 index 00000000000..5c19f7713d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsubwod-2.c @@ -0,0 +1,307 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0000000000010000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xfe07e5fefefdddfe; + *((unsigned long*)& __m128i_op1[0]) = 0x00020100fedd0c00; + *((unsigned long*)& __m128i_result[1]) = 0xff02ff1bff02ff23; + *((unsigned long*)& __m128i_result[0]) = 0x0000ffffff02fff4; + __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xfffefff6fff80002; + *((unsigned long*)& __m128i_op1[1]) = 0x82c53a0000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xc72ef153fc02fdf7; + *((unsigned long*)& __m128i_result[1]) = 0x007d00c500ff00ff; + *((unsigned long*)& __m128i_result[0]) = 0x0038000e0003ff03; + __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000000007b; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7ff0000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x7ff0000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x007f000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x007f000000000000; + __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000040000000400; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x8000000000000010; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffff800000000000; + __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfc01fd1300000001; + *((unsigned long*)& __m128i_op0[0]) = 0xfe00fd1400010000; + *((unsigned long*)& __m128i_op1[1]) = 0xfc01fd1300000001; + *((unsigned long*)& __m128i_op1[0]) = 0xfe00fd1400010000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_w_hu(__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]) = 0x000000000000ffff; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffff; + __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000200000002; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000200000002; + *((unsigned long*)& __m128i_op1[1]) = 0xfe813f00fe813f00; + *((unsigned long*)& __m128i_op1[0]) = 0xfe813f00fe813f00; + *((unsigned long*)& __m128i_result[1]) = 0xffff017fffff017f; + *((unsigned long*)& __m128i_result[0]) = 0xffff017fffff017f; + __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x9c7c266e71768fa4; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00009c7c00007176; + __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000; + __m128i_out = __lsx_vsubwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000800000008; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000800000008; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000008; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000009; + __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000897957687; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000408; + *((unsigned long*)& __m128i_op1[1]) = 0x7fff0007e215b122; + *((unsigned long*)& __m128i_op1[0]) = 0x7ffeffff7bfff828; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff80010001; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff80010001; + __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000af555555555; + *((unsigned long*)& __m128i_op0[0]) = 0x00000af555555555; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000af5; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000af5; + __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x8000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x8000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x8000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x8000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x2e34594c3b000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000002e34594c; + __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsubwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000036280001; + *((unsigned long*)& __m128i_op0[0]) = 0x42a0000042a02001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000036280001; + __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xd0b1ffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x9d519ee8d2d84f1d; + *((unsigned long*)& __m128i_op1[1]) = 0x8644ffff0000ffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ffff0000fffe; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x4a6d0000ffff0000; + __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x82c539ffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xc72df14afbfafdf9; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x7d3ac60000000000; + __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000010000; + *((unsigned long*)& __m128i_op0[0]) = 0x00ff00ff00fe00ff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000010000; + __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfeffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xfeffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x00000fffffffe000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000102020204000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfefff00000001fff; + __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0003000300000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0003000300a10003; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffcfffd00000000; + __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op0[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000200000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0002000200000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x6363636163636363; + __m128i_out = __lsx_vsubwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} From patchwork Thu Sep 7 07:13:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenxiaolong X-Patchwork-Id: 137620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp2789439vqo; Thu, 7 Sep 2023 00:19:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGh6gY79E6iuawlv3R8GbdyfMTXD7mIwopPsSEfDeo6J6Q/7bfR9pO3h1U86FBy3juFC72B X-Received: by 2002:aa7:c1c5:0:b0:526:9cf7:e0d5 with SMTP id d5-20020aa7c1c5000000b005269cf7e0d5mr3755765edp.12.1694071186461; Thu, 07 Sep 2023 00:19:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694071186; cv=none; d=google.com; s=arc-20160816; b=oYcGeWnhUja5M+8UspjyoR4V4ZcTgN3ByCkw5dLyjT4626tnDm3S1ew0A+KfVTrbB8 Gu6wapUCABg9r3RtDmtVcLXWyKAeAc3FoGvv4W2wZCqpmLMmDUpM0JIzzzybj8qNgezT tcPa4l6I0JEe4GlzerWRKJrjoXznTT3J94/WM90mpAh/0+c0aFcIysY/jvolOrwh+IeG afM1ioIiWdCSdxbtQKkRwI10NPuwudNITa9ADSGohd7Xr8yXXlPpOX9uGg/EnAmxUbwu C8Fulljzu6i+jBiYxcXfUXU3Gd8g4bJPN568m0sB/ylA/V+E/IHfMYpSGJmqKu5joneb enrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dmarc-filter:delivered-to; bh=VNrNk2Pv++3XMixd7bGxrMqtDcbKqxUUQz+9qFyA6D0=; fh=BpFCyCzVJo4znJIvOjeDfKzcGsF6Q+JgJbJ+1ev/kM4=; b=h3lmgiaxXt3Zxjg2iKHDJ95KKqijvfEHwiqZ2/wedRMDkCKlI0QF0qzRSHAwL/YRkb 4107Ve7uOB+BqgCYmONF0ByqL4/72+7nhLQqBctHzMmoqLNXRQXlyMlb5QRc6J0sbQqF mg6/6KstegAQZPGb3xmocaLnTC/MMeS/YJZ4uDe48nHfeb8Ksftn+JXkWBQIL1QasVFN hh4CrPedsi7Y2WtUS/mtmQdn3/o1uN2bggTAyQPQyxUYCkUIBwiAmdb4ZKNqlK2YBRKB DYh0ZTKjr6fI6PnK9s+eieHAakKPIiizlnleS24fsaIOzhz0DLa5nGFD62K3xFf3g2HR Zitg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m6-20020a50ef06000000b005259756c012si10625687eds.175.2023.09.07.00.19.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 00:19:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1665338983AD for ; Thu, 7 Sep 2023 07:14:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 4CCB5386545A for ; Thu, 7 Sep 2023 07:13:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4CCB5386545A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.10.130.252]) by gateway (Coremail) with SMTP id _____8Cx5_EqePlk3ichAA--.450S3; Thu, 07 Sep 2023 15:13:46 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxDc8eePlkeDVwAA--.7050S6; Thu, 07 Sep 2023 15:13:45 +0800 (CST) From: Xiaolong Chen To: gcc-patches@gcc.gnu.org Subject: [PATCH v1 3/4] LoongArch:Add vector multiplication arithmetic operation SX instruction. Date: Thu, 7 Sep 2023 15:13:10 +0800 Message-Id: <20230907071311.23302-3-chenxiaolong@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230907071311.23302-1-chenxiaolong@loongson.cn> References: <20230907071311.23302-1-chenxiaolong@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxDc8eePlkeDVwAA--.7050S6 X-CM-SenderInfo: hfkh05xldrz0tqj6z05rqj20fqof0/1tbiAQAHBWT5TbUBigAAst X-Coremail-Antispam: 1Uk129KBj97XoW8AF4DKw4DZryfJrW8WoXrpr47Gr43AoWUAa 4UZw4rCFZxX3W5Jw13X343Kr1Yk3Z3Cr17Awn0yw4Dtw4Ivry7ZFsxJF1Utw1ayry3Zw13 Xr4xJ348Zr1kl-sFpf9Il3svdjkaLaAFLSUrUUUUbb8apTn2vfkv8UJUUUU8wcxFpf9Il3 svdxBIdaVrn0xqx4xG64xvF2IEw4CE5I8CrVC2j2Jv73VFW2AGmfu7bjvjm3AaLaJ3UjIY CTnIWjp_UUUY87kC6x804xWl14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcI k0rVWrJVCq3wAFIxvE14AKwVWUGVWUXwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK 021l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r 4j6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc 02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWrXwAv7VC2z280aVAF wI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7V AKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCj r7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6x IIjxv20xvE14v26ryj6F1UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAI w20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x 0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU8QJ57UUUUU== X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xiaolong Chen , xuchenghua@loongson.cn, chenglulu@loongson.cn, i@xen0n.name Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776362388674151830 X-GMAIL-MSGID: 1776362388674151830 gcc/testsuite/ChangeLog: * gcc.target/loongarch/vector/lsx/lsx-vmuh-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmuh-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmul.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmulwev-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmulwev-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmulwev-3.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmulwod-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmulwod-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmulwod-3.c: New test. --- .../loongarch/vector/lsx/lsx-vmuh-1.c | 352 ++++++++++++++ .../loongarch/vector/lsx/lsx-vmuh-2.c | 371 +++++++++++++++ .../loongarch/vector/lsx/lsx-vmul.c | 281 ++++++++++++ .../loongarch/vector/lsx/lsx-vmulwev-1.c | 433 ++++++++++++++++++ .../loongarch/vector/lsx/lsx-vmulwev-2.c | 343 ++++++++++++++ .../loongarch/vector/lsx/lsx-vmulwev-3.c | 244 ++++++++++ .../loongarch/vector/lsx/lsx-vmulwod-1.c | 271 +++++++++++ .../loongarch/vector/lsx/lsx-vmulwod-2.c | 281 ++++++++++++ .../loongarch/vector/lsx/lsx-vmulwod-3.c | 307 +++++++++++++ 9 files changed, 2883 insertions(+) create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmuh-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmuh-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmul.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-3.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-3.c diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmuh-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmuh-1.c new file mode 100644 index 00000000000..21d64bf18c2 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmuh-1.c @@ -0,0 +1,352 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vmuh_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_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_vmuh_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x059a35ef139a8e00; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_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_vmuh_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x8080808080808080; + *((unsigned long*)& __m128i_op0[0]) = 0x8080808080808080; + *((unsigned long*)& __m128i_op1[1]) = 0x8080808080808080; + *((unsigned long*)& __m128i_op1[0]) = 0x8080808080808080; + *((unsigned long*)& __m128i_result[1]) = 0x4040404040404040; + *((unsigned long*)& __m128i_result[0]) = 0x4040404040404040; + __m128i_out = __lsx_vmuh_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_vmuh_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]) = 0xc0c00000c0c00000; + *((unsigned long*)& __m128i_op1[0]) = 0xc0c00c01c2cd0009; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000800; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000ffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_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_vmuh_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xc0fffff000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffe00000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_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]) = 0xffffffff0000ac26; + *((unsigned long*)& __m128i_op1[0]) = 0x00ff000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000ffffff81fe; + *((unsigned long*)& __m128i_op0[0]) = 0xffffff00ffff7e01; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x000000fffe01fd02; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000ffff0000fe86; + __m128i_out = __lsx_vmuh_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]) = 0x7f7f7f7f7f7f7f7f; + *((unsigned long*)& __m128i_op1[0]) = 0x7f7f7f7f7f7f7f7f; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xff8000010f800000; + *((unsigned long*)& __m128i_op1[1]) = 0xff800000ff800000; + *((unsigned long*)& __m128i_op1[0]) = 0xff800000ff800000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000fff80000; + __m128i_out = __lsx_vmuh_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_vmuh_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xbf3efff536d5169b; + *((unsigned long*)& __m128i_op0[0]) = 0x7ebdfffffddf3f40; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x3f5ec0a0feefa0b0; + __m128i_out = __lsx_vmuh_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fffffff7ffffffe; + *((unsigned long*)& __m128i_op0[0]) = 0x7fffffff7ffffffe; + *((unsigned long*)& __m128i_op1[1]) = 0x7fffffff7ffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0x7fffffff7ffffffe; + *((unsigned long*)& __m128i_result[1]) = 0x3fffffff3ffffffe; + *((unsigned long*)& __m128i_result[0]) = 0x3fffffff3ffffffe; + __m128i_out = __lsx_vmuh_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x003f0000ffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x003f0000ffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x7fff0101ffffe000; + *((unsigned long*)& __m128i_op1[0]) = 0x7fffffffa0204000; + *((unsigned long*)& __m128i_result[1]) = 0x001f7fc100000000; + *((unsigned long*)& __m128i_result[0]) = 0x001f7fff00000000; + __m128i_out = __lsx_vmuh_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]) = 0x000000ff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000000010000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000cd630000cd63; + *((unsigned long*)& __m128i_op1[1]) = 0xcd636363cd636363; + *((unsigned long*)& __m128i_op1[0]) = 0xcd636363cd636363; + *((unsigned long*)& __m128i_result[1]) = 0xffffcd63ffffcd63; + *((unsigned long*)& __m128i_result[0]) = 0xffffd765ffffd765; + __m128i_out = __lsx_vmuh_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_vmuh_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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x8000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xff7fffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0040000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000015516a768038; + *((unsigned long*)& __m128i_op0[0]) = 0xffffff9ed2e1c000; + *((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_vmuh_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op0[0]) = 0x007ffd0001400840; + *((unsigned long*)& __m128i_op1[1]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op1[0]) = 0x007ffd0001400840; + *((unsigned long*)& __m128i_result[1]) = 0x3fffffff80000000; + *((unsigned long*)& __m128i_result[0]) = 0x00003ffd000a4000; + __m128i_out = __lsx_vmuh_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0032000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0032000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000009c400000000; + __m128i_out = __lsx_vmuh_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0002000200020002; + *((unsigned long*)& __m128i_op0[0]) = 0x0202fe02fd020102; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000202fe02; + __m128i_out = __lsx_vmuh_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0006000000040000; + *((unsigned long*)& __m128i_op0[0]) = 0x0002000000000007; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffff0000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000006362ffff; + __m128i_out = __lsx_vmuh_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]) = 0xffffffffffff0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_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_vmuh_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffff0000ffff0000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffff0000ffff0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x00000000fffe0002; + __m128i_out = __lsx_vmuh_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-vmuh-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmuh-2.c new file mode 100644 index 00000000000..e244293dbcc --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmuh-2.c @@ -0,0 +1,371 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0000000000000011; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000011; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000011; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000011; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000c5ac01015b; + *((unsigned long*)& __m128i_op0[0]) = 0xaaacac88a3a9a96a; + *((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_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000001300000013; + *((unsigned long*)& __m128i_op1[0]) = 0x0000001300000013; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000038003; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000040033; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000080000068; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000014; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x8000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x10f881a20ffd02b0; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ff800000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0ff780a10efc01af; + *((unsigned long*)& __m128i_result[0]) = 0x00000000fe7f0000; + __m128i_out = __lsx_vmuh_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000efffffff; + *((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_vmuh_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001001100110068; + *((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_vmuh_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1d8000001d800000; + *((unsigned long*)& __m128i_op0[0]) = 0x1d8000001d800000; + *((unsigned long*)& __m128i_op1[1]) = 0x1d8000001d800000; + *((unsigned long*)& __m128i_op1[0]) = 0x1d8000001d800000; + *((unsigned long*)& __m128i_result[1]) = 0x0366000003660000; + *((unsigned long*)& __m128i_result[0]) = 0x0366000003660000; + __m128i_out = __lsx_vmuh_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xbfd10d0d7b6b6b73; + *((unsigned long*)& __m128i_op1[0]) = 0xc5c534920000c4ed; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000800; + *((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_vmuh_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7ef400ad21fc7081; + *((unsigned long*)& __m128i_op0[0]) = 0x28bf0351ec69b5f2; + *((unsigned long*)& __m128i_op1[1]) = 0xffffb96bffff57c9; + *((unsigned long*)& __m128i_op1[0]) = 0xffff6080ffff4417; + *((unsigned long*)& __m128i_result[1]) = 0x7ef3ddac21fc5a2c; + *((unsigned long*)& __m128i_result[0]) = 0x28bee9edec690869; + __m128i_out = __lsx_vmuh_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + int_out = __lsx_vpickve2gr_h(__m128i_op0,0x0); + *((unsigned long*)& __m128i_op0[1]) = 0x0000200000002000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffe000ffdf; + *((unsigned long*)& __m128i_result[1]) = 0x00001fff00001fff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000002; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000800000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000800000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000214f; + *((unsigned long*)& __m128i_op0[0]) = 0xc31b63d846ebc810; + *((unsigned long*)& __m128i_op1[1]) = 0x00ff0000800000ff; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffff941d; + *((unsigned long*)& __m128i_result[1]) = 0x00000000000010a7; + *((unsigned long*)& __m128i_result[0]) = 0x0000000046ebaa2c; + __m128i_out = __lsx_vmuh_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000cf4f4f00; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000cf4f4f00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000007c; + *((unsigned long*)& __m128i_op0[0]) = 0x0000005f0003e000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000897957687; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000408; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000003397dd140; + *((unsigned long*)& __m128i_op0[0]) = 0x00000004bd7cdd20; + *((unsigned long*)& __m128i_op1[1]) = 0x0016ffb00016ffb0; + *((unsigned long*)& __m128i_op1[0]) = 0x0016ffb00016ffb0; + *((unsigned long*)& __m128i_result[1]) = 0x00000000004a294b; + *((unsigned long*)& __m128i_result[0]) = 0x00000000006d04bc; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffcfffcfffcfffc; + *((unsigned long*)& __m128i_op0[0]) = 0xfffcfffcfffcfffc; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x007ffe7ffe400000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x007ffd0001400840; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xfffcfffcfffcfffc; + *((unsigned long*)& __m128i_op1[0]) = 0xfffcfffcfffcfffc; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffe; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffa800000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000158; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000157; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x001a64b345308091; + *((unsigned long*)& __m128i_op0[0]) = 0x001f2f2cab1c732a; + *((unsigned long*)& __m128i_op1[1]) = 0x1baf8eabd26bc629; + *((unsigned long*)& __m128i_op1[0]) = 0x1c2640b9a8e9fb49; + *((unsigned long*)& __m128i_result[1]) = 0x0002dab8746acf8e; + *((unsigned long*)& __m128i_result[0]) = 0x00036dd1c5c15856; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3a8000003a800000; + *((unsigned long*)& __m128i_op0[0]) = 0x000ef0000000003b; + *((unsigned long*)& __m128i_op1[1]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_result[1]) = 0x00003a7fc58074ff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000eeff1100e; + __m128i_out = __lsx_vmuh_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmul.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmul.c new file mode 100644 index 00000000000..6458963cb7f --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmul.c @@ -0,0 +1,281 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vmul_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x54feed87bc3f2be1; + *((unsigned long*)& __m128i_op0[0]) = 0x8064d8f6a494afcb; + *((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_vmul_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]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmul_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]) = 0x7fc000007fc00000; + *((unsigned long*)& __m128i_op1[0]) = 0x1e801ffc7fc00000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmul_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffe003c1f0077; + *((unsigned long*)& __m128i_op0[0]) = 0xffffff0074230438; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000ff0000000438; + __m128i_out = __lsx_vmul_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_bu(__m128i_op0,0x2); + *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000800800000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000800800000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000004000000000; + __m128i_out = __lsx_vmul_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfff5fff4002ffff5; + *((unsigned long*)& __m128i_op1[1]) = 0xaa858644fb8b3d49; + *((unsigned long*)& __m128i_op1[0]) = 0x18499e2cee2cc251; + *((unsigned long*)& __m128i_result[1]) = 0x8644000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xaed495f03343a685; + __m128i_out = __lsx_vmul_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7505443065413aed; + *((unsigned long*)& __m128i_op0[0]) = 0x0100d6effefd0498; + *((unsigned long*)& __m128i_op1[1]) = 0x7505443065413aed; + *((unsigned long*)& __m128i_op1[0]) = 0x0100d6effefd0498; + *((unsigned long*)& __m128i_result[1]) = 0xb71289fdfbea3f69; + *((unsigned long*)& __m128i_result[0]) = 0x4e17c2ffb4851a40; + __m128i_out = __lsx_vmul_d(__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]) = 0xfc01fd1300000001; + *((unsigned long*)& __m128i_op1[0]) = 0xfe00fd1400010000; + *((unsigned long*)& __m128i_result[1]) = 0xc72ef153fc02fdf7; + *((unsigned long*)& __m128i_result[0]) = 0xca31bf15fd010000; + __m128i_out = __lsx_vmul_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]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vmul_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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmul_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_vmul_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xc000c000c000ff81; + *((unsigned long*)& __m128i_op1[1]) = 0x5d5d5d5d5d5d5d5d; + *((unsigned long*)& __m128i_op1[0]) = 0x5d5d5d5d5d5d0000; + *((unsigned long*)& __m128i_result[1]) = 0xa2a2a2a3a2a2a2a3; + *((unsigned long*)& __m128i_result[0]) = 0xc605c000aedd0000; + __m128i_out = __lsx_vmul_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xacc8c794af2caf01; + *((unsigned long*)& __m128i_op0[0]) = 0xa91e2048938c40f0; + *((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_vmul_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xeeb1e4f43c3763f3; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff5a6fe3d7; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000021e79364; + *((unsigned long*)& __m128i_op1[0]) = 0x0000718ea657431b; + *((unsigned long*)& __m128i_result[1]) = 0x000000006ca193ec; + *((unsigned long*)& __m128i_result[0]) = 0x00008e72b5b94cad; + __m128i_out = __lsx_vmul_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]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op1[0]) = 0x8000000080000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmul_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]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmul_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]) = 0xffffe000ffffe000; + *((unsigned long*)& __m128i_op1[0]) = 0x467f6080467d607f; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmul_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000040; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000040; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000040; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000040; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000001000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000001000; + __m128i_out = __lsx_vmul_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x007f008000ea007f; + *((unsigned long*)& __m128i_op0[0]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xc000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmul_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0042003e0042002f; + *((unsigned long*)& __m128i_op0[0]) = 0x0001fffc0001fffc; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfffe0004fffe0004; + __m128i_out = __lsx_vmul_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xc1bdceee242070db; + *((unsigned long*)& __m128i_op0[0]) = 0xe8c7b756d76aa478; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x3f433212dce09025; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmul_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_vmul_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_vmul_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xf359f359f359f359; + *((unsigned long*)& __m128i_op0[0]) = 0xf359f359f359f359; + *((unsigned long*)& __m128i_op1[1]) = 0xd3259a2984048c23; + *((unsigned long*)& __m128i_op1[0]) = 0xf9796558e39953fd; + *((unsigned long*)& __m128i_result[1]) = 0x86dd8341b164f12b; + *((unsigned long*)& __m128i_result[0]) = 0x9611c3985b3159f5; + __m128i_out = __lsx_vmul_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op0[0]) = 0xffd27db010d20fbf; + *((unsigned long*)& __m128i_op1[1]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op1[0]) = 0xffd27db010d20fbf; + *((unsigned long*)& __m128i_result[1]) = 0x9727b8499727b849; + *((unsigned long*)& __m128i_result[0]) = 0x12755900b653f081; + __m128i_out = __lsx_vmul_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0303030303030303; + *((unsigned long*)& __m128i_op0[0]) = 0x0303030303030303; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x02f3030303030303; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x06d9090909090909; + __m128i_out = __lsx_vmul_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffff81ffff7f03; + *((unsigned long*)& __m128i_op0[0]) = 0x04ffff8101ff81ff; + *((unsigned long*)& __m128i_op1[1]) = 0x0a0000000a000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0a0000000a000000; + *((unsigned long*)& __m128i_result[1]) = 0x0a0000001e000000; + *((unsigned long*)& __m128i_result[0]) = 0x0a000000f6000000; + __m128i_out = __lsx_vmul_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]) = 0x317fce80317fce80; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmul_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-1.c new file mode 100644 index 00000000000..2043456d8bc --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-1.c @@ -0,0 +1,433 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vmulwev_h_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_vmulwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_h_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_vmulwev_h_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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_h_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]) = 0x0000000100000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_h_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_vmulwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_h_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_vmulwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000158; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x001f7fc100000404; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000002a000; + *((unsigned long*)& __m128i_op1[1]) = 0x7fff0101ffffe000; + *((unsigned long*)& __m128i_op1[0]) = 0x7fffffffa0204000; + *((unsigned long*)& __m128i_result[1]) = 0xffe1ffc100000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000400000; + __m128i_out = __lsx_vmulwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000009000900; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000009000900; + *((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_vmulwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x30eb022002101b20; + *((unsigned long*)& __m128i_op0[0]) = 0x020310edc003023d; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffc3; + __m128i_out = __lsx_vmulwev_h_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_vmulwev_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op1[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xff9dff9dff9dff9d; + __m128i_out = __lsx_vmulwev_h_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_vmulwev_h_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]) = 0x00000000efffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_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_vmulwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffe50000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000ff0000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffe020; + *((unsigned long*)& __m128i_op1[0]) = 0x3fc00000010a000b; + *((unsigned long*)& __m128i_result[1]) = 0x00001b0000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ff81007c; + *((unsigned long*)& __m128i_op0[0]) = 0xffb7005f0070007c; + *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[0]) = 0x0001000104000800; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000007c; + *((unsigned long*)& __m128i_result[0]) = 0x0000005f0003e000; + __m128i_out = __lsx_vmulwev_w_h(__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]) = 0x4040404040404040; + *((unsigned long*)& __m128i_op1[0]) = 0x4040404040404040; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffbfc0ffffbfc0; + __m128i_out = __lsx_vmulwev_w_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]) = 0x000000ffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x000000ffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffff0100000001; + *((unsigned long*)& __m128i_result[0]) = 0xffffff0100000001; + __m128i_out = __lsx_vmulwev_w_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_vmulwev_w_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]) = 0x0000208000002080; + *((unsigned long*)& __m128i_op1[0]) = 0x0000208000002080; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_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]) = 0x0000000000000004; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000004870ba0; + *((unsigned long*)& __m128i_op1[1]) = 0x478b478b38031779; + *((unsigned long*)& __m128i_op1[0]) = 0x6b769e690fa1e119; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000fe98c2a0; + __m128i_out = __lsx_vmulwev_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000004000000040; + *((unsigned long*)& __m128i_op0[0]) = 0x00007770ffff9411; + *((unsigned long*)& __m128i_op1[1]) = 0x0000004000000040; + *((unsigned long*)& __m128i_op1[0]) = 0x00007770ffff9411; + *((unsigned long*)& __m128i_result[1]) = 0x0000100000001000; + *((unsigned long*)& __m128i_result[0]) = 0x37b951002d81a921; + __m128i_out = __lsx_vmulwev_w_h(__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]) = 0x000000e0000000e0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000c400; + __m128i_out = __lsx_vmulwev_d_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]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vmulwev_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fffffff7fffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x000000ffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff80000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffb4ff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffb4ff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000016; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffb4ff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffff98dea; + __m128i_out = __lsx_vmulwev_d_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_vmulwev_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0006000000040000; + *((unsigned long*)& __m128i_op0[0]) = 0x0002000000000007; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000f80007; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000006c80031; + __m128i_out = __lsx_vmulwev_d_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]) = 0x0000000000000005; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000101010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000001010001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000010001; + __m128i_out = __lsx_vmulwev_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000202020200; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000100; + *((unsigned long*)& __m128i_op1[1]) = 0x0808080808080808; + *((unsigned long*)& __m128i_op1[0]) = 0x0004280808080808; + *((unsigned long*)& __m128i_result[1]) = 0x0010203030201000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000808080800; + __m128i_out = __lsx_vmulwev_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000b5207f80; + *((unsigned long*)& __m128i_op1[1]) = 0x2000000020000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000200200000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x6a57a30ff0000000; + __m128i_out = __lsx_vmulwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffffff7; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff700000009; + __m128i_out = __lsx_vmulwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000104000800; + *((unsigned long*)& __m128i_op1[1]) = 0x8001000180010001; + *((unsigned long*)& __m128i_op1[0]) = 0x8001000184000800; + *((unsigned long*)& __m128i_result[1]) = 0xffff80007e028401; + *((unsigned long*)& __m128i_result[0]) = 0x9a10144000400000; + __m128i_out = __lsx_vmulwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000bd003d; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000fffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0010000000000001; + *((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_vmulwev_q_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_vmulwev_q_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_vmulwev_q_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_vmulwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000077af9450; + *((unsigned long*)& __m128i_op1[1]) = 0x000000400000004c; + *((unsigned long*)& __m128i_op1[0]) = 0x000047404f4f040d; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000214f; + *((unsigned long*)& __m128i_result[0]) = 0xc31b63d846ebc810; + __m128i_out = __lsx_vmulwev_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000002000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000002000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_q_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-vmulwev-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-2.c new file mode 100644 index 00000000000..366a4ab2afe --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-2.c @@ -0,0 +1,343 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfe01fe01fe01fe01; + *((unsigned long*)& __m128i_result[0]) = 0x00000000fe01fe01; + __m128i_out = __lsx_vmulwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000200020; + *((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_vmulwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_h_bu(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x6a5d5b056f2f4978; + *((unsigned long*)& __m128i_op0[0]) = 0x17483c07141b5971; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xd4bade5e2e902836; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x345002920f3017d6; + __m128i_out = __lsx_vmulwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000c0010000a186; + *((unsigned long*)& __m128i_op0[0]) = 0x00067fff0002a207; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffff0002; + *((unsigned long*)& __m128i_result[1]) = 0x000000ff0000857a; + *((unsigned long*)& __m128i_result[0]) = 0x05fafe0101fe000e; + __m128i_out = __lsx_vmulwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100000001; + *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[0]) = 0xc1f03e1042208410; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x00f0001000000010; + __m128i_out = __lsx_vmulwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000000eefff; + *((unsigned long*)& __m128i_op0[0]) = 0xf8e1a03affffe3e2; + *((unsigned long*)& __m128i_op1[1]) = 0x3a80613fda5dcb4a; + *((unsigned long*)& __m128i_op1[0]) = 0x93f0b81a914c003b; + *((unsigned long*)& __m128i_result[1]) = 0x00000000051649b6; + *((unsigned long*)& __m128i_result[0]) = 0xd2f005e44bb43416; + __m128i_out = __lsx_vmulwev_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000001fc0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fffffff7fffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x7fffffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000200000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0001fffe00000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000001fffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0x00000001fffffffe; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffff000f0008d3c; + *((unsigned long*)& __m128i_op0[0]) = 0xfffff0016fff8d3d; + *((unsigned long*)& __m128i_op1[1]) = 0xfffff000f0008d3c; + *((unsigned long*)& __m128i_op1[0]) = 0xfffff0016fff8d3d; + *((unsigned long*)& __m128i_result[1]) = 0xe10000004deb2610; + *((unsigned long*)& __m128i_result[0]) = 0xe101e0014dec4089; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x111110ff11111141; + *((unsigned long*)& __m128i_op1[0]) = 0x11111131111116a6; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x2028000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0001001100110068; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op0[0]) = 0xc8847ef6ed3f2000; + *((unsigned long*)& __m128i_op1[1]) = 0xd400c02000002acf; + *((unsigned long*)& __m128i_op1[0]) = 0xf4000020c4000000; + *((unsigned long*)& __m128i_result[1]) = 0x6453f5e01d6e5000; + *((unsigned long*)& __m128i_result[0]) = 0x000fdec000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xbfd10d0d7b6b6b73; + *((unsigned long*)& __m128i_op1[0]) = 0xc5c534920000c4ed; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000001700000017; + *((unsigned long*)& __m128i_op0[0]) = 0x59f7fd8759f7fd87; + *((unsigned long*)& __m128i_op1[1]) = 0x0000001700000017; + *((unsigned long*)& __m128i_op1[0]) = 0x59f7fd8759f7fd87; + *((unsigned long*)& __m128i_result[1]) = 0x0000021100000211; + *((unsigned long*)& __m128i_result[0]) = 0xfb141d31fb141d31; + __m128i_out = __lsx_vmulwev_w_hu(__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]) = 0x7f800000976801fe; + *((unsigned long*)& __m128i_op1[0]) = 0x837c1ae57f8012ed; + *((unsigned long*)& __m128i_result[1]) = 0x976801fd6897fe02; + *((unsigned long*)& __m128i_result[0]) = 0x7f8012ec807fed13; + __m128i_out = __lsx_vmulwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000008000000080; + *((unsigned long*)& __m128i_op0[0]) = 0x0080000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[0]) = 0x000100010001fffe; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000800080; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0002ffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0909090900000909; + *((unsigned long*)& __m128i_op1[0]) = 0x0909090909090909; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3a80613fda5dcb4a; + *((unsigned long*)& __m128i_op0[0]) = 0x93f0b81a914c003b; + *((unsigned long*)& __m128i_op1[1]) = 0x0000feff23560000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000fd1654860000; + *((unsigned long*)& __m128i_result[1]) = 0x1e242e4d68dc0000; + *((unsigned long*)& __m128i_result[0]) = 0x2ff8fddb7ae20000; + __m128i_out = __lsx_vmulwev_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000060000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000060000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7ff000ff6220c0c1; + *((unsigned long*)& __m128i_op0[0]) = 0xffe8081000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x000000007ff000ff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-3.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-3.c new file mode 100644 index 00000000000..672e46753a6 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwev-3.c @@ -0,0 +1,244 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vmulwev_h_bu_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000017fda829; + *((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_vmulwev_h_bu_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_h_bu_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[1]) = 0xff01ff01ff01ff01; + *((unsigned long*)& __m128i_result[0]) = 0xff01ff01ff01fc10; + __m128i_out = __lsx_vmulwev_h_bu_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0042003e0042002f; + *((unsigned long*)& __m128i_op0[0]) = 0x0001fffc0001fffc; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffbeffc2ffbeffd1; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_h_bu_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000003f80; + *((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_vmulwev_h_bu_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_vmulwev_h_bu_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_vmulwev_d_wu_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_vmulwev_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000080; + *((unsigned long*)& __m128i_op0[0]) = 0x80000000fff80000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000080; + *((unsigned long*)& __m128i_op1[0]) = 0x80000000fff80000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000004000; + *((unsigned long*)& __m128i_result[0]) = 0xfff8004000000000; + __m128i_out = __lsx_vmulwev_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffff8607db959f; + *((unsigned long*)& __m128i_op0[0]) = 0xff0cff78ff96ff14; + *((unsigned long*)& __m128i_op1[1]) = 0x0000008a0000008a; + *((unsigned long*)& __m128i_op1[0]) = 0x0000008900000009; + *((unsigned long*)& __m128i_result[1]) = 0x000000043c5ea7b6; + *((unsigned long*)& __m128i_result[0]) = 0x00000008fc4ef7b4; + __m128i_out = __lsx_vmulwev_d_wu_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]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffff46; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffe00000002; + *((unsigned long*)& __m128i_result[0]) = 0xffffff46000000ba; + __m128i_out = __lsx_vmulwev_d_wu_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]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xf8f8372f752402ee; + *((unsigned long*)& __m128i_op1[1]) = 0x7fffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffc0000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000000; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x80044def00000001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ff000000ff00; + *((unsigned long*)& __m128i_result[1]) = 0x00007f8449a19084; + *((unsigned long*)& __m128i_result[0]) = 0x49a210000000ff00; + __m128i_out = __lsx_vmulwev_q_du_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_vmulwev_q_du_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_vmulwev_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffcfd000000fb00; + *((unsigned long*)& __m128i_op0[0]) = 0x0001fe00f8000700; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000000ffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0xfdfef9ff0efff900; + __m128i_out = __lsx_vmulwev_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000005; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x7efefefe82010201; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000002; + *((unsigned long*)& __m128i_result[0]) = 0x7afafaf88a050a05; + __m128i_out = __lsx_vmulwev_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xcda585aebbb2836a; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xcda585aebbb2836a; + *((unsigned long*)& __m128i_result[1]) = 0xd78cfd70b5f65d76; + *((unsigned long*)& __m128i_result[0]) = 0x5779108fdedda7e4; + __m128i_out = __lsx_vmulwev_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op0[0]) = 0xc8847ef6ed3f2000; + *((unsigned long*)& __m128i_op1[1]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op1[0]) = 0xc8847ef6ed3f2000; + *((unsigned long*)& __m128i_result[1]) = 0xd48acbfe13102acf; + *((unsigned long*)& __m128i_result[0]) = 0xf4af70d0c4000000; + __m128i_out = __lsx_vmulwev_q_du_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]) = 0xffffffffe0000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwev_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3a8000003a800000; + *((unsigned long*)& __m128i_op0[0]) = 0x000ef0000000003b; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000056; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffff86; + *((unsigned long*)& __m128i_result[1]) = 0x00000000000eefff; + *((unsigned long*)& __m128i_result[0]) = 0xf8e1a03affffe3e2; + __m128i_out = __lsx_vmulwev_q_du_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-vmulwod-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-1.c new file mode 100644 index 00000000000..05a90881226 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-1.c @@ -0,0 +1,271 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0000000000000006; + *((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_vmulwod_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0100010000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0100010000010000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000003ddc5dac; + *((unsigned long*)& __m128i_op1[1]) = 0x67157b5100005000; + *((unsigned long*)& __m128i_op1[0]) = 0x387c7e0a133f2000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000004870ba0; + __m128i_out = __lsx_vmulwod_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfefe000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffff000000000155; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000100000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffff8001ffff8001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7ff0000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x7ff0000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x7ff0000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x7ff0000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x3ff0010000000000; + *((unsigned long*)& __m128i_result[0]) = 0x3ff0010000000000; + __m128i_out = __lsx_vmulwod_w_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_vmulwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00009c7c00007176; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00009c7c00007176; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_w_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_vmulwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x440ef000440ef000; + *((unsigned long*)& __m128i_op0[0]) = 0x4400000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x3a8000003a800000; + *((unsigned long*)& __m128i_op1[0]) = 0x000ef0000000003b; + *((unsigned long*)& __m128i_result[1]) = 0x0f8d33000f8d3300; + *((unsigned long*)& __m128i_result[0]) = 0x0003b80000000000; + __m128i_out = __lsx_vmulwod_w_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0018001800180018; + *((unsigned long*)& __m128i_op0[0]) = 0x0018001800180018; + *((unsigned long*)& __m128i_op1[1]) = 0x85bd6b0e94d89998; + *((unsigned long*)& __m128i_op1[0]) = 0xd83c8081ffff808f; + *((unsigned long*)& __m128i_result[1]) = 0xfff489b693120950; + *((unsigned long*)& __m128i_result[0]) = 0xfffc45a851c40c18; + __m128i_out = __lsx_vmulwod_d_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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffe5; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffe5; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vmulwod_d_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]) = 0x3e1f321529232736; + *((unsigned long*)& __m128i_op1[0]) = 0x161d0c373c200826; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_w(__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]) = 0x0001000000010001; + *((unsigned long*)& __m128i_op1[0]) = 0x0001000000010001; + *((unsigned long*)& __m128i_result[1]) = 0x00003f8000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00003f8000000000; + __m128i_out = __lsx_vmulwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x7fff000000007fff; + *((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_vmulwod_d_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]) = 0x0000ffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ffffffdfffdf; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffffe000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000c6fde000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000fef01000f27ca; + *((unsigned long*)& __m128i_op1[1]) = 0x0000010000010101; + *((unsigned long*)& __m128i_op1[0]) = 0x0101000001000100; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000ffef0010000; + __m128i_out = __lsx_vmulwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffffe0; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000005452505; + *((unsigned long*)& __m128i_op1[0]) = 0x000000044525043c; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_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_vmulwod_d_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]) = 0x3fc03fc000000004; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffc03fc040; + __m128i_out = __lsx_vmulwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000000a; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000a; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00fe000100cf005f; + *((unsigned long*)& __m128i_op1[0]) = 0x7fff7fff7fff7f00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000400028000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000004; + *((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_vmulwod_d_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xc110000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xc00d060000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x3ff0000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x40f3fa0000000000; + *((unsigned long*)& __m128i_result[1]) = 0xf047ef0000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_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]) = 0x00007fff7fff8000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffff100000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000000f0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_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-vmulwod-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-2.c new file mode 100644 index 00000000000..04c83332dde --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-2.c @@ -0,0 +1,281 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x004e005500060031; + *((unsigned long*)& __m128i_op1[0]) = 0xff870068fff5ffb3; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000200010; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfa31dfa21672e711; + *((unsigned long*)& __m128i_op0[0]) = 0x1304db85e468073a; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000150000; + *((unsigned long*)& __m128i_op0[0]) = 0xfffeffff001effff; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000fffff1a0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000f00f; + __m128i_out = __lsx_vmulwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000080; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_hu(__m128i_op0,0x4); + *((unsigned long*)& __m128i_op0[1]) = 0xe2560afe9c001a18; + *((unsigned long*)& __m128i_op0[0]) = 0xe2560afe9c001a18; + *((unsigned long*)& __m128i_op1[1]) = 0x000000ff0000857a; + *((unsigned long*)& __m128i_op1[0]) = 0x05fafe0101fe000e; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000d82; + *((unsigned long*)& __m128i_result[0]) = 0x046a09ec009c0000; + __m128i_out = __lsx_vmulwod_h_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfe80ffffffffff02; + *((unsigned long*)& __m128i_op1[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op1[0]) = 0x7fff7fff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x7f3f018000000000; + __m128i_out = __lsx_vmulwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xf0fd800080000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000a00028004000; + *((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_vmulwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000005a00000228; + *((unsigned long*)& __m128i_op0[0]) = 0xfffff9ee000004ec; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffacdb6dbecac; + *((unsigned long*)& __m128i_op1[0]) = 0x1f5533a694f902c0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x1f54e0ab00000000; + __m128i_out = __lsx_vmulwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00e4880080000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0080810080808100; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff011fb11181d8ea; + *((unsigned long*)& __m128i_op0[0]) = 0x80ff800000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00fe00fe000200fe; + *((unsigned long*)& __m128i_op1[0]) = 0x00fe00fe000200fe; + *((unsigned long*)& __m128i_result[1]) = 0x00fd02fe00002302; + *((unsigned long*)& __m128i_result[0]) = 0x007ffd0200000000; + __m128i_out = __lsx_vmulwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfffe0001fffe0001; + __m128i_out = __lsx_vmulwod_w_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x14ccc6320076a4d2; + *((unsigned long*)& __m128i_op0[0]) = 0x685670d27e00682a; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_result[1]) = 0x14ccc631eb3339ce; + *((unsigned long*)& __m128i_result[0]) = 0x685670d197a98f2e; + __m128i_out = __lsx_vmulwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xf000000000000000; + *((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_vmulwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x003fffc0ffc0003f; + *((unsigned long*)& __m128i_op0[0]) = 0xffc0ffc0003f003f; + *((unsigned long*)& __m128i_op1[1]) = 0x000000400000004c; + *((unsigned long*)& __m128i_op1[0]) = 0x00007770ffff941d; + *((unsigned long*)& __m128i_result[1]) = 0x000000000ffff000; + *((unsigned long*)& __m128i_result[0]) = 0x000077529b522400; + __m128i_out = __lsx_vmulwod_d_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000001000000010; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x1111113111111141; + *((unsigned long*)& __m128i_op1[0]) = 0x1111113111111121; + *((unsigned long*)& __m128i_result[1]) = 0x0000000111111312; + *((unsigned long*)& __m128i_result[0]) = 0x2222272111111410; + __m128i_out = __lsx_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000001c88bf0; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000001c88bf0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffff800000003; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff0015172b; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000800000; + *((unsigned long*)& __m128i_op0[0]) = 0x003fffffff800000; + *((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_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000600000001; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000c6c6c6c6; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000c6c6c6c6; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000c6c7; + *((unsigned long*)& __m128i_result[0]) = 0x8d8d8d8d8d8cc6c6; + __m128i_out = __lsx_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0a0000000a000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0a0000000a000000; + *((unsigned long*)& __m128i_op1[1]) = 0x7f7f00007f7f7500; + *((unsigned long*)& __m128i_op1[0]) = 0x3b42017f3a7f7f01; + *((unsigned long*)& __m128i_result[1]) = 0x04faf60009f5f092; + *((unsigned long*)& __m128i_result[0]) = 0x04fafa9200000000; + __m128i_out = __lsx_vmulwod_q_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-3.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-3.c new file mode 100644 index 00000000000..58ebf2d2905 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmulwod-3.c @@ -0,0 +1,307 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0xbf8000000000ffff; + *((unsigned long*)& __m128i_op0[0]) = 0xcf00000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000002; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu_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_vmulwod_h_bu_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_vmulwod_h_bu_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000ffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000ff020000fff4; + *((unsigned long*)& __m128i_op1[1]) = 0x7fc000007fc00000; + *((unsigned long*)& __m128i_op1[0]) = 0x1e801ffc7fc00000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00001ee100000000; + __m128i_out = __lsx_vmulwod_h_bu_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000010; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000010; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu_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]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu_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_vmulwod_h_bu_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000007fff7fff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x3f5ec0a0feefa0b0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ff02d060; + __m128i_out = __lsx_vmulwod_h_bu_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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_h_bu_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_vmulwod_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_wu_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_vmulwod_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x80000000fff8fff8; + *((unsigned long*)& __m128i_op0[0]) = 0x80000000fff80000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_wu_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_vmulwod_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000001000000010; + *((unsigned long*)& __m128i_op0[0]) = 0x0000001000000010; + *((unsigned long*)& __m128i_op1[1]) = 0x0010001000100010; + *((unsigned long*)& __m128i_op1[0]) = 0x0010001000100010; + *((unsigned long*)& __m128i_result[1]) = 0x0000000001000100; + *((unsigned long*)& __m128i_result[0]) = 0x0000000001000100; + __m128i_out = __lsx_vmulwod_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000004a294b; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000006d04bc; + *((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_vmulwod_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x55aa55aa55aa55ab; + *((unsigned long*)& __m128i_op0[0]) = 0xaa55555655aaaaa8; + *((unsigned long*)& __m128i_op1[1]) = 0x7ef4002d21fc7001; + *((unsigned long*)& __m128i_op1[0]) = 0x28bf02d1ec6a35b2; + *((unsigned long*)& __m128i_result[1]) = 0x2a7b7c9260f90ee2; + *((unsigned long*)& __m128i_result[0]) = 0x1b1c6cdfd57f5736; + __m128i_out = __lsx_vmulwod_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000004040504; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000004040504; + *((unsigned long*)& __m128i_op1[1]) = 0x0000010100000101; + *((unsigned long*)& __m128i_op1[0]) = 0x0000010100000101; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_d_wu_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff00007fff0000; + *((unsigned long*)& __m128i_op0[0]) = 0x7fff00007fff0000; + *((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_vmulwod_d_wu_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_vmulwod_d_wu_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_vmulwod_q_du_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_vmulwod_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000ffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000feff01; + *((unsigned long*)& __m128i_result[0]) = 0x00feff0100000000; + __m128i_out = __lsx_vmulwod_q_du_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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0101010202050120; + *((unsigned long*)& __m128i_op0[0]) = 0x0101010102020202; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du_d(__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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0ae3072529fbfe78; + __m128i_out = __lsx_vmulwod_q_du_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]) = 0x00000000000007f8; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000000007f8; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du_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_vmulwod_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00ff000000ff0000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000005; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmulwod_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x030804010d090107; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x1313131313131313; + *((unsigned long*)& __m128i_op1[0]) = 0x1313131313131313; + *((unsigned long*)& __m128i_result[1]) = 0x0039d21e3229d4e8; + *((unsigned long*)& __m128i_result[0]) = 0x6d339b4f3b439885; + __m128i_out = __lsx_vmulwod_q_du_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} From patchwork Thu Sep 7 07:13:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenxiaolong X-Patchwork-Id: 137623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp2789856vqo; Thu, 7 Sep 2023 00:20:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLMcLq0Hwulpm6JCU4m4VPklR21ujgl1YchaLy/JrupGEggBLTPhL7MSb1+yNCowkahRFm X-Received: by 2002:a17:906:bcc7:b0:9a5:c54f:da1c with SMTP id lw7-20020a170906bcc700b009a5c54fda1cmr3752576ejb.47.1694071254858; Thu, 07 Sep 2023 00:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694071254; cv=none; d=google.com; s=arc-20160816; b=r1Kan5hb6zkkkRB/KHZN7TfIzsfr8/Sbq8L2JRySgk59eDN1ipdWETkxAk87eNZ/6A FVC4MOPRZTmfkLZwbYfkLlDCUPneg/kR4WmxEVkThwIs2ybJQWGdNqCseJSjtLe/CT7l iX3hcxKHpV72Ujtr0R7VzMRydY6dXdd8iFbRfqkpGPqjs+IMXcG+NYKzAYKw2R79T0z1 /y3/MDc5Mgei82c9kjGziHFr4EKrVVsnJIRiJbKU30FdKYyrw+aLr33BVFaEHvshih0V sZTvTRzf4/RtncEvuGkApyNbHm4QD0Maq+Zcafqox4lAbMXMB5GLAvHAXYENMLnDRzQy tjig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dmarc-filter:delivered-to; bh=0+pkgazBNXhzJgGYrxqc2G4pe9z4fWujRrPiYkQUn+k=; fh=BpFCyCzVJo4znJIvOjeDfKzcGsF6Q+JgJbJ+1ev/kM4=; b=d3UdsWqiwadGz7a8Mu9jz4EZDPPg4PYmZC5DTMgDEfk+dK3FgYo8PtbDSYgAx+5XEO rKTQ5Adgs29sZDlBhR4NsRdNQ2pkwz2TDa023r74u8jCnhyikqaeJ/QCoxjymFcooEzT fCobdbPOCSP9LEUu88xJit0gqkUO3OiDqNdHgThl8oeTnuV4q4T1tSqd54GHeNJpbsXD 14+zbSi+hMbocQMCVYBOcawTh0eL9SnfWUh7qiNAAFedJedOmgxtwYmiH9PDXcfgOoJS svlsX8NMiLdIftxc7+SEmjuLjMnFLgsTFy24T21f5xSSws0v5DMAYTDhBmfuBWLAtlOu xfuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ti7-20020a170907c20700b009a606551a1dsi9941241ejc.766.2023.09.07.00.20.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 00:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 45C34388266D for ; Thu, 7 Sep 2023 07:15:13 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id C019D383139B for ; Thu, 7 Sep 2023 07:14:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C019D383139B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=loongson.cn Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qe9DA-0008DT-1F for gcc-patches@gcc.gnu.org; Thu, 07 Sep 2023 03:14:04 -0400 Received: from loongson.cn (unknown [10.10.130.252]) by gateway (Coremail) with SMTP id _____8CxRuguePlk4ychAA--.12933S3; Thu, 07 Sep 2023 15:13:50 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxDc8eePlkeDVwAA--.7050S7; Thu, 07 Sep 2023 15:13:48 +0800 (CST) From: Xiaolong Chen To: gcc-patches@gcc.gnu.org Subject: [PATCH v1 4/4] LoongArch:Add SX instructions for vector arithmetic operations other than multiplication, addition, and subtraction. Date: Thu, 7 Sep 2023 15:13:11 +0800 Message-Id: <20230907071311.23302-4-chenxiaolong@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230907071311.23302-1-chenxiaolong@loongson.cn> References: <20230907071311.23302-1-chenxiaolong@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxDc8eePlkeDVwAA--.7050S7 X-CM-SenderInfo: hfkh05xldrz0tqj6z05rqj20fqof0/1tbiAQAHBWT5TbUBjQAAsq X-Coremail-Antispam: 1Uk129KBj9UXoW7XFy5WFy8AF1kp5X_WF1rXr1Dpr12vr13Kr Wxua4YyryUtFyaqFWkAr92ya97JF47t3srKw1UGFsxXF13Ca4UAr1DtF9rWFy3tFyrGF4j qr47JwcCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXasCq-sGcS sGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVr nRJUUUk2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG6r Wj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr 1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8Jr0_ Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I8CrV ACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv67AKxVW8 JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Xr0_Ar1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAv wI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14 v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUcHUqUUUUU Received-SPF: pass client-ip=114.242.206.163; envelope-from=chenxiaolong@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, SPF_FAIL, SPF_HELO_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xiaolong Chen , xuchenghua@loongson.cn, chenglulu@loongson.cn, i@xen0n.name Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776362459982790491 X-GMAIL-MSGID: 1776362459982790491 gcc/testsuite/ChangeLog: * gcc.target/loongarch/vector/lsx/lsx-vavg-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vavg-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vavgr-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vavgr-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vdiv-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vdiv-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vexth-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vexth-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vldi.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmax-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmax-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmaxi-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmaxi-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmin-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmin-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmini-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmini-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmod-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmod-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmskgez.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmskltz.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vmsknz.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vneg.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vsat-1.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vsat-2.c: New test. * gcc.target/loongarch/vector/lsx/lsx-vsigncov.c: New test. --- .../loongarch/vector/lsx/lsx-vavg-1.c | 397 ++++++++++++++++ .../loongarch/vector/lsx/lsx-vavg-2.c | 307 +++++++++++++ .../loongarch/vector/lsx/lsx-vavgr-1.c | 298 ++++++++++++ .../loongarch/vector/lsx/lsx-vavgr-2.c | 316 +++++++++++++ .../loongarch/vector/lsx/lsx-vdiv-1.c | 298 ++++++++++++ .../loongarch/vector/lsx/lsx-vdiv-2.c | 253 ++++++++++ .../loongarch/vector/lsx/lsx-vexth-1.c | 341 ++++++++++++++ .../loongarch/vector/lsx/lsx-vexth-2.c | 181 ++++++++ .../loongarch/vector/lsx/lsx-vldi.c | 60 +++ .../loongarch/vector/lsx/lsx-vmax-1.c | 316 +++++++++++++ .../loongarch/vector/lsx/lsx-vmax-2.c | 361 +++++++++++++++ .../loongarch/vector/lsx/lsx-vmaxi-1.c | 278 +++++++++++ .../loongarch/vector/lsx/lsx-vmaxi-2.c | 222 +++++++++ .../loongarch/vector/lsx/lsx-vmin-1.c | 433 ++++++++++++++++++ .../loongarch/vector/lsx/lsx-vmin-2.c | 343 ++++++++++++++ .../loongarch/vector/lsx/lsx-vmini-1.c | 314 +++++++++++++ .../loongarch/vector/lsx/lsx-vmini-2.c | 216 +++++++++ .../loongarch/vector/lsx/lsx-vmod-1.c | 253 ++++++++++ .../loongarch/vector/lsx/lsx-vmod-2.c | 254 ++++++++++ .../loongarch/vector/lsx/lsx-vmskgez.c | 118 +++++ .../loongarch/vector/lsx/lsx-vmskltz.c | 320 +++++++++++++ .../loongarch/vector/lsx/lsx-vmsknz.c | 103 +++++ .../loongarch/vector/lsx/lsx-vneg.c | 320 +++++++++++++ .../loongarch/vector/lsx/lsx-vsat-1.c | 230 ++++++++++ .../loongarch/vector/lsx/lsx-vsat-2.c | 271 +++++++++++ .../loongarch/vector/lsx/lsx-vsigncov.c | 424 +++++++++++++++++ 26 files changed, 7227 insertions(+) create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavg-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavg-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavgr-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavgr-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vldi.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmax-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmax-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmaxi-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmaxi-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmin-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmin-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmini-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmini-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmskgez.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmskltz.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsknz.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vneg.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsigncov.c diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavg-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavg-1.c new file mode 100644 index 00000000000..c4d8696fe9f --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavg-1.c @@ -0,0 +1,397 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vavg_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfff8fff8fff8fff8; + *((unsigned long*)& __m128i_op0[0]) = 0xfff8fff8fff8fff8; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffcfffcfffcfffc; + *((unsigned long*)& __m128i_result[0]) = 0xfffcfffcfffcfffc; + __m128i_out = __lsx_vavg_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_vavg_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_vavg_b(__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]) = 0x4050000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x2028000000000000; + __m128i_out = __lsx_vavg_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_vavg_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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vavg_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_vavg_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op0[0]) = 0xc8847ef6ed3f2000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000014155445; + *((unsigned long*)& __m128i_result[1]) = 0x33f5c2d7d9f5d800; + *((unsigned long*)& __m128i_result[0]) = 0xe4c23ffb002a3a22; + __m128i_out = __lsx_vavg_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_vavg_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_vavg_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x007fffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000000f000e; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000000ffffe; + *((unsigned long*)& __m128i_result[1]) = 0x003fffff00070007; + *((unsigned long*)& __m128i_result[0]) = 0x000000000007ffff; + __m128i_out = __lsx_vavg_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_vavg_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000040; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000040; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000400028000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000004; + *((unsigned long*)& __m128i_result[1]) = 0x000000020001c020; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000022; + __m128i_out = __lsx_vavg_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]) = 0x08080807f5f5f5f8; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000000ff00; + *((unsigned long*)& __m128i_result[1]) = 0x04040403fafafafc; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ff80; + __m128i_out = __lsx_vavg_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x10f8000100000001; + *((unsigned long*)& __m128i_op0[0]) = 0x00000001000010f8; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x087c000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000087c; + __m128i_out = __lsx_vavg_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_vavg_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x5641127843c0d41e; + *((unsigned long*)& __m128i_op0[0]) = 0xfedb27095b6bff95; + *((unsigned long*)& __m128i_op1[1]) = 0xa8beed87bc3f2be1; + *((unsigned long*)& __m128i_op1[0]) = 0x0024d8f6a494006a; + *((unsigned long*)& __m128i_result[1]) = 0xff7fffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xff7fffffffffffff; + __m128i_out = __lsx_vavg_w(__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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff00007fff; + __m128i_out = __lsx_vavg_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffff80ff0010ff06; + *((unsigned long*)& __m128i_op0[0]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op1[1]) = 0xedfaedfaedfaedfa; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffff0000; + *((unsigned long*)& __m128i_result[1]) = 0xf6fd377cf705f680; + *((unsigned long*)& __m128i_result[0]) = 0xc0000000bfff8000; + __m128i_out = __lsx_vavg_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3ff0000000007fff; + *((unsigned long*)& __m128i_op0[0]) = 0x000000002bfd9461; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000f00; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffff00; + *((unsigned long*)& __m128i_result[1]) = 0x1ff800000000477f; + *((unsigned long*)& __m128i_result[0]) = 0x0000000015fec9b0; + __m128i_out = __lsx_vavg_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000006f; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000037; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_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_vavg_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_result[0]) = 0x003fffff00000000; + __m128i_out = __lsx_vavg_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_vavg_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000800000008000; + *((unsigned long*)& __m128i_result[0]) = 0x0000800000008000; + __m128i_out = __lsx_vavg_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xd6a09e662ab46b31; + *((unsigned long*)& __m128i_op0[0]) = 0x34b8122ef4054bb3; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xeb504f33155a3598; + *((unsigned long*)& __m128i_result[0]) = 0x1a5c0917fa02a5d9; + __m128i_out = __lsx_vavg_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0177fff0fffffff0; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000011ff8bc; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffefffff784; + *((unsigned long*)& __m128i_result[1]) = 0x00bbfff7fffffff7; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff008ff820; + __m128i_out = __lsx_vavg_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x00001802041b0014; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000c01020d8009; + __m128i_out = __lsx_vavg_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]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000201000000000b; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffff0000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000200000000; + *((unsigned long*)& __m128i_result[1]) = 0x000000007fff8000; + *((unsigned long*)& __m128i_result[0]) = 0x0001008100000005; + __m128i_out = __lsx_vavg_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfc01fd1300000001; + *((unsigned long*)& __m128i_op0[0]) = 0xfe00fd1400010000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000fff7fc01; + *((unsigned long*)& __m128i_result[1]) = 0xfe00fe8980000000; + *((unsigned long*)& __m128i_result[0]) = 0xff007e8a7ffc7e00; + __m128i_out = __lsx_vavg_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_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]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vavg_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_vavg_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]) = 0xfffffffe00000002; + *((unsigned long*)& __m128i_op1[0]) = 0xffffff46000000ba; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffa30000005c; + __m128i_out = __lsx_vavg_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000070007; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000007ffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000068; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000038003; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000040033; + __m128i_out = __lsx_vavg_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]) = 0xffffffff0000ac26; + *((unsigned long*)& __m128i_op1[0]) = 0x00ff000000000001; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff80005613; + *((unsigned long*)& __m128i_result[0]) = 0x007f800000000000; + __m128i_out = __lsx_vavg_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000040000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000040000000; + *((unsigned long*)& __m128i_op1[1]) = 0x7f8000007f800000; + *((unsigned long*)& __m128i_op1[0]) = 0x7f8000007f800000; + *((unsigned long*)& __m128i_result[1]) = 0x3fc000005fc00000; + *((unsigned long*)& __m128i_result[0]) = 0x3fc000005fc00000; + __m128i_out = __lsx_vavg_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]) = 0x0000000000020000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000010000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_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]) = 0x0000000200000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0002000200000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100000000; + __m128i_out = __lsx_vavg_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000fffe0001; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff0001fffe; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffff0000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff0000ffff; + __m128i_out = __lsx_vavg_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-vavg-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavg-2.c new file mode 100644 index 00000000000..f707bddf2b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavg-2.c @@ -0,0 +1,307 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x7f7f7f7f7f7f7f7f; + *((unsigned long*)& __m128i_result[0]) = 0x7f7f7f7f7f7f7f7f; + __m128i_out = __lsx_vavg_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_result[0]) = 0x7f7f7f7f7f7f7f7f; + __m128i_out = __lsx_vavg_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x7f7f7f7f7f7f7f7f; + *((unsigned long*)& __m128i_result[0]) = 0x7f7f7f7f7f7f7f7f; + __m128i_out = __lsx_vavg_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000100000001000; + *((unsigned long*)& __m128i_op0[0]) = 0x37b951002d81a921; + *((unsigned long*)& __m128i_op1[1]) = 0x000000400000004c; + *((unsigned long*)& __m128i_op1[0]) = 0x000047404f4f040d; + *((unsigned long*)& __m128i_result[1]) = 0x0000082000000826; + *((unsigned long*)& __m128i_result[0]) = 0x1b5c4c203e685617; + __m128i_out = __lsx_vavg_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00c2758000bccf42; + *((unsigned long*)& __m128i_op0[0]) = 0x00a975be00accf03; + *((unsigned long*)& __m128i_op1[1]) = 0x00c2758000bccf42; + *((unsigned long*)& __m128i_op1[0]) = 0x00a975be00accf03; + *((unsigned long*)& __m128i_result[1]) = 0x00c2758000bccf42; + *((unsigned long*)& __m128i_result[0]) = 0x00a975be00accf03; + __m128i_out = __lsx_vavg_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0100000001000100; + *((unsigned long*)& __m128i_op0[0]) = 0x0100010000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffff732a; + *((unsigned long*)& __m128i_result[1]) = 0x807f7fff807f807f; + *((unsigned long*)& __m128i_result[0]) = 0x807f807f7fff3995; + __m128i_out = __lsx_vavg_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000007f7f7f7f; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffff0; + *((unsigned long*)& __m128i_result[1]) = 0x000000003fbf3fbf; + *((unsigned long*)& __m128i_result[0]) = 0x7fff7fff7fff7ff8; + __m128i_out = __lsx_vavg_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0101010101010101; + *((unsigned long*)& __m128i_op0[0]) = 0x353c8cc4b1ec5b09; + *((unsigned long*)& __m128i_op1[1]) = 0xffff00000000ffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x8080008000808080; + *((unsigned long*)& __m128i_result[0]) = 0x1a9e466258f62d84; + __m128i_out = __lsx_vavg_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000158; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000000000ac; + __m128i_out = __lsx_vavg_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x9c9c9c9c00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000020; + *((unsigned long*)& __m128i_result[1]) = 0x4e4e4e4e00000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000010; + __m128i_out = __lsx_vavg_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000868686868686; + *((unsigned long*)& __m128i_op1[1]) = 0x1e1e1e1e1e1e1e1e; + *((unsigned long*)& __m128i_op1[0]) = 0x1e1e1e1e1e1e1e1e; + *((unsigned long*)& __m128i_result[1]) = 0x0f0f0f0f0f0f0f0f; + *((unsigned long*)& __m128i_result[0]) = 0x0f0f525252525252; + __m128i_out = __lsx_vavg_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000014eb54ab; + *((unsigned long*)& __m128i_op0[0]) = 0x14eb6a002a406a00; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffdfdc0d; + *((unsigned long*)& __m128i_result[1]) = 0x000000000a752a55; + *((unsigned long*)& __m128i_result[0]) = 0x0a753500950fa306; + __m128i_out = __lsx_vavg_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffff00010000fff; + *((unsigned long*)& __m128i_op0[0]) = 0xfffff00010000fff; + *((unsigned long*)& __m128i_op1[1]) = 0xfffff00010000fff; + *((unsigned long*)& __m128i_op1[0]) = 0xfffff00010000fff; + *((unsigned long*)& __m128i_result[1]) = 0xfffff00010000fff; + *((unsigned long*)& __m128i_result[0]) = 0xfffff00010000fff; + __m128i_out = __lsx_vavg_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000002ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000017fffffff; + __m128i_out = __lsx_vavg_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0101000100010001; + *((unsigned long*)& __m128i_op1[0]) = 0x0101030100010001; + *((unsigned long*)& __m128i_result[1]) = 0x0080800000008000; + *((unsigned long*)& __m128i_result[0]) = 0x0080818000008000; + __m128i_out = __lsx_vavg_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000400000004; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000400000004; + *((unsigned long*)& __m128i_result[1]) = 0x0000000200000002; + *((unsigned long*)& __m128i_result[0]) = 0x0000000200000002; + __m128i_out = __lsx_vavg_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0017004800c400f9; + *((unsigned long*)& __m128i_op0[0]) = 0x00ed001a00580070; + *((unsigned long*)& __m128i_op1[1]) = 0xffffff7ffffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000fffffffe; + *((unsigned long*)& __m128i_result[1]) = 0x800b7fe38062007b; + *((unsigned long*)& __m128i_result[0]) = 0x0076800d802c0037; + __m128i_out = __lsx_vavg_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff80ffa2fff0ff74; + *((unsigned long*)& __m128i_op0[0]) = 0xff76ffd8ffe6ffaa; + *((unsigned long*)& __m128i_op1[1]) = 0xc0b4d1a5f8babad3; + *((unsigned long*)& __m128i_op1[0]) = 0xbbc8ecc5f3ced5f3; + *((unsigned long*)& __m128i_result[1]) = 0xe01ae8a3fc55dd23; + *((unsigned long*)& __m128i_result[0]) = 0xdd9ff64ef9daeace; + __m128i_out = __lsx_vavg_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000007fffffff; + __m128i_out = __lsx_vavg_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3f80000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x3f80000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ff000000ff00; + *((unsigned long*)& __m128i_result[1]) = 0x1fc0000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x1fc07f8000007f80; + __m128i_out = __lsx_vavg_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000043cf26c7; + *((unsigned long*)& __m128i_op1[0]) = 0x0000e31d4cae8636; + *((unsigned long*)& __m128i_result[1]) = 0x0000000021e79364; + *((unsigned long*)& __m128i_result[0]) = 0x0000718ea657431b; + __m128i_out = __lsx_vavg_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xfff0000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xfff0000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x7ff8000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x7ff8000000000000; + __m128i_out = __lsx_vavg_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavg_du(__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]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_op1[0]) = 0xf931fd04f832fe02; + *((unsigned long*)& __m128i_result[1]) = 0x80007fc000003f00; + *((unsigned long*)& __m128i_result[0]) = 0x7d187e427c993f80; + __m128i_out = __lsx_vavg_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavgr-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavgr-1.c new file mode 100644 index 00000000000..f783dd9c6a9 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavgr-1.c @@ -0,0 +1,298 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0000800000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0040000000ff00ff; + *((unsigned long*)& __m128i_op1[0]) = 0x0040000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0020000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0020c00000000000; + __m128i_out = __lsx_vavgr_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xb9fe3640e4eb1b18; + *((unsigned long*)& __m128i_op0[0]) = 0x800000005b4b1b18; + *((unsigned long*)& __m128i_op1[1]) = 0xfffd000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xdcfe1b20f2f60e0c; + *((unsigned long*)& __m128i_result[0]) = 0xc00000002e260e0c; + __m128i_out = __lsx_vavgr_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x111110ff11111141; + *((unsigned long*)& __m128i_op0[0]) = 0x1111113111111121; + *((unsigned long*)& __m128i_op1[1]) = 0xfbffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x7bffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x060808ff08080820; + *((unsigned long*)& __m128i_result[0]) = 0x4608081808080810; + __m128i_out = __lsx_vavgr_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000010; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000010; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000000fff0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000008; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000ac26; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff80000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000060000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000003000000d613; + *((unsigned long*)& __m128i_result[0]) = 0x00000000c0000000; + __m128i_out = __lsx_vavgr_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_vavgr_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffe5; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffe5; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffff2; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff2; + __m128i_out = __lsx_vavgr_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000073; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000002a; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000003a; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000015; + __m128i_out = __lsx_vavgr_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]) = 0x0000000000004000; + *((unsigned long*)& __m128i_op1[0]) = 0xfff8004000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000002000; + *((unsigned long*)& __m128i_result[0]) = 0xfffc002000000000; + __m128i_out = __lsx_vavgr_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000002000; + *((unsigned long*)& __m128i_op0[0]) = 0xfffc002000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000002000; + *((unsigned long*)& __m128i_op1[0]) = 0xfffc002000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000002000; + *((unsigned long*)& __m128i_result[0]) = 0xfffc002000000000; + __m128i_out = __lsx_vavgr_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000ff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x000000ff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000ff00000000; + __m128i_out = __lsx_vavgr_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]) = 0x000000007fff0018; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000003fff800c; + __m128i_out = __lsx_vavgr_w(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0280000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x7500000075000000; + *((unsigned long*)& __m128i_op1[0]) = 0x7500000075000000; + *((unsigned long*)& __m128i_result[1]) = 0x3a8000003a800000; + *((unsigned long*)& __m128i_result[0]) = 0x3bc000003a800000; + __m128i_out = __lsx_vavgr_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffff800000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00007d1800007c99; + *((unsigned long*)& __m128i_op1[1]) = 0x0a0000001e000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0a621b3ebe5e1c02; + *((unsigned long*)& __m128i_result[1]) = 0x04ffc0000f000000; + *((unsigned long*)& __m128i_result[0]) = 0x05314c2bdf2f4c4e; + __m128i_out = __lsx_vavgr_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000002000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000002000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000001000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000001000000000; + __m128i_out = __lsx_vavgr_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff80000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_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]) = 0x7f8000007f800000; + *((unsigned long*)& __m128i_op1[0]) = 0x7f8000007f800000; + *((unsigned long*)& __m128i_result[1]) = 0x3fc000003fc00000; + *((unsigned long*)& __m128i_result[0]) = 0x3fc000003fc00000; + __m128i_out = __lsx_vavgr_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]) = 0x7fffffff7fffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x3fffffffc0000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_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]) = 0xff00ff00ff00ff00; + *((unsigned long*)& __m128i_op1[0]) = 0xff00ff00ff00ff00; + *((unsigned long*)& __m128i_result[1]) = 0xff807f807f807f80; + *((unsigned long*)& __m128i_result[0]) = 0xff807f807f807f80; + __m128i_out = __lsx_vavgr_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000002; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000002; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000280000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000140001; + __m128i_out = __lsx_vavgr_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffff46; + *((unsigned long*)& __m128i_op1[1]) = 0x00fe00fe00fe00fe; + *((unsigned long*)& __m128i_op1[0]) = 0x00fe00fe00fe0045; + *((unsigned long*)& __m128i_result[1]) = 0x007f007f007f007e; + *((unsigned long*)& __m128i_result[0]) = 0x007f007f007effc6; + __m128i_out = __lsx_vavgr_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_vavgr_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_vavgr_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op0[0]) = 0xc8847ef6ed3f2000; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[1]) = 0x33f5c2d7d975d7fe; + *((unsigned long*)& __m128i_result[0]) = 0xe4423f7b769f8ffe; + __m128i_out = __lsx_vavgr_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_vavgr_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000003ff8; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xff9dff9dff9dff9d; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffceffceffcf1fcb; + __m128i_out = __lsx_vavgr_d(__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]) = 0x1d4000001d400000; + *((unsigned long*)& __m128i_result[0]) = 0x1e5f007f5d400000; + __m128i_out = __lsx_vavgr_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000ff00; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000800000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000400000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000007f80; + __m128i_out = __lsx_vavgr_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-vavgr-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavgr-2.c new file mode 100644 index 00000000000..819ec24c632 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vavgr-2.c @@ -0,0 +1,316 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0xfffffffff8f8dada; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff01018888; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffff8f8dada; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff01018888; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffff8f8dada; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff01018888; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x7fffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x4080808080808080; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op0[0]) = 0x000000010000003f; + *((unsigned long*)& __m128i_op1[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op1[0]) = 0x000000010000003f; + *((unsigned long*)& __m128i_result[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_result[0]) = 0x000000010000003f; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000ffffffff0000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffff00; + *((unsigned long*)& __m128i_op1[1]) = 0x1817161517161514; + *((unsigned long*)& __m128i_op1[0]) = 0x1615141315141312; + *((unsigned long*)& __m128i_result[1]) = 0x0c0c8b8a8b8b0b0a; + *((unsigned long*)& __m128i_result[0]) = 0x8b8a8a898a8a8909; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00003fff00003fff; + *((unsigned long*)& __m128i_op0[0]) = 0x00003fff00003fff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000208000002080; + *((unsigned long*)& __m128i_result[0]) = 0x0000208000002080; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffd60015; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x80808080806b000b; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff010181010102; + *((unsigned long*)& __m128i_op0[0]) = 0x7fffffff81010102; + *((unsigned long*)& __m128i_op1[1]) = 0x7fff010181010102; + *((unsigned long*)& __m128i_op1[0]) = 0x7fffffff81010102; + *((unsigned long*)& __m128i_result[1]) = 0x7fff010181010102; + *((unsigned long*)& __m128i_result[0]) = 0x7fffffff81010102; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_hu(__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]) = 0xc1bdceee242071db; + *((unsigned long*)& __m128i_op1[0]) = 0xe8c7b756d76aa578; + *((unsigned long*)& __m128i_result[1]) = 0xe0dee7779210b8ed; + *((unsigned long*)& __m128i_result[0]) = 0xf463dbabebb5d2bc; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff80000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xff80000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xff80000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xff80000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xff80000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xff80000000000000; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000800000008; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00007fff00007fff; + *((unsigned long*)& __m128i_op1[0]) = 0x000000002bfd9461; + *((unsigned long*)& __m128i_result[1]) = 0x0000400400004004; + *((unsigned long*)& __m128i_result[0]) = 0x0000000015ff4a31; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x2a7b7c9260f90ee2; + *((unsigned long*)& __m128i_op1[0]) = 0x1b1c6cdfd57f5736; + *((unsigned long*)& __m128i_result[1]) = 0x153e3e49307d0771; + *((unsigned long*)& __m128i_result[0]) = 0x0d8e36706ac02b9b; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xdd6156076967d8c9; + *((unsigned long*)& __m128i_op0[0]) = 0x2e3ab5266375e71b; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000400000004; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000400000004; + *((unsigned long*)& __m128i_result[1]) = 0x6eb12b0634b46c67; + *((unsigned long*)& __m128i_result[0]) = 0x171d5a9531bb7390; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000f50000000900; + *((unsigned long*)& __m128i_op0[0]) = 0x0000090900000998; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00007a8000000480; + *((unsigned long*)& __m128i_result[0]) = 0x00000485000004cc; + __m128i_out = __lsx_vavgr_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00003ff000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000fffc00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0xfffc001fffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x00001ff800000001; + *((unsigned long*)& __m128i_result[0]) = 0x7ffe800e80000000; + __m128i_out = __lsx_vavgr_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ffff53d9; + *((unsigned long*)& __m128i_op0[0]) = 0xff000001ffff9515; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x000000007fffa9ed; + *((unsigned long*)& __m128i_result[0]) = 0x7f8000017fffca8b; + __m128i_out = __lsx_vavgr_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffdfffffff8; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x7fffffff7ffffffc; + __m128i_out = __lsx_vavgr_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000001fffeff98; + *((unsigned long*)& __m128i_op0[0]) = 0x0014ffe4ff76ffc4; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x3131313131313131; + *((unsigned long*)& __m128i_result[1]) = 0x000000017fff7fcc; + *((unsigned long*)& __m128i_result[0]) = 0x18a3188b9854187b; + __m128i_out = __lsx_vavgr_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffff0000ffff0000; + *((unsigned long*)& __m128i_op0[0]) = 0xffff000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffff0000ffff0000; + *((unsigned long*)& __m128i_op1[0]) = 0xffff000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffff0000ffff0000; + *((unsigned long*)& __m128i_result[0]) = 0xffff000000000000; + __m128i_out = __lsx_vavgr_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000001c88bf0; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000001c88bf0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000001c88bf0; + __m128i_out = __lsx_vavgr_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x807fffff80800000; + *((unsigned long*)& __m128i_op1[1]) = 0x0006000000040000; + *((unsigned long*)& __m128i_op1[0]) = 0x0002000000000007; + *((unsigned long*)& __m128i_result[1]) = 0x8003000000020000; + *((unsigned long*)& __m128i_result[0]) = 0x4040ffffc0400004; + __m128i_out = __lsx_vavgr_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000010000010101; + *((unsigned long*)& __m128i_op0[0]) = 0x0101000001000100; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x8000008000008080; + *((unsigned long*)& __m128i_result[0]) = 0x8080800000800080; + __m128i_out = __lsx_vavgr_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vavgr_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-1.c new file mode 100644 index 00000000000..ca672762a5a --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-1.c @@ -0,0 +1,298 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3ff0000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x40f3fa0000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffb4ff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffb4ff; + *((unsigned long*)& __m128i_result[1]) = 0xc110000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xc00d060000000000; + __m128i_out = __lsx_vdiv_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vdiv_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000020000; + *((unsigned long*)& __m128i_op0[0]) = 0x0101000101010001; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000fe0000; + *((unsigned long*)& __m128i_result[0]) = 0xffff00ffffff00ff; + __m128i_out = __lsx_vdiv_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0101010100000000; + *((unsigned long*)& __m128i_result[0]) = 0x0101010100000000; + __m128i_out = __lsx_vdiv_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xd3259a2984048c23; + *((unsigned long*)& __m128i_op1[0]) = 0xf9796558e39953fd; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffff9727ffff9727; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffe79ffffba5f; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x010169d9010169d9; + *((unsigned long*)& __m128i_result[0]) = 0x01010287010146a1; + __m128i_out = __lsx_vdiv_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000897957687; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000408; + *((unsigned long*)& __m128i_op1[1]) = 0x80010001b57fc565; + *((unsigned long*)& __m128i_op1[0]) = 0x8001000184000be0; + *((unsigned long*)& __m128i_result[1]) = 0x000000080001fffe; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffff9cf0d77b; + *((unsigned long*)& __m128i_op1[0]) = 0xc1000082b0fb585b; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_op0[0]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_op1[1]) = 0x33f5c2d7d975d7fe; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000ff010000ff01; + __m128i_out = __lsx_vdiv_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000feff23560000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000fd1654860000; + *((unsigned long*)& __m128i_op1[1]) = 0x6363636363abdf16; + *((unsigned long*)& __m128i_op1[0]) = 0x41f8e08016161198; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000030000; + __m128i_out = __lsx_vdiv_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x4f4f4f4f4f4f4f4f; + *((unsigned long*)& __m128i_op1[0]) = 0x4f4f4f4f4f4f4f4f; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00003ff000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000fffc00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00001ff800000001; + *((unsigned long*)& __m128i_op1[0]) = 0x7ffe800e80000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000200000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x195f307a5d04acbb; + *((unsigned long*)& __m128i_op0[0]) = 0x6a1a3fbb3c90260e; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xe6a0cf86a2fb5345; + *((unsigned long*)& __m128i_result[0]) = 0x95e5c045c36fd9f2; + __m128i_out = __lsx_vdiv_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000; + __m128i_out = __lsx_vdiv_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x4f804f804f804f80; + *((unsigned long*)& __m128i_op1[0]) = 0x4f804f804f804f80; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x000fffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0010000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op1[0]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xa2e3a36363636363; + *((unsigned long*)& __m128i_op0[0]) = 0xa2e3a36463636363; + *((unsigned long*)& __m128i_op1[1]) = 0x7f80000000000007; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000700000007; + *((unsigned long*)& __m128i_result[1]) = 0x000000000e32c50e; + *((unsigned long*)& __m128i_result[0]) = 0xf2b2ce330e32c50e; + __m128i_out = __lsx_vdiv_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff00000001; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000001; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x52527d7d52527d7d; + *((unsigned long*)& __m128i_op0[0]) = 0x52527d7d52527d7d; + *((unsigned long*)& __m128i_op1[1]) = 0x52527d7d52527d7d; + *((unsigned long*)& __m128i_op1[0]) = 0x52527d7d52527d7d; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op0[0]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x8000000080000000; + *((unsigned long*)& __m128i_result[0]) = 0x8000000080000000; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xe93d0bd19ff0c170; + *((unsigned long*)& __m128i_op1[0]) = 0x5237c1bac9eadf55; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x003fffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000003dffc2; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000003dffc2; + *((unsigned long*)& __m128i_result[1]) = 0x00000001084314a6; + *((unsigned long*)& __m128i_result[0]) = 0x00000001084314a6; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000ffef0010000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000010000010101; + *((unsigned long*)& __m128i_op1[0]) = 0x0101000001000100; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x4280000042800000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xbd7fffffbd800000; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_op1[1]) = 0x30eb022002101b20; + *((unsigned long*)& __m128i_op1[0]) = 0x020310edc003023d; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000002000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000002000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000000004ff; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x000000000667ae56; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000020; + __m128i_out = __lsx_vdiv_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-2.c new file mode 100644 index 00000000000..23a3f4ecb8c --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vdiv-2.c @@ -0,0 +1,253 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffefffffffef; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffefffffffef; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xe3e3e3e3e3e3e3e3; + *((unsigned long*)& __m128i_op1[1]) = 0xe3e3e3e3e3e3e3e3; + *((unsigned long*)& __m128i_op1[0]) = 0xe3e3e3e3e3e3e3e3; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vdiv_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vdiv_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0006000000040000; + *((unsigned long*)& __m128i_op0[0]) = 0x0002000000000007; + *((unsigned long*)& __m128i_op1[1]) = 0x31b1777777777776; + *((unsigned long*)& __m128i_op1[0]) = 0x6eee282828282829; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0101010101010101; + *((unsigned long*)& __m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vdiv_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000010100000101; + *((unsigned long*)& __m128i_op0[0]) = 0x0000010100000101; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0effeffefdffa1e0; + *((unsigned long*)& __m128i_op0[0]) = 0xe6004c5f64284224; + *((unsigned long*)& __m128i_op1[1]) = 0xfeffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xfeffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0001000000010000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x10f917d72d3d01e4; + *((unsigned long*)& __m128i_op1[0]) = 0x203e16d116de012b; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000073; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000002a; + *((unsigned long*)& __m128i_op1[1]) = 0x00ffffff00ff00ff; + *((unsigned long*)& __m128i_op1[0]) = 0x00ff00ffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000003f200001e01; + *((unsigned long*)& __m128i_op0[0]) = 0x000014bf000019da; + *((unsigned long*)& __m128i_op1[1]) = 0x9c9c99aed5b88fcf; + *((unsigned long*)& __m128i_op1[0]) = 0x7c3650c5f79a61a3; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0002000200020002; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x8080808080808080; + *((unsigned long*)& __m128i_op1[0]) = 0x8080808080800008; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffd700; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffff00; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffff00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000000; + __m128i_out = __lsx_vdiv_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000ffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ffffffdfffdf; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000ff00; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffbfff8; + *((unsigned long*)& __m128i_op1[1]) = 0x0080008000800080; + *((unsigned long*)& __m128i_op1[0]) = 0x0080006b0000000b; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000001ff1745745c; + __m128i_out = __lsx_vdiv_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff14eb54ab; + *((unsigned long*)& __m128i_op0[0]) = 0x14ea6a002a406a00; + *((unsigned long*)& __m128i_op1[1]) = 0xffff80008a7555aa; + *((unsigned long*)& __m128i_op1[0]) = 0x0a7535006af05cf9; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000200000000; + __m128i_out = __lsx_vdiv_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0141010101410101; + *((unsigned long*)& __m128i_op0[0]) = 0x0141010101410101; + *((unsigned long*)& __m128i_op1[1]) = 0xfebffefffebffeff; + *((unsigned long*)& __m128i_op1[0]) = 0xfebffefffebffeff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x6363797c63996399; + *((unsigned long*)& __m128i_op0[0]) = 0x171f0a1f6376441f; + *((unsigned long*)& __m128i_op1[1]) = 0x6363797c63996399; + *((unsigned long*)& __m128i_op1[0]) = 0x171f0a1f6376441f; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vdiv_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000036de0000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000003be14000; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000000006f; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000001f0a; + *((unsigned long*)& __m128i_result[1]) = 0x00000000007e8a60; + *((unsigned long*)& __m128i_result[0]) = 0x000000000001edde; + __m128i_out = __lsx_vdiv_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000015d926c7; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000000e41b; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x77c0404a4000403a; + *((unsigned long*)& __m128i_op0[0]) = 0x77c03fd640003fc6; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vdiv_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0042003e0042002f; + *((unsigned long*)& __m128i_op0[0]) = 0x0001fffc0001fffc; + *((unsigned long*)& __m128i_op1[1]) = 0x0042003e0042002f; + *((unsigned long*)& __m128i_op1[0]) = 0x0001fffc0001fffc; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vdiv_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000feff2356; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000fd165486; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000007; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000007; + *((unsigned long*)& __m128i_result[1]) = 0x00000000246d9755; + *((unsigned long*)& __m128i_result[0]) = 0x000000002427c2ee; + __m128i_out = __lsx_vdiv_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-1.c new file mode 100644 index 00000000000..72d1e3c7da2 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-1.c @@ -0,0 +1,341 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x007fffff00000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000f909; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000ffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffff01ff01; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1010111105050000; + *((unsigned long*)& __m128i_op0[0]) = 0x4040000041410101; + *((unsigned long*)& __m128i_result[1]) = 0x0010001000110011; + *((unsigned long*)& __m128i_result[0]) = 0x0005000500000000; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000000003e2; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000003ffe2; + __m128i_out = __lsx_vexth_h_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffffffffffe; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffe; + __m128i_out = __lsx_vexth_w_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3ff0000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00003ff000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_w_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x03c0000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x03c0038000000380; + *((unsigned long*)& __m128i_result[1]) = 0x000003c000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_w_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_w_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xb9fe3640e4eb1b18; + *((unsigned long*)& __m128i_op0[0]) = 0x800000005b4b1b18; + *((unsigned long*)& __m128i_result[1]) = 0xffffb9fe00003640; + *((unsigned long*)& __m128i_result[0]) = 0xffffe4eb00001b18; + __m128i_out = __lsx_vexth_w_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x370bdfec00130014; + *((unsigned long*)& __m128i_op0[0]) = 0x370bdfec00130014; + *((unsigned long*)& __m128i_result[1]) = 0x0000370bffffdfec; + *((unsigned long*)& __m128i_result[0]) = 0x0000001300000014; + __m128i_out = __lsx_vexth_w_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xe500c085c000c005; + *((unsigned long*)& __m128i_op0[0]) = 0xe5c1a185c48004c5; + *((unsigned long*)& __m128i_result[1]) = 0xffffe500ffffc085; + *((unsigned long*)& __m128i_result[0]) = 0xffffc000ffffc005; + __m128i_out = __lsx_vexth_w_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_w_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_w_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000010000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_d_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x5c9c9c9ce3636363; + *((unsigned long*)& __m128i_op0[0]) = 0x63635c9e63692363; + *((unsigned long*)& __m128i_result[1]) = 0x000000005c9c9c9c; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffe3636363; + __m128i_out = __lsx_vexth_d_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x63b2ac27aa076aeb; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000063b2ac27; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffaa076aeb; + __m128i_out = __lsx_vexth_d_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x002a001a001a000b; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00000000002a001a; + *((unsigned long*)& __m128i_result[0]) = 0x00000000001a000b; + __m128i_out = __lsx_vexth_d_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0028280000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x012927ffff272800; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0028280000000000; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000ff0000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000ff000000ff; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000005; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000005; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000005; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000020000020; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000020000020; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000020000020; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000fff0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffc; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000080; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000080; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3a8000003a800000; + *((unsigned long*)& __m128i_op0[0]) = 0x000ef0000000003b; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x3a8000003a800000; + __m128i_out = __lsx_vexth_q_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-2.c new file mode 100644 index 00000000000..6ce9628bb63 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vexth-2.c @@ -0,0 +1,181 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_hu_bu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_hu_bu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_hu_bu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x4f804f804f804f80; + *((unsigned long*)& __m128i_op0[0]) = 0x4f804f804f804f80; + *((unsigned long*)& __m128i_result[1]) = 0x004f0080004f0080; + *((unsigned long*)& __m128i_result[0]) = 0x004f0080004f0080; + __m128i_out = __lsx_vexth_hu_bu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_hu_bu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffff007f00000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffff007f00000000; + *((unsigned long*)& __m128i_result[1]) = 0x00ff00ff0000007f; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_hu_bu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffffffa; + *((unsigned long*)& __m128i_result[1]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_result[0]) = 0x00ff00ff00ff00ff; + __m128i_out = __lsx_vexth_hu_bu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + int_out = __lsx_vpickve2gr_b(__m128i_op0,0x5); + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_hu_bu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x007fffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x002cffacffacffab; + *((unsigned long*)& __m128i_result[1]) = 0x0000007f00ff00ff; + *((unsigned long*)& __m128i_result[0]) = 0x00ff00ff00ff00ff; + __m128i_out = __lsx_vexth_hu_bu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000082020201; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000820200000201; + __m128i_out = __lsx_vexth_wu_hu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010012; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000fec20704; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000012; + __m128i_out = __lsx_vexth_wu_hu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffffff; + __m128i_out = __lsx_vexth_du_wu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x7fffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_du_wu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_du_wu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000001000100; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_du_wu(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000001000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000001000001; + __m128i_out = __lsx_vexth_qu_du(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000b5207f80; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_qu_du(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000fff7fc01; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_qu_du(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0002000000020000; + *((unsigned long*)& __m128i_op0[0]) = 0x000001fc00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0002000000020000; + __m128i_out = __lsx_vexth_qu_du(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000b4a00008808; + *((unsigned long*)& __m128i_op0[0]) = 0x0808080800000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000b4a00008808; + __m128i_out = __lsx_vexth_qu_du(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_qu_du(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000400080003fff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000bc2000007e10; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000400080003fff; + __m128i_out = __lsx_vexth_qu_du(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vexth_qu_du(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vldi.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vldi.c new file mode 100644 index 00000000000..6d180833c0e --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vldi.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_result[1]) = 0x00a300a300a300a3; + *((unsigned long*)& __m128i_result[0]) = 0x00a300a300a300a3; + __m128i_out = __lsx_vldi(1187); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffe15; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffe15; + __m128i_out = __lsx_vldi(3605); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_result[1]) = 0xecececececececec; + *((unsigned long*)& __m128i_result[0]) = 0xecececececececec; + __m128i_out = __lsx_vldi(1004); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_result[1]) = 0x00ffff00ff00ff00; + *((unsigned long*)& __m128i_result[0]) = 0x00ffff00ff00ff00; + __m128i_out = __lsx_vldi(-1686); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_hu(__m128i_op0,0x3); + *((unsigned long*)& __m128i_result[1]) = 0x004d004d004d004d; + *((unsigned long*)& __m128i_result[0]) = 0x004d004d004d004d; + __m128i_out = __lsx_vldi(1101); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_result[1]) = 0x0a0000000a000000; + *((unsigned long*)& __m128i_result[0]) = 0x0a0000000a000000; + __m128i_out = __lsx_vldi(-3318); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_result[1]) = 0x00ffff00ff00ff00; + *((unsigned long*)& __m128i_result[0]) = 0x00ffff00ff00ff00; + __m128i_out = __lsx_vldi(-1686); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_result[1]) = 0x0a0000000a000000; + *((unsigned long*)& __m128i_result[0]) = 0x0a0000000a000000; + __m128i_out = __lsx_vldi(-3318); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmax-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmax-1.c new file mode 100644 index 00000000000..01cef8ac8a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmax-1.c @@ -0,0 +1,316 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0000ffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmax_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_vmax_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff7fff7fff7fff; + *((unsigned long*)& __m128i_op0[0]) = 0x000000010000003f; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x7f007f007f007f00; + *((unsigned long*)& __m128i_result[0]) = 0x000000010000003f; + __m128i_out = __lsx_vmax_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[1]) = 0xfffff00010000fff; + *((unsigned long*)& __m128i_op1[0]) = 0xfffff00010000fff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000010000f00; + *((unsigned long*)& __m128i_result[0]) = 0x0000000010000f01; + __m128i_out = __lsx_vmax_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffcfffcfffcfffd; + *((unsigned long*)& __m128i_op0[0]) = 0xfffcfffdfffcfffd; + *((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_vmax_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffff80df00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0010100000100000; + *((unsigned long*)& __m128i_op1[0]) = 0x1000100000101000; + *((unsigned long*)& __m128i_result[1]) = 0x0010100000100000; + *((unsigned long*)& __m128i_result[0]) = 0x1000100000101000; + __m128i_out = __lsx_vmax_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_vmax_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0040000000ff00ff; + *((unsigned long*)& __m128i_op0[0]) = 0x0040000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0040000000ff00ff; + *((unsigned long*)& __m128i_result[0]) = 0x0040000000000000; + __m128i_out = __lsx_vmax_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_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]) = 0x0000000001000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0001000100000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000001000001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100000000; + __m128i_out = __lsx_vmax_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_vmax_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]) = 0xb327b9363c992b2e; + *((unsigned long*)& __m128i_op1[0]) = 0xa1e7b475d925730f; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff3c992b2e; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffff730f; + __m128i_out = __lsx_vmax_h(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000000001ff; + *((unsigned long*)& __m128i_result[1]) = 0x4101010141010100; + *((unsigned long*)& __m128i_result[0]) = 0x00000000000001ff; + __m128i_out = __lsx_vmax_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_vmax_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_vmax_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000003dffc2; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000003dffc2; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00000000003d0000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000003d0000; + __m128i_out = __lsx_vmax_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_vmax_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0007001400000014; + *((unsigned long*)& __m128i_op0[0]) = 0x0004001000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000000053a; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000700140000053a; + *((unsigned long*)& __m128i_result[0]) = 0x0004001000000000; + __m128i_out = __lsx_vmax_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_vmax_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000034; + *((unsigned long*)& __m128i_op1[1]) = 0xffff80c400000148; + *((unsigned long*)& __m128i_op1[0]) = 0xffff80c1ffffe8de; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000148; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000034; + __m128i_out = __lsx_vmax_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmax_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0008000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00ff000000ff0000; + *((unsigned long*)& __m128i_result[1]) = 0x0008000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00ff000000ff0000; + __m128i_out = __lsx_vmax_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op0[0]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op1[1]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op1[0]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_result[1]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_result[0]) = 0x000a000a000a000a; + __m128i_out = __lsx_vmax_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]) = 0xffff0000ffff0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000b3a6000067da; + *((unsigned long*)& __m128i_op0[0]) = 0x00004e420000c26a; + *((unsigned long*)& __m128i_op1[1]) = 0xd78cfd70b5f65d76; + *((unsigned long*)& __m128i_op1[0]) = 0x5779108fdedda7e4; + *((unsigned long*)& __m128i_result[1]) = 0x0000b3a6000067da; + *((unsigned long*)& __m128i_result[0]) = 0x5779108f0000c26a; + __m128i_out = __lsx_vmax_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x30eb022002101b20; + *((unsigned long*)& __m128i_op0[0]) = 0x020310edc003023d; + *((unsigned long*)& __m128i_op1[1]) = 0x30eb020302101b03; + *((unsigned long*)& __m128i_op1[0]) = 0x020310d0c0030220; + *((unsigned long*)& __m128i_result[1]) = 0x30eb022002101b20; + *((unsigned long*)& __m128i_result[0]) = 0x020310edc003023d; + __m128i_out = __lsx_vmax_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfe03fe01fe01fe01; + *((unsigned long*)& __m128i_op0[0]) = 0xfe3bfa3ffe3bfb21; + *((unsigned long*)& __m128i_op1[1]) = 0x001d001d001d001d; + *((unsigned long*)& __m128i_op1[0]) = 0x001d001d001d0000; + *((unsigned long*)& __m128i_result[1]) = 0x001d001d001d001d; + *((unsigned long*)& __m128i_result[0]) = 0x001d001d001d0000; + __m128i_out = __lsx_vmax_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000155; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffff000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000155; + __m128i_out = __lsx_vmax_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_vmax_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_vmax_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000051649b6; + *((unsigned long*)& __m128i_op0[0]) = 0xd2f005e44bb43416; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000003e0000003f; + *((unsigned long*)& __m128i_result[1]) = 0x00000000051649b6; + *((unsigned long*)& __m128i_result[0]) = 0x0000003e0000003f; + __m128i_out = __lsx_vmax_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]) = 0x0000ebd20000714f; + *((unsigned long*)& __m128i_op1[0]) = 0x00012c8a0000a58a; + *((unsigned long*)& __m128i_result[1]) = 0x0000ebd20000714f; + *((unsigned long*)& __m128i_result[0]) = 0x00012c8a0000a58a; + __m128i_out = __lsx_vmax_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-vmax-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmax-2.c new file mode 100644 index 00000000000..0ec0c9de7ba --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmax-2.c @@ -0,0 +1,361 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0xffffffff80000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffff80000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000007f0000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000007f0000; + __m128i_out = __lsx_vmax_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffff0000ffff0000; + *((unsigned long*)& __m128i_op1[0]) = 0xffff000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffff0000ffff0000; + *((unsigned long*)& __m128i_result[0]) = 0xffff000000000000; + __m128i_out = __lsx_vmax_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x77c0404a4000403a; + *((unsigned long*)& __m128i_op0[0]) = 0x77c03fd640003fc6; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000003a0000003a; + *((unsigned long*)& __m128i_result[1]) = 0x77c0404a4000403a; + *((unsigned long*)& __m128i_result[0]) = 0x77c03fd640003fc6; + __m128i_out = __lsx_vmax_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xbafebb00ffd500fe; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xbafebb00ffd500fe; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xbafebb00ffd500fe; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x52525252adadadad; + *((unsigned long*)& __m128i_op0[0]) = 0x52525252adadadad; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x5b5b5b5aa4a4a4a6; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x5b5b5b5aadadadad; + __m128i_out = __lsx_vmax_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xfe3bfb01fe3bfe01; + *((unsigned long*)& __m128i_op1[0]) = 0xfe03fe3ffe01fa21; + *((unsigned long*)& __m128i_result[1]) = 0xfe3bfb01fe3bfe01; + *((unsigned long*)& __m128i_result[0]) = 0xfe03fe3ffe01fa21; + __m128i_out = __lsx_vmax_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000f50000007500; + *((unsigned long*)& __m128i_op0[0]) = 0x00007e1600007d98; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000fe00fe; + *((unsigned long*)& __m128i_op1[0]) = 0x00fe00fe00fe00fe; + *((unsigned long*)& __m128i_result[1]) = 0x0000f50000fe75fe; + *((unsigned long*)& __m128i_result[0]) = 0x00fe7efe00fe7dfe; + __m128i_out = __lsx_vmax_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x9c9c9c9c00000000; + *((unsigned long*)& __m128i_op1[1]) = 0x2002040404010420; + *((unsigned long*)& __m128i_op1[0]) = 0x0101010180800101; + *((unsigned long*)& __m128i_result[1]) = 0x2002040404010420; + *((unsigned long*)& __m128i_result[0]) = 0x9c9c9c9c80800101; + __m128i_out = __lsx_vmax_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff84fff4ff84fff4; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffffff0; + *((unsigned long*)& __m128i_op1[1]) = 0xff84fff4ff84fff4; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffff0; + *((unsigned long*)& __m128i_result[1]) = 0xff84fff4ff84fff4; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff0; + __m128i_out = __lsx_vmax_hu(__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]) = 0x0000ffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000ffffffdfffdf; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffdf; + __m128i_out = __lsx_vmax_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xf001f0010101f002; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmax_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x14ccc6320076a4d2; + *((unsigned long*)& __m128i_op1[0]) = 0x685670d27e00682a; + *((unsigned long*)& __m128i_result[1]) = 0x14ccc6320076a4d2; + *((unsigned long*)& __m128i_result[0]) = 0x685670d27e00682a; + __m128i_out = __lsx_vmax_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_op1[1]) = 0xf6548a1747e59090; + *((unsigned long*)& __m128i_op1[0]) = 0x27b169bbb8145f50; + *((unsigned long*)& __m128i_result[1]) = 0xf6548a1747e59090; + *((unsigned long*)& __m128i_result[0]) = 0x27b169bbb8145f50; + __m128i_out = __lsx_vmax_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffff80ff0010ff06; + *((unsigned long*)& __m128i_op1[0]) = 0x00007f01000eff0a; + *((unsigned long*)& __m128i_result[1]) = 0xffff80ff0010ff06; + *((unsigned long*)& __m128i_result[0]) = 0x8000000080000000; + __m128i_out = __lsx_vmax_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00007fff00007fff; + *((unsigned long*)& __m128i_op0[0]) = 0x000000002bfd9461; + *((unsigned long*)& __m128i_op1[1]) = 0x3ff0000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x3ff0000000007fff; + *((unsigned long*)& __m128i_result[0]) = 0x000000002bfd9461; + __m128i_out = __lsx_vmax_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffff0000000ad3d; + *((unsigned long*)& __m128i_op0[0]) = 0xfffff000fffff000; + *((unsigned long*)& __m128i_op1[1]) = 0x1000100010001000; + *((unsigned long*)& __m128i_op1[0]) = 0x1000100010001000; + *((unsigned long*)& __m128i_result[1]) = 0xfffff00010001000; + *((unsigned long*)& __m128i_result[0]) = 0xfffff000fffff000; + __m128i_out = __lsx_vmax_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000000001f; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000000001f; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000001f; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000001f; + __m128i_out = __lsx_vmax_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000040; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000040; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000040; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000040; + __m128i_out = __lsx_vmax_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((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_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[1]) = 0x7fffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x7fffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xa2a2a2a3a2a2a2a3; + *((unsigned long*)& __m128i_op0[0]) = 0xc605c000aedd0000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xc605c000aedd0000; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x09e8e9012fded7fd; + *((unsigned long*)& __m128i_op1[0]) = 0x479f64b03373df61; + *((unsigned long*)& __m128i_result[1]) = 0x09e8e9012fded7fd; + *((unsigned long*)& __m128i_result[0]) = 0x479f64b03373df61; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000005; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000005; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x52525252adadadad; + *((unsigned long*)& __m128i_op1[0]) = 0x52525252adadadad; + *((unsigned long*)& __m128i_result[1]) = 0x52525252adadadad; + *((unsigned long*)& __m128i_result[0]) = 0x52525252adadadad; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0808080700000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0808080808080808; + *((unsigned long*)& __m128i_op1[1]) = 0x3fff3fff3fff3fff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x3fff3fff3fff3fff; + *((unsigned long*)& __m128i_result[0]) = 0x0808080808080808; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000202020200; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000100; + *((unsigned long*)& __m128i_result[1]) = 0x0000000202020200; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000100; + __m128i_out = __lsx_vmax_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmaxi-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmaxi-1.c new file mode 100644 index 00000000000..1cc0bb85ba9 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmaxi-1.c @@ -0,0 +1,278 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0a0a0a0a0a0a0a0a; + *((unsigned long*)& __m128i_result[0]) = 0x0a0a0a0a0a0a0a0a; + __m128i_out = __lsx_vmaxi_b(__m128i_op0,10); + 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_vmaxi_b(__m128i_op0,-7); + 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_vmaxi_b(__m128i_op0,-10); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000003be14000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000003bfb4000; + __m128i_out = __lsx_vmaxi_b(__m128i_op0,-5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0b0b0b0b0b0b0b0b; + *((unsigned long*)& __m128i_result[0]) = 0x0b0b0b0b0b0b0b0b; + __m128i_out = __lsx_vmaxi_b(__m128i_op0,11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000007ffffffb; + *((unsigned long*)& __m128i_result[1]) = 0x0101010101010101; + *((unsigned long*)& __m128i_result[0]) = 0x010101017f010101; + __m128i_out = __lsx_vmaxi_b(__m128i_op0,1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000000007f8; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000000007f8; + *((unsigned long*)& __m128i_result[1]) = 0x0b0b0b0b0b0b0b0b; + *((unsigned long*)& __m128i_result[0]) = 0x0b0b0b0b0b0b0b0b; + __m128i_out = __lsx_vmaxi_b(__m128i_op0,11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000c; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000c; + __m128i_out = __lsx_vmaxi_b(__m128i_op0,-7); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vmaxi_b(__m128i_op0,0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0606060606060606; + *((unsigned long*)& __m128i_result[0]) = 0x0606060606060606; + __m128i_out = __lsx_vmaxi_b(__m128i_op0,6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0fffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0fffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmaxi_b(__m128i_op0,-16); + 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_vmaxi_h(__m128i_op0,-1); + 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_vmaxi_h(__m128i_op0,-11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x027c027c000027c0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x027c027c000027c0; + __m128i_out = __lsx_vmaxi_h(__m128i_op0,-6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0002000000020000; + *((unsigned long*)& __m128i_op0[0]) = 0x000001fc00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0002000000020000; + *((unsigned long*)& __m128i_result[0]) = 0x000001fc00000000; + __m128i_out = __lsx_vmaxi_h(__m128i_op0,-7); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000fff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000fff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000fff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000fff; + __m128i_out = __lsx_vmaxi_h(__m128i_op0,-14); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000007ff000ff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000a1ff4c; + *((unsigned long*)& __m128i_result[1]) = 0x000300037ff000ff; + *((unsigned long*)& __m128i_result[0]) = 0x0003000300a10003; + __m128i_out = __lsx_vmaxi_h(__m128i_op0,3); + 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_vmaxi_h(__m128i_op0,-2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000002; + *((unsigned long*)& __m128i_result[1]) = 0x000b000b000b000b; + *((unsigned long*)& __m128i_result[0]) = 0x000b000b000b000b; + __m128i_out = __lsx_vmaxi_h(__m128i_op0,11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0004000400040004; + *((unsigned long*)& __m128i_result[0]) = 0x0004000400040004; + __m128i_out = __lsx_vmaxi_h(__m128i_op0,4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfe07e5fefefdddfe; + *((unsigned long*)& __m128i_op0[0]) = 0x00020100fedd0c00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000b0000000b; + *((unsigned long*)& __m128i_result[0]) = 0x000201000000000b; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000001000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000401000001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100000004; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,4); + 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_vmaxi_w(__m128i_op0,-10); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000006f; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000001f0a; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000006f; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000001f0a; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,-12); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000007b; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000000050000007b; + *((unsigned long*)& __m128i_result[0]) = 0x0000000500000005; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000400000004; + *((unsigned long*)& __m128i_result[0]) = 0x0000000400000004; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x001fffff001fffff; + *((unsigned long*)& __m128i_op0[0]) = 0x001fffff001fffff; + *((unsigned long*)& __m128i_result[1]) = 0x001fffff001fffff; + *((unsigned long*)& __m128i_result[0]) = 0x001fffff001fffff; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,-7); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000b0000000b; + *((unsigned long*)& __m128i_result[0]) = 0x0000000b0000000b; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000e0000000e; + *((unsigned long*)& __m128i_result[0]) = 0x0000000e0000000e; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,14); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000020; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000900000020; + *((unsigned long*)& __m128i_result[0]) = 0x0000000900000009; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x9c9c9c9c9c9c9c9c; + *((unsigned long*)& __m128i_op0[0]) = 0x9c9c9c9c9c9c9c9c; + *((unsigned long*)& __m128i_result[1]) = 0x0000000600000006; + *((unsigned long*)& __m128i_result[0]) = 0x0000000600000006; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7f80000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x7f80000000000007; + *((unsigned long*)& __m128i_result[0]) = 0x0000000700000007; + __m128i_out = __lsx_vmaxi_w(__m128i_op0,7); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000002; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000002; + __m128i_out = __lsx_vmaxi_d(__m128i_op0,2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000007f00; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000001000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000007f00; + *((unsigned long*)& __m128i_result[0]) = 0x0000000001000000; + __m128i_out = __lsx_vmaxi_d(__m128i_op0,-4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfff489b693120950; + *((unsigned long*)& __m128i_op0[0]) = 0xfffc45a851c40c18; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000000a; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000a; + __m128i_out = __lsx_vmaxi_d(__m128i_op0,10); + 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_vmaxi_d(__m128i_op0,-5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x63636b6afe486741; + *((unsigned long*)& __m128i_op0[0]) = 0x41f8e880ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x63636b6afe486741; + *((unsigned long*)& __m128i_result[0]) = 0x41f8e880ffffffff; + __m128i_out = __lsx_vmaxi_d(__m128i_op0,-2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmaxi-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmaxi-2.c new file mode 100644 index 00000000000..a2c82681bb5 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmaxi-2.c @@ -0,0 +1,222 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0000000000020002; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000020002; + *((unsigned long*)& __m128i_result[1]) = 0x0303030303030303; + *((unsigned long*)& __m128i_result[0]) = 0x0303030303030303; + __m128i_out = __lsx_vmaxi_bu(__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]) = 0x1111111111111111; + *((unsigned long*)& __m128i_result[0]) = 0x1111111111111111; + __m128i_out = __lsx_vmaxi_bu(__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]) = 0x1111111111111111; + *((unsigned long*)& __m128i_result[0]) = 0x1111111111111111; + __m128i_out = __lsx_vmaxi_bu(__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]) = 0x0a0a0a0a0a0a0a0a; + *((unsigned long*)& __m128i_result[0]) = 0x0a0a0a0a0a0a0a0a; + __m128i_out = __lsx_vmaxi_bu(__m128i_op0,0xa); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0011001100110011; + __m128i_out = __lsx_vmaxi_hu(__m128i_op0,0x11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x11000f2010000e20; + *((unsigned long*)& __m128i_op0[0]) = 0x0f000d200e000c20; + *((unsigned long*)& __m128i_result[1]) = 0x11000f2010000e20; + *((unsigned long*)& __m128i_result[0]) = 0x0f000d200e000c20; + __m128i_out = __lsx_vmaxi_hu(__m128i_op0,0xb); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x001ffff0003ffff0; + *((unsigned long*)& __m128i_op0[0]) = 0x000fffefffefffef; + *((unsigned long*)& __m128i_result[1]) = 0x001ffff0003ffff0; + *((unsigned long*)& __m128i_result[0]) = 0x000fffefffefffef; + __m128i_out = __lsx_vmaxi_hu(__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]) = 0x0005000500050005; + *((unsigned long*)& __m128i_result[0]) = 0x0005000500050005; + __m128i_out = __lsx_vmaxi_hu(__m128i_op0,0x5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000020000020; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000020000020; + *((unsigned long*)& __m128i_result[1]) = 0x001d001d20000020; + *((unsigned long*)& __m128i_result[0]) = 0x001d001d20000020; + __m128i_out = __lsx_vmaxi_hu(__m128i_op0,0x1d); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00003fff00010000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00123fff00120012; + *((unsigned long*)& __m128i_result[0]) = 0x0012001200120012; + __m128i_out = __lsx_vmaxi_hu(__m128i_op0,0x12); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x001a001a001a001a; + *((unsigned long*)& __m128i_result[0]) = 0x001a001a001a001a; + __m128i_out = __lsx_vmaxi_hu(__m128i_op0,0x1a); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x001e001e001e001e; + *((unsigned long*)& __m128i_result[0]) = 0x001e001e001e001e; + __m128i_out = __lsx_vmaxi_hu(__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]) = 0x001d001d001d001d; + *((unsigned long*)& __m128i_result[0]) = 0x001d001d001d001d; + __m128i_out = __lsx_vmaxi_hu(__m128i_op0,0x1d); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000800000008; + *((unsigned long*)& __m128i_result[0]) = 0x0000000800000008; + __m128i_out = __lsx_vmaxi_wu(__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]) = 0x0000001600000016; + *((unsigned long*)& __m128i_result[0]) = 0x0000001600000016; + __m128i_out = __lsx_vmaxi_wu(__m128i_op0,0x16); + 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_vmaxi_wu(__m128i_op0,0xf); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffacdb6dbecac; + *((unsigned long*)& __m128i_op0[0]) = 0x1f5533a694f902c0; + *((unsigned long*)& __m128i_result[1]) = 0xfffffacdb6dbecac; + *((unsigned long*)& __m128i_result[0]) = 0x1f5533a694f902c0; + __m128i_out = __lsx_vmaxi_wu(__m128i_op0,0xd); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x37c0001000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x37c0001000000000; + *((unsigned long*)& __m128i_result[1]) = 0x37c0001000000001; + *((unsigned long*)& __m128i_result[0]) = 0x37c0001000000001; + __m128i_out = __lsx_vmaxi_wu(__m128i_op0,0x1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0010001000100010; + *((unsigned long*)& __m128i_op0[0]) = 0x0010001000100010; + *((unsigned long*)& __m128i_result[1]) = 0x0010001000100010; + *((unsigned long*)& __m128i_result[0]) = 0x0010001000100010; + __m128i_out = __lsx_vmaxi_wu(__m128i_op0,0x1a); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xbf8000000000ffff; + *((unsigned long*)& __m128i_op0[0]) = 0xcf00000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xbf8000000000ffff; + *((unsigned long*)& __m128i_result[0]) = 0xcf00000000000000; + __m128i_out = __lsx_vmaxi_du(__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]) = 0x0000000000000011; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000011; + __m128i_out = __lsx_vmaxi_du(__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]) = 0x000000000000001c; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000001c; + __m128i_out = __lsx_vmaxi_du(__m128i_op0,0x1c); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000000d; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000d; + __m128i_out = __lsx_vmaxi_du(__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]) = 0x000000000000000b; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000b; + __m128i_out = __lsx_vmaxi_du(__m128i_op0,0xb); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x43d3e0000013e000; + *((unsigned long*)& __m128i_op0[0]) = 0x43d3e0000013e000; + *((unsigned long*)& __m128i_result[1]) = 0x43d3e0000013e000; + *((unsigned long*)& __m128i_result[0]) = 0x43d3e0000013e000; + __m128i_out = __lsx_vmaxi_du(__m128i_op0,0xf); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000100010001007c; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x000100010001007c; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vmaxi_du(__m128i_op0,0x1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000001d; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000001d; + __m128i_out = __lsx_vmaxi_du(__m128i_op0,0x1d); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000001b; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000001b; + __m128i_out = __lsx_vmaxi_du(__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]) = 0x0000000000000004; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000004; + __m128i_out = __lsx_vmaxi_du(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmin-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmin-1.c new file mode 100644 index 00000000000..5590c33f5a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmin-1.c @@ -0,0 +1,433 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vmin_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000ff000000ff00; + *((unsigned long*)& __m128i_op1[1]) = 0x3fffff0000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x3fffff0000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00ffff0000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00ffff000000ff00; + __m128i_out = __lsx_vmin_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000ff91fffffff5; + *((unsigned long*)& __m128i_op0[0]) = 0xffff00650001ffb0; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000067400002685; + *((unsigned long*)& __m128i_result[1]) = 0x0000ff91fffffff5; + *((unsigned long*)& __m128i_result[0]) = 0xffff00650000ff85; + __m128i_out = __lsx_vmin_b(__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]) = 0x00000001ca02f854; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100013fa0; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffcafff8ff; + *((unsigned long*)& __m128i_result[0]) = 0x00000000000000a0; + __m128i_out = __lsx_vmin_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_vmin_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_vmin_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7f8000007f800000; + *((unsigned long*)& __m128i_op0[0]) = 0x7f8000008680f1ff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xff80ffffff80ffff; + *((unsigned long*)& __m128i_result[0]) = 0xff80ffff8680f1ff; + __m128i_out = __lsx_vmin_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff00e400ff00e400; + *((unsigned long*)& __m128i_op0[0]) = 0xff01e41ffff0e440; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffe4ffffffe4ff; + *((unsigned long*)& __m128i_result[0]) = 0xffffe4fffff0e4ff; + __m128i_out = __lsx_vmin_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_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000a16316b0; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000063636363; + *((unsigned long*)& __m128i_result[1]) = 0x00000000a1630000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffc0ff81000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000002000000020; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000600000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffc0ff81000000; + __m128i_out = __lsx_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000401000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000080000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000080000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_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_vmin_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]) = 0x7fffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00fdffffffffff02; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xfe80000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfe80ffffffffff02; + __m128i_out = __lsx_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfe80ffffffffff02; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x027e0000000000ff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfe80ffffffffff02; + __m128i_out = __lsx_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmin_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_vmin_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_vmin_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_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffff0000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffe0000000; + *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffe0000000; + __m128i_out = __lsx_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfff0000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfff0000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xc0b4d1a5f8babad3; + *((unsigned long*)& __m128i_op1[0]) = 0xbbc8ecc5f3ced5f3; + *((unsigned long*)& __m128i_result[1]) = 0xc0b4d1a5f8babad3; + *((unsigned long*)& __m128i_result[0]) = 0xbbc8ecc5f3ced5f3; + __m128i_out = __lsx_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffffffbfffc; + *((unsigned long*)& __m128i_op0[0]) = 0xc090380000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffbfffc; + *((unsigned long*)& __m128i_op1[0]) = 0xc090380000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffbfffc; + *((unsigned long*)& __m128i_result[0]) = 0xc090380000000000; + __m128i_out = __lsx_vmin_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_vmin_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000200000000; + *((unsigned long*)& __m128i_op1[1]) = 0x8493941335f5cc0c; + *((unsigned long*)& __m128i_op1[0]) = 0x625a7312befcb21e; + *((unsigned long*)& __m128i_result[1]) = 0x8493941300000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000002befcb21e; + __m128i_out = __lsx_vmin_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmin_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000d; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000078c00000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000d; + __m128i_out = __lsx_vmin_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op0[0]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op1[1]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op1[0]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_result[1]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_result[0]) = 0x000a000a000a000a; + __m128i_out = __lsx_vmin_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_vmin_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xa2a2a2a3a2a2a2a3; + *((unsigned long*)& __m128i_op0[0]) = 0xc605c000aedd0000; + *((unsigned long*)& __m128i_op1[1]) = 0x5d5d5d5d5d5d5d5d; + *((unsigned long*)& __m128i_op1[0]) = 0x5d5d5d5d5d5d0000; + *((unsigned long*)& __m128i_result[1]) = 0xa2a2a2a3a2a2a2a3; + *((unsigned long*)& __m128i_result[0]) = 0xc605c000aedd0000; + __m128i_out = __lsx_vmin_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]) = 0x000003000000d613; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000c0000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000c0000000; + __m128i_out = __lsx_vmin_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_vmin_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000200000001b; + *((unsigned long*)& __m128i_op0[0]) = 0x0000002000000000; + *((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_vmin_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]) = 0xff800000ff800000; + *((unsigned long*)& __m128i_op1[0]) = 0xff800000ff800000; + *((unsigned long*)& __m128i_result[1]) = 0xff800000ff800000; + *((unsigned long*)& __m128i_result[0]) = 0xff800000ff800000; + __m128i_out = __lsx_vmin_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000017fff9000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000210011084; + *((unsigned long*)& __m128i_op1[1]) = 0x000000017fff9000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000210011084; + *((unsigned long*)& __m128i_result[1]) = 0x000000017fff9000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000210011084; + __m128i_out = __lsx_vmin_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000017f0a82; + *((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_vmin_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x5a5a5a5a5b5a5b5a; + *((unsigned long*)& __m128i_op0[0]) = 0x5a5a5a5a5b5a5b5a; + *((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_vmin_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x027c027c000027c0; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x027c027c000027c0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x027c027c000027c0; + __m128i_out = __lsx_vmin_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_vmin_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmin_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]) = 0x0000010000000100; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3e25c8317394dae6; + *((unsigned long*)& __m128i_op0[0]) = 0xcda585aebbb2836a; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xcda585aebbb2836a; + __m128i_out = __lsx_vmin_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x98147a504d145000; + *((unsigned long*)& __m128i_op0[0]) = 0x377b810912c0e000; + *((unsigned long*)& __m128i_op1[1]) = 0x98147a504d145000; + *((unsigned long*)& __m128i_op1[0]) = 0x377b810912c0e000; + *((unsigned long*)& __m128i_result[1]) = 0x98147a504d145000; + *((unsigned long*)& __m128i_result[0]) = 0x377b810912c0e000; + __m128i_out = __lsx_vmin_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000005; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xfcfcfcfcfcfcfcfd; + *((unsigned long*)& __m128i_op1[0]) = 0xfcfcfcfcfcfcfcfd; + *((unsigned long*)& __m128i_result[1]) = 0xfcfcfcfcfcfcfcfd; + *((unsigned long*)& __m128i_result[0]) = 0xfcfcfcfcfcfcfcfd; + __m128i_out = __lsx_vmin_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xd3259a2984048c23; + *((unsigned long*)& __m128i_op1[0]) = 0xf9796558e39953fd; + *((unsigned long*)& __m128i_result[1]) = 0xd3259a2984048c23; + *((unsigned long*)& __m128i_result[0]) = 0xf9796558e39953fd; + __m128i_out = __lsx_vmin_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]) = 0xffffffffffff00ff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffff00ff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmin_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-vmin-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmin-2.c new file mode 100644 index 00000000000..5e9135bae65 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmin-2.c @@ -0,0 +1,343 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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_vmin_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmin_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000300000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfffe0004fffe0004; + *((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_vmin_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xd3259a2984048c23; + *((unsigned long*)& __m128i_op0[0]) = 0xf9796558e39953fd; + *((unsigned long*)& __m128i_op1[1]) = 0xd3259a2984048c23; + *((unsigned long*)& __m128i_op1[0]) = 0xf9796558e39953fd; + *((unsigned long*)& __m128i_result[1]) = 0xd3259a2984048c23; + *((unsigned long*)& __m128i_result[0]) = 0xf9796558e39953fd; + __m128i_out = __lsx_vmin_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xf6548a1747e59090; + *((unsigned long*)& __m128i_op0[0]) = 0x27b169bbb8145f50; + *((unsigned long*)& __m128i_op1[1]) = 0xf6548a1747e59090; + *((unsigned long*)& __m128i_op1[0]) = 0x27b169bbb8145f50; + *((unsigned long*)& __m128i_result[1]) = 0xf6548a1747e59090; + *((unsigned long*)& __m128i_result[0]) = 0x27b169bbb8145f50; + __m128i_out = __lsx_vmin_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x9c9c9c9c9c9c9c9c; + *((unsigned long*)& __m128i_op0[0]) = 0x9c9c9c9c63636363; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x9c9c9c9c00000000; + __m128i_out = __lsx_vmin_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x2020202020202020; + *((unsigned long*)& __m128i_op0[0]) = 0x2020202020207f7f; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000000003f; + *((unsigned long*)& __m128i_op1[0]) = 0x7f417f417f027e03; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000003f; + *((unsigned long*)& __m128i_result[0]) = 0x2020202020207e03; + __m128i_out = __lsx_vmin_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00008d3200000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x09e8e9012fded7fd; + *((unsigned long*)& __m128i_op1[0]) = 0x479f64b03373df61; + *((unsigned long*)& __m128i_result[1]) = 0x00008d3200000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0c0b0a090b0a0908; + *((unsigned long*)& __m128i_op0[0]) = 0x0a09080709080706; + *((unsigned long*)& __m128i_op1[1]) = 0x0c0b0a090b0a0908; + *((unsigned long*)& __m128i_op1[0]) = 0x0a09080709080706; + *((unsigned long*)& __m128i_result[1]) = 0x0c0b0a090b0a0908; + *((unsigned long*)& __m128i_result[0]) = 0x0a09080709080706; + __m128i_out = __lsx_vmin_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xa87745dbd93e4ea1; + *((unsigned long*)& __m128i_op1[0]) = 0xaa49601e26d39860; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x5252525252525252; + *((unsigned long*)& __m128i_op0[0]) = 0x5252525252525252; + *((unsigned long*)& __m128i_op1[1]) = 0x2006454690d3de87; + *((unsigned long*)& __m128i_op1[0]) = 0x2006454690d3de87; + *((unsigned long*)& __m128i_result[1]) = 0x2006454652525252; + *((unsigned long*)& __m128i_result[0]) = 0x2006454652525252; + __m128i_out = __lsx_vmin_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000040100; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffe000ffff2382; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000040100; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010000; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x03574e3a62407e03; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000001010000; + *((unsigned long*)& __m128i_op1[1]) = 0x7da9b23a624082fd; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffff0000; + *((unsigned long*)& __m128i_result[1]) = 0x03574e3a62407e03; + *((unsigned long*)& __m128i_result[0]) = 0x0000000001010000; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0505050505050505; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000005050000; + *((unsigned long*)& __m128i_op1[1]) = 0x0028280000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0028280000282800; + *((unsigned long*)& __m128i_result[1]) = 0x0028280000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000282800; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfc01fd13fc02fe0c; + *((unsigned long*)& __m128i_op0[0]) = 0xfe00fd14fe01fd16; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffff00000001; + *((unsigned long*)& __m128i_op1[0]) = 0xffffff0000010000; + *((unsigned long*)& __m128i_result[1]) = 0xfc01fd1300000001; + *((unsigned long*)& __m128i_result[0]) = 0xfe00fd1400010000; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000001ca02f854; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100013fa0; + *((unsigned long*)& __m128i_op1[1]) = 0x2000200020002000; + *((unsigned long*)& __m128i_op1[0]) = 0x2000200020002000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000120002000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100013fa0; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000ffff00000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000014; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x000000000005003a; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xcd636363cd636363; + *((unsigned long*)& __m128i_op0[0]) = 0xcd636363cd636363; + *((unsigned long*)& __m128i_op1[1]) = 0x86dd8341b164f12b; + *((unsigned long*)& __m128i_op1[0]) = 0x9611c3985b3159f5; + *((unsigned long*)& __m128i_result[1]) = 0x86dd8341b164f12b; + *((unsigned long*)& __m128i_result[0]) = 0x9611c3985b3159f5; + __m128i_out = __lsx_vmin_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3ff0000000000000; + *((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_vmin_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000de0000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000001f0a; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000006f00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000001f0a; + __m128i_out = __lsx_vmin_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000fea0000fffe; + *((unsigned long*)& __m128i_op0[0]) = 0xff0cff78ff96ff14; + *((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_vmin_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffff007fff810001; + *((unsigned long*)& __m128i_op0[0]) = 0x000400530050ffa6; + *((unsigned long*)& __m128i_op1[1]) = 0xff7f810100001000; + *((unsigned long*)& __m128i_op1[0]) = 0x001fffc0ffffe001; + *((unsigned long*)& __m128i_result[1]) = 0xff7f810100001000; + *((unsigned long*)& __m128i_result[0]) = 0x000400530050ffa6; + __m128i_out = __lsx_vmin_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00007efe7f7f8000; + *((unsigned long*)& __m128i_op1[1]) = 0x00000000b81c8382; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000077af9450; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000077af9450; + __m128i_out = __lsx_vmin_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmin_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmini-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmini-1.c new file mode 100644 index 00000000000..757cb0280bd --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmini-1.c @@ -0,0 +1,314 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0xfffefffefffffffc; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfffefffefffffffc; + __m128i_out = __lsx_vmini_b(__m128i_op0,4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000006f00002f0a; + *((unsigned long*)& __m128i_op0[0]) = 0x0000958aefff895e; + *((unsigned long*)& __m128i_result[1]) = 0xfafafafafafafafa; + *((unsigned long*)& __m128i_result[0]) = 0xfafa958aeffa89fa; + __m128i_out = __lsx_vmini_b(__m128i_op0,-6); + 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_vmini_b(__m128i_op0,1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000adadadad; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000adadadad; + *((unsigned long*)& __m128i_result[1]) = 0xfbfbfbfbadadadad; + *((unsigned long*)& __m128i_result[0]) = 0xfbfbfbfbadadadad; + __m128i_out = __lsx_vmini_b(__m128i_op0,-5); + 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_vmini_b(__m128i_op0,12); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000202020200; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000100; + *((unsigned long*)& __m128i_result[1]) = 0x0000000202020200; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000100; + __m128i_out = __lsx_vmini_b(__m128i_op0,5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xf1f1f1f1f1f1f1f1; + *((unsigned long*)& __m128i_result[0]) = 0xf1f1f1f1f1f1f1f1; + __m128i_out = __lsx_vmini_b(__m128i_op0,-15); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000f50000007500; + *((unsigned long*)& __m128i_op0[0]) = 0x00007e1600007d98; + *((unsigned long*)& __m128i_result[1]) = 0x0000f50000000900; + *((unsigned long*)& __m128i_result[0]) = 0x0000090900000998; + __m128i_out = __lsx_vmini_b(__m128i_op0,9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x10f881a20ffd02b0; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ff800000; + *((unsigned long*)& __m128i_result[1]) = 0xf1f181a2f1f1f1b0; + *((unsigned long*)& __m128i_result[0]) = 0xf1f1f1f1f180f1f1; + __m128i_out = __lsx_vmini_b(__m128i_op0,-15); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfff6fff6fff6fff6; + *((unsigned long*)& __m128i_result[0]) = 0xfff6fff6fff6fff6; + __m128i_out = __lsx_vmini_h(__m128i_op0,-10); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1716151416151413; + *((unsigned long*)& __m128i_op0[0]) = 0x1514131214131211; + *((unsigned long*)& __m128i_result[1]) = 0xfff3fff3fff3fff3; + *((unsigned long*)& __m128i_result[0]) = 0xfff3fff3fff3fff3; + __m128i_out = __lsx_vmini_h(__m128i_op0,-13); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfefefefefefefefe; + *((unsigned long*)& __m128i_op0[0]) = 0xfefefefefefefefe; + *((unsigned long*)& __m128i_result[1]) = 0xfefefefefefefefe; + *((unsigned long*)& __m128i_result[0]) = 0xfefefefefefefefe; + __m128i_out = __lsx_vmini_h(__m128i_op0,2); + 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_vmini_h(__m128i_op0,3); + 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_vmini_h(__m128i_op0,11); + 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_vmini_h(__m128i_op0,3); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffff4fffffff4; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff4fffffff4; + __m128i_out = __lsx_vmini_w(__m128i_op0,-12); + 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_vmini_w(__m128i_op0,1); + 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_vmini_w(__m128i_op0,0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfffffff3fffffff3; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff3fffffff3; + __m128i_out = __lsx_vmini_w(__m128i_op0,-13); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x001ffff0003ffff0; + *((unsigned long*)& __m128i_op0[0]) = 0x000fffefffefffef; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffefffef; + __m128i_out = __lsx_vmini_w(__m128i_op0,0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000800000000; + *((unsigned long*)& __m128i_op0[0]) = 0xff01fe0400000006; + *((unsigned long*)& __m128i_result[1]) = 0x0000000500000000; + *((unsigned long*)& __m128i_result[0]) = 0xff01fe0400000005; + __m128i_out = __lsx_vmini_w(__m128i_op0,5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffafffffffa; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffafffffffa; + __m128i_out = __lsx_vmini_w(__m128i_op0,-6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000d0000000d; + __m128i_out = __lsx_vmini_w(__m128i_op0,13); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x8080808080808080; + *((unsigned long*)& __m128i_op0[0]) = 0x8080808080808080; + *((unsigned long*)& __m128i_result[1]) = 0x8080808080808080; + *((unsigned long*)& __m128i_result[0]) = 0x8080808080808080; + __m128i_out = __lsx_vmini_w(__m128i_op0,8); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x345002920f3017d6; + *((unsigned long*)& __m128i_result[1]) = 0xfffffff7fffffff7; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff7fffffff7; + __m128i_out = __lsx_vmini_w(__m128i_op0,-9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff00000000; + __m128i_out = __lsx_vmini_d(__m128i_op0,1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x03574e3a62407e03; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffff7; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff7; + __m128i_out = __lsx_vmini_d(__m128i_op0,-9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1000000010000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100100000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffff1; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff1; + __m128i_out = __lsx_vmini_d(__m128i_op0,-15); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000034; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000006; + __m128i_out = __lsx_vmini_d(__m128i_op0,6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000006; + __m128i_out = __lsx_vmini_d(__m128i_op0,6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff84fff4ff84fff4; + *((unsigned long*)& __m128i_op0[0]) = 0x00a6ffceffb60052; + *((unsigned long*)& __m128i_result[1]) = 0xff84fff4ff84fff4; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff0; + __m128i_out = __lsx_vmini_d(__m128i_op0,-16); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffff9; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff9; + __m128i_out = __lsx_vmini_d(__m128i_op0,-7); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x111110ff11111141; + *((unsigned long*)& __m128i_op0[0]) = 0x1111113111111100; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmini_d(__m128i_op0,-1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x55aa55c3d5aa55c4; + *((unsigned long*)& __m128i_op0[0]) = 0xaa55556fd5aaaac1; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000000c; + *((unsigned long*)& __m128i_result[0]) = 0xaa55556fd5aaaac1; + __m128i_out = __lsx_vmini_d(__m128i_op0,12); + 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_vmini_d(__m128i_op0,12); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffff4; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff4; + __m128i_out = __lsx_vmini_d(__m128i_op0,-12); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffb; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffb; + __m128i_out = __lsx_vmini_d(__m128i_op0,-5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfcfcfcdcfcfcfcdc; + *((unsigned long*)& __m128i_op0[0]) = 0xfcfcfcdcfcfcfcdc; + *((unsigned long*)& __m128i_result[1]) = 0xfcfcfcdcfcfcfcdc; + *((unsigned long*)& __m128i_result[0]) = 0xfcfcfcdcfcfcfcdc; + __m128i_out = __lsx_vmini_d(__m128i_op0,3); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + long_int_out = __lsx_vpickve2gr_d(__m128i_op0,0x0); + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000001030103; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffc; + __m128i_out = __lsx_vmini_d(__m128i_op0,-4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000085af0000b000; + *((unsigned long*)& __m128i_op0[0]) = 0x00017ea200002000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffff7; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff7; + __m128i_out = __lsx_vmini_d(__m128i_op0,-9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffff4; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffff4; + __m128i_out = __lsx_vmini_d(__m128i_op0,-12); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff00e400ff00e400; + *((unsigned long*)& __m128i_op0[0]) = 0xff01e41ffff0ffff; + *((unsigned long*)& __m128i_result[1]) = 0xff00e400ff00e400; + *((unsigned long*)& __m128i_result[0]) = 0xff01e41ffff0ffff; + __m128i_out = __lsx_vmini_d(__m128i_op0,14); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmini-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmini-2.c new file mode 100644 index 00000000000..0a9631287bd --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmini-2.c @@ -0,0 +1,216 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0xffff0001ffff0001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000a163000016b0; + *((unsigned long*)& __m128i_result[1]) = 0x0303000103030001; + *((unsigned long*)& __m128i_result[0]) = 0x0000030300000303; + __m128i_out = __lsx_vmini_bu(__m128i_op0,0x3); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xd8248069ffe78077; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0d0d0d0d0d0d0d0d; + __m128i_out = __lsx_vmini_bu(__m128i_op0,0xd); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7da9b23a624082fd; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffff0000; + *((unsigned long*)& __m128i_result[1]) = 0x0505050505050505; + *((unsigned long*)& __m128i_result[0]) = 0x0000000005050000; + __m128i_out = __lsx_vmini_bu(__m128i_op0,0x5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000001300000013; + *((unsigned long*)& __m128i_op0[0]) = 0x0000001300000013; + *((unsigned long*)& __m128i_result[1]) = 0x0000000e0000000e; + *((unsigned long*)& __m128i_result[0]) = 0x0000000e0000000e; + __m128i_out = __lsx_vmini_bu(__m128i_op0,0xe); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmini_bu(__m128i_op0,0xf); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000001fffdfffdff; + *((unsigned long*)& __m128i_op0[0]) = 0x000001fffdfffdff; + *((unsigned long*)& __m128i_result[1]) = 0x0000010101010101; + *((unsigned long*)& __m128i_result[0]) = 0x0000010101010101; + __m128i_out = __lsx_vmini_bu(__m128i_op0,0x1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000009c007c00; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000071007600; + *((unsigned long*)& __m128i_result[1]) = 0x0000000009000900; + *((unsigned long*)& __m128i_result[0]) = 0x0000000009000900; + __m128i_out = __lsx_vmini_bu(__m128i_op0,0x9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xc0b4d1a5f8babad3; + *((unsigned long*)& __m128i_op0[0]) = 0xbbc8ecc5f3ced5f3; + *((unsigned long*)& __m128i_result[1]) = 0x0303030303030303; + *((unsigned long*)& __m128i_result[0]) = 0x0303030303030303; + __m128i_out = __lsx_vmini_bu(__m128i_op0,0x3); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xd3220000d3f20000; + *((unsigned long*)& __m128i_op0[0]) = 0x8bff0000a7b80000; + *((unsigned long*)& __m128i_result[1]) = 0x0909000009090000; + *((unsigned long*)& __m128i_result[0]) = 0x0909000009090000; + __m128i_out = __lsx_vmini_bu(__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_vmini_hu(__m128i_op0,0xd); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + unsigned_long_int_out = __lsx_vpickve2gr_du(__m128i_op0,0x0); + *((unsigned long*)& __m128i_op0[1]) = 0x80000000b57ec564; + *((unsigned long*)& __m128i_op0[0]) = 0x8000000083ff0be0; + *((unsigned long*)& __m128i_result[1]) = 0x0014000000140014; + *((unsigned long*)& __m128i_result[0]) = 0x0014000000140014; + __m128i_out = __lsx_vmini_hu(__m128i_op0,0x14); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1000100010001000; + *((unsigned long*)& __m128i_op0[0]) = 0x1000100010001000; + *((unsigned long*)& __m128i_result[1]) = 0x0013001300130013; + *((unsigned long*)& __m128i_result[0]) = 0x0013001300130013; + __m128i_out = __lsx_vmini_hu(__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_vmini_hu(__m128i_op0,0x1b); + 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_vmini_hu(__m128i_op0,0x1b); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x02b010f881a281a2; + *((unsigned long*)& __m128i_op0[0]) = 0x27b169bbb8145f50; + *((unsigned long*)& __m128i_result[1]) = 0x0002000200020002; + *((unsigned long*)& __m128i_result[0]) = 0x0002000200020002; + __m128i_out = __lsx_vmini_hu(__m128i_op0,0x2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmini_du(__m128i_op0,0x19); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000040004000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0010002000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmini_du(__m128i_op0,0x0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00ff00ff0000007f; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000004; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmini_du(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7ff8000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x7ff8000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000005; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000005; + __m128i_out = __lsx_vmini_du(__m128i_op0,0x5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000003fc00ff00; + *((unsigned long*)& __m128i_op0[0]) = 0x00000001fe01fe00; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000000a; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000a; + __m128i_out = __lsx_vmini_du(__m128i_op0,0xa); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fc000007fc00000; + *((unsigned long*)& __m128i_op0[0]) = 0x7fc000007fc00000; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000000b; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000b; + __m128i_out = __lsx_vmini_du(__m128i_op0,0xb); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000101010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000014; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000014; + __m128i_out = __lsx_vmini_du(__m128i_op0,0x14); + 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_vmini_du(__m128i_op0,0x18); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffefffefffefffe; + *((unsigned long*)& __m128i_op0[0]) = 0xfffefffefffefffe; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000005; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000005; + __m128i_out = __lsx_vmini_du(__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_vmini_du(__m128i_op0,0x11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000d3460001518a; + *((unsigned long*)& __m128i_op0[0]) = 0x000084300000e55f; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000016; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000016; + __m128i_out = __lsx_vmini_du(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmini_du(__m128i_op0,0x3); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffff2356fe165486; + *((unsigned long*)& __m128i_op0[0]) = 0x5efeb3165bd7653d; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000007; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000007; + __m128i_out = __lsx_vmini_du(__m128i_op0,0x7); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-1.c new file mode 100644 index 00000000000..c92fda7e069 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-1.c @@ -0,0 +1,253 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0x82c539ffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xc72df14afbfafdf9; + *((unsigned long*)& __m128i_op1[1]) = 0x82c539ffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xc72df14afbfafdf9; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffff994cb09c; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffc3639d96; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0003c853c843c844; + *((unsigned long*)& __m128i_op0[0]) = 0x0003c853c843c844; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op1[1]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op1[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001808281820102; + *((unsigned long*)& __m128i_op0[0]) = 0x0001808201018081; + *((unsigned long*)& __m128i_op1[1]) = 0x8080808080808080; + *((unsigned long*)& __m128i_op1[0]) = 0x8080808080808080; + *((unsigned long*)& __m128i_result[1]) = 0x0001008281820102; + *((unsigned long*)& __m128i_result[0]) = 0x0001008201010081; + __m128i_out = __lsx_vmod_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0101010240010202; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff00ff00ff00ff00; + *((unsigned long*)& __m128i_op0[0]) = 0xff00ff00ff00ff00; + *((unsigned long*)& __m128i_op1[1]) = 0xff00ff00ff00ff00; + *((unsigned long*)& __m128i_op1[0]) = 0xff00ff00ff00ff00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000104000800; + *((unsigned long*)& __m128i_op1[1]) = 0x0101080408040804; + *((unsigned long*)& __m128i_op1[0]) = 0x0804080407040804; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000104000800; + __m128i_out = __lsx_vmod_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1000100010001000; + *((unsigned long*)& __m128i_op0[0]) = 0x1000100010001000; + *((unsigned long*)& __m128i_op1[1]) = 0x1202120212021202; + *((unsigned long*)& __m128i_op1[0]) = 0x1202120212021202; + *((unsigned long*)& __m128i_result[1]) = 0x1000100010001000; + *((unsigned long*)& __m128i_result[0]) = 0x1000100010001000; + __m128i_out = __lsx_vmod_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_op0[0]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffffffa; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffa; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000003; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000003; + __m128i_out = __lsx_vmod_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xf6548a1747e59090; + *((unsigned long*)& __m128i_op0[0]) = 0x27b169bbb8145f50; + *((unsigned long*)& __m128i_op1[1]) = 0xf6548a1747e59090; + *((unsigned long*)& __m128i_op1[0]) = 0x27b169bbb8145f50; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op0[0]) = 0x370bdfeca2eb9931; + *((unsigned long*)& __m128i_op1[1]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op1[0]) = 0x370bdfeca2eb9931; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x805ffffe01001fe0; + *((unsigned long*)& __m128i_op0[0]) = 0x9a49e11102834d70; + *((unsigned long*)& __m128i_op1[1]) = 0x8144ffff01c820a4; + *((unsigned long*)& __m128i_op1[0]) = 0x9b2ee1a4034b4e34; + *((unsigned long*)& __m128i_result[1]) = 0xff1affff01001fe0; + *((unsigned long*)& __m128i_result[0]) = 0xff1aff6d02834d70; + __m128i_out = __lsx_vmod_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x001d001d001d001d; + *((unsigned long*)& __m128i_op0[0]) = 0x001d001d001d0000; + *((unsigned long*)& __m128i_op1[1]) = 0x001d001d001d001d; + *((unsigned long*)& __m128i_op1[0]) = 0x001d001d001d0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op1[0]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x4f8000004f800000; + *((unsigned long*)& __m128i_op1[0]) = 0x4f8000004f800000; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vmod_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00ffff0000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00ffff000000ff00; + *((unsigned long*)& __m128i_op1[1]) = 0x03c0000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x03c0038000000380; + *((unsigned long*)& __m128i_result[1]) = 0x00ffff0000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00ffff000000ff00; + __m128i_out = __lsx_vmod_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000006f00001f0a; + *((unsigned long*)& __m128i_op1[0]) = 0x0000958affff995d; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x80000000307d0771; + *((unsigned long*)& __m128i_op0[0]) = 0x0d8e36706ac02b9b; + *((unsigned long*)& __m128i_op1[1]) = 0x80000000307d0771; + *((unsigned long*)& __m128i_op1[0]) = 0x0d8e36706ac02b9b; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x8000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000800000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000800000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x413e276583869d79; + *((unsigned long*)& __m128i_op1[0]) = 0x7f7f017f9d8726d3; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000011ffee; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000000dfff2; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-2.c new file mode 100644 index 00000000000..3c9c12eeb99 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmod-2.c @@ -0,0 +1,254 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0x16161616a16316b0; + *((unsigned long*)& __m128i_op0[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op1[1]) = 0x16161616a16316b0; + *((unsigned long*)& __m128i_op1[0]) = 0x6363636363636363; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000001fffffffe; + *((unsigned long*)& __m128i_op0[0]) = 0x00000001fffffffe; + *((unsigned long*)& __m128i_op1[1]) = 0x5a5a5a5a5b5a5b5a; + *((unsigned long*)& __m128i_op1[0]) = 0x5a5a5a5a5b5a5b5a; + *((unsigned long*)& __m128i_result[1]) = 0x00000001494b494a; + *((unsigned long*)& __m128i_result[0]) = 0x00000001494b494a; + __m128i_out = __lsx_vmod_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xd70b30c96ea9f4e8; + *((unsigned long*)& __m128i_op1[0]) = 0xa352bfac9269e0aa; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffeb; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffeb; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_hu(__m128i_op0,0x3); + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_bu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x7f801fa06451ef11; + *((unsigned long*)& __m128i_op1[0]) = 0x68bcf93435ed25ed; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000022666621; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffdd9999da; + *((unsigned long*)& __m128i_op1[1]) = 0x7f7f7f7f00107f04; + *((unsigned long*)& __m128i_op1[0]) = 0x7f0000fd7f0000fd; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000066621; + *((unsigned long*)& __m128i_result[0]) = 0x01ff00085e9900ab; + __m128i_out = __lsx_vmod_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000bd3d; + *((unsigned long*)& __m128i_op0[0]) = 0x000000007fff0000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xefffdffff0009d3d; + *((unsigned long*)& __m128i_result[1]) = 0x000000000000bd3d; + *((unsigned long*)& __m128i_result[0]) = 0x000000007fff0000; + __m128i_out = __lsx_vmod_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000004870ba0; + *((unsigned long*)& __m128i_op1[1]) = 0x478b478b38031779; + *((unsigned long*)& __m128i_op1[0]) = 0x6b769e690fa1e119; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000004870ba0; + __m128i_out = __lsx_vmod_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x2006454690d3de87; + *((unsigned long*)& __m128i_op0[0]) = 0x2006454690d3de87; + *((unsigned long*)& __m128i_op1[1]) = 0x2006454690d3de87; + *((unsigned long*)& __m128i_op1[0]) = 0x2006454690d3de87; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0002000200020002; + *((unsigned long*)& __m128i_op0[0]) = 0x0002000200020002; + *((unsigned long*)& __m128i_op1[1]) = 0x02b010f881a281a2; + *((unsigned long*)& __m128i_op1[0]) = 0x27b169bbb8145f50; + *((unsigned long*)& __m128i_result[1]) = 0x0002000200020002; + *((unsigned long*)& __m128i_result[0]) = 0x0002000200020002; + __m128i_out = __lsx_vmod_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffff100000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0010001000100010; + *((unsigned long*)& __m128i_op1[0]) = 0x0010001000100010; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000f000000000000; + __m128i_out = __lsx_vmod_hu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000fffe0000fffe; + *((unsigned long*)& __m128i_op1[1]) = 0xffffff00ffffff00; + *((unsigned long*)& __m128i_op1[0]) = 0xffffff00ffffff00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000fffe0000fffe; + __m128i_out = __lsx_vmod_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x8000000080000000; + *((unsigned long*)& __m128i_op1[0]) = 0x8000000080000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_op1[0]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_wu(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000200; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000200; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffff0000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmod_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000101fd01fe; + *((unsigned long*)& __m128i_op1[1]) = 0xff80ff80ff80ff80; + *((unsigned long*)& __m128i_op1[0]) = 0xff80ff8080008000; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000101fd01fe; + __m128i_out = __lsx_vmod_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffcafff8ff; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000000000a0; + *((unsigned long*)& __m128i_op1[1]) = 0xff2cfed4fea8ff44; + *((unsigned long*)& __m128i_op1[0]) = 0xfffeffff0035ff8f; + *((unsigned long*)& __m128i_result[1]) = 0x00d3012acc56f9bb; + *((unsigned long*)& __m128i_result[0]) = 0x00000000000000a0; + __m128i_out = __lsx_vmod_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x37c0001000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x37c0001000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0004000400040004; + *((unsigned long*)& __m128i_op1[0]) = 0x0004000400040004; + *((unsigned long*)& __m128i_result[1]) = 0x0003c853c843c844; + *((unsigned long*)& __m128i_result[0]) = 0x0003c853c843c844; + __m128i_out = __lsx_vmod_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000003ddc5dac; + *((unsigned long*)& __m128i_op1[1]) = 0xfcfcfcdcfcfcfcdc; + *((unsigned long*)& __m128i_op1[0]) = 0xfcfcfcdcfcfcfcdc; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000003ddc5dac; + __m128i_out = __lsx_vmod_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffefffff784; + *((unsigned long*)& __m128i_op1[1]) = 0x10f8000100000001; + *((unsigned long*)& __m128i_op1[0]) = 0x00000001000010f8; + *((unsigned long*)& __m128i_result[1]) = 0x0177fff0fffffff0; + *((unsigned long*)& __m128i_result[0]) = 0x00000000011ff8bc; + __m128i_out = __lsx_vmod_du(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmskgez.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmskgez.c new file mode 100644 index 00000000000..77c31832e11 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmskgez.c @@ -0,0 +1,118 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskgez_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0403cfcf01c1595e; + *((unsigned long*)& __m128i_op0[0]) = 0x837cd5db43fc55d4; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000cb4a; + __m128i_out = __lsx_vmskgez_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]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskgez_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]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskgez_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]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskgez_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff7f01ff01; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000d; + __m128i_out = __lsx_vmskgez_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]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskgez_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]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskgez_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskgez_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]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskgez_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + int_out = __lsx_vpickve2gr_h(__m128i_op0,0x2); + *((unsigned long*)& __m128i_op0[1]) = 0x0000010000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskgez_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xfe813f00fe813f00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000033; + __m128i_out = __lsx_vmskgez_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000fffe00006aea; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffce; + __m128i_out = __lsx_vmskgez_b(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskgez_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmskltz.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmskltz.c new file mode 100644 index 00000000000..c08e071c9fe --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmskltz.c @@ -0,0 +1,320 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x0000000000000003; + __m128i_out = __lsx_vmskltz_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_vmskltz_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_vmskltz_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_vmskltz_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x007fffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskltz_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_vmskltz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x85bd6b0e94d89998; + *((unsigned long*)& __m128i_op0[0]) = 0xd83c8081ffff8080; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000f; + __m128i_out = __lsx_vmskltz_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7505443065413aed; + *((unsigned long*)& __m128i_op0[0]) = 0x0100d6effefd0498; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000013d; + __m128i_out = __lsx_vmskltz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000f0000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000002; + __m128i_out = __lsx_vmskltz_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000100010001fffd; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vmskltz_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000100010001007c; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskltz_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000010001; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000001007c; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskltz_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x1111113111111141; + *((unsigned long*)& __m128i_op0[0]) = 0x1111113111111121; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskltz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x9780697084f07dd7; + *((unsigned long*)& __m128i_op0[0]) = 0x87e3285243051cf3; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000cdc1; + __m128i_out = __lsx_vmskltz_b(__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]) = 0x00000000000065a0; + __m128i_out = __lsx_vmskltz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00d3012acc56f9bb; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000000000a0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000004b01; + __m128i_out = __lsx_vmskltz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000020; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskltz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffbfffffffbf; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffbfffffffbf; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffff; + __m128i_out = __lsx_vmskltz_b(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ff00; + __m128i_out = __lsx_vmskltz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x21201f1e1d1c1b1a; + *((unsigned long*)& __m128i_op0[0]) = 0x1918171615141312; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskltz_h(__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]) = 0x000000000000000f; + __m128i_out = __lsx_vmskltz_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ff08ffff; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffffff0; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vmskltz_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op0[0]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000003f3f; + __m128i_out = __lsx_vmskltz_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_vmskltz_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_vmskltz_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_vmskltz_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000080000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000080000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000022; + __m128i_out = __lsx_vmskltz_h(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000003; + __m128i_out = __lsx_vmskltz_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000008080600; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskltz_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000007fff0018; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000004; + __m128i_out = __lsx_vmskltz_b(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskltz_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_vmskltz_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_vmskltz_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_vmskltz_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_vmskltz_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_vmskltz_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000035697d4e; + *((unsigned long*)& __m128i_op0[0]) = 0x000000013ecaadf2; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vmskltz_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000006de1; + *((unsigned long*)& __m128i_op0[0]) = 0x5f9ccf33cf600000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vmskltz_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_vmskltz_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x003ffffe00800000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000034; + __m128i_out = __lsx_vmskltz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x4399d3221a29d3f2; + *((unsigned long*)& __m128i_op0[0]) = 0xc3818bffe7b7a7b8; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vmskltz_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x63636b6afe486741; + *((unsigned long*)& __m128i_op0[0]) = 0x41f8e880ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000027; + __m128i_out = __lsx_vmskltz_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_vmskltz_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsknz.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsknz.c new file mode 100644 index 00000000000..5037f0ed49f --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vmsknz.c @@ -0,0 +1,103 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +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]) = 0x000000017fff9000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000210011084; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000001e1f; + __m128i_out = __lsx_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x9c9c9c9c9c9c9c9c; + *((unsigned long*)& __m128i_op0[0]) = 0x9c9c9c9c63636363; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffff; + __m128i_out = __lsx_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x009500b10113009c; + *((unsigned long*)& __m128i_op0[0]) = 0x009500b10113009c; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000005d5d; + __m128i_out = __lsx_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffcfffcfffcfffc; + *((unsigned long*)& __m128i_op0[0]) = 0xfffcfffcfffcfffc; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffff; + __m128i_out = __lsx_vmsknz_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_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffff000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00000000000000fe; + __m128i_out = __lsx_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000fffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0010000000000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000007f41; + __m128i_out = __lsx_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000ff00ff; + *((unsigned long*)& __m128i_op0[0]) = 0x0014001400140000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000554; + __m128i_out = __lsx_vmsknz_b(__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]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffff; + __m128i_out = __lsx_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x202544f490f2de35; + *((unsigned long*)& __m128i_op0[0]) = 0x202544f490f2de35; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ffff; + __m128i_out = __lsx_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000a74aa8a55ab; + *((unsigned long*)& __m128i_op0[0]) = 0x6adeb5dfcb000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000003ff8; + __m128i_out = __lsx_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x317fce80317fce80; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000ff00; + __m128i_out = __lsx_vmsknz_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vneg.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vneg.c new file mode 100644 index 00000000000..a58e49ac24d --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vneg.c @@ -0,0 +1,320 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000001; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffeffffffff; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100000004; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfffefffefffffffc; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000ff000000ff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffff00ffffff01; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000d; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000fff3; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00ff00ff0000ffff; + *((unsigned long*)& __m128i_op0[0]) = 0x00ff0001ffffff0a; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100000101; + *((unsigned long*)& __m128i_result[0]) = 0x000100ff010101f6; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0101010101010101; + *((unsigned long*)& __m128i_result[0]) = 0x0101010101010101; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xff000000ff00ff00; + *((unsigned long*)& __m128i_op0[0]) = 0xff00ff0000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0100000001000100; + *((unsigned long*)& __m128i_result[0]) = 0x0100010000000000; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000ff00; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000100; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000101; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00000000fffffeff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffbff8888080a; + *((unsigned long*)& __m128i_op0[0]) = 0x080803ff807ff7f9; + *((unsigned long*)& __m128i_result[1]) = 0x010105017878f8f6; + *((unsigned long*)& __m128i_result[0]) = 0xf8f8fd0180810907; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000080000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000080000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000080000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000080000000; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000300000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000100010001; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffdffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffeffff; + __m128i_out = __lsx_vneg_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x441ba9fcffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x181b2541ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xbbe5560400010001; + *((unsigned long*)& __m128i_result[0]) = 0xe7e5dabf00010001; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000060a3db; + *((unsigned long*)& __m128i_op0[0]) = 0xa70594c000000000; + *((unsigned long*)& __m128i_result[1]) = 0x00000000ff9f5c25; + *((unsigned long*)& __m128i_result[0]) = 0x58fa6b4000000000; + __m128i_out = __lsx_vneg_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_op0[0]) = 0x00ff00ff00ff00ff; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vneg_b(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000010000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0xffffff0000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000000000001f; + *((unsigned long*)& __m128i_op0[0]) = 0x000000008000001e; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffe1; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff7fffffe2; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op0[0]) = 0xc8847ef6ed3f2000; + *((unsigned long*)& __m128i_result[1]) = 0x98147a504d145000; + *((unsigned long*)& __m128i_result[0]) = 0x377b810912c0e000; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffc00001ff800000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_result[0]) = 0x003ffffe00800000; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100000000; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000ffff0000ffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vneg_h(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x087c000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000087c; + *((unsigned long*)& __m128i_result[1]) = 0xf784000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffff784; + __m128i_out = __lsx_vneg_d(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vneg_w(__m128i_op0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-1.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-1.c new file mode 100644 index 00000000000..9d70b6f4347 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-1.c @@ -0,0 +1,230 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_b(__m128i_op0,0x6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_b(__m128i_op0,0x0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xc000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xf000000000000000; + __m128i_out = __lsx_vsat_b(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vsat_b(__m128i_op0,0x3); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff010181010102; + *((unsigned long*)& __m128i_op0[0]) = 0x7fffffff81010102; + *((unsigned long*)& __m128i_result[1]) = 0x03ff0101fc010102; + *((unsigned long*)& __m128i_result[0]) = 0x03fffffffc010102; + __m128i_out = __lsx_vsat_b(__m128i_op0,0x2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vsat_b(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_h(__m128i_op0,0x1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000040400000383; + *((unsigned long*)& __m128i_op0[0]) = 0xffff8383ffff7d0d; + *((unsigned long*)& __m128i_result[1]) = 0x0000040400000383; + *((unsigned long*)& __m128i_result[0]) = 0xffffe000ffff1fff; + __m128i_out = __lsx_vsat_h(__m128i_op0,0xd); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_h(__m128i_op0,0x6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffff8f8da00; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffff01018888; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffff00ff00; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff00ffff00; + __m128i_out = __lsx_vsat_h(__m128i_op0,0x8); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3f8000003f800001; + *((unsigned long*)& __m128i_op0[0]) = 0x3f8000003f800001; + *((unsigned long*)& __m128i_result[1]) = 0x0001000000010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000000010001; + __m128i_out = __lsx_vsat_h(__m128i_op0,0x1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000006f00001f0a; + *((unsigned long*)& __m128i_op0[0]) = 0x0000958affff995d; + *((unsigned long*)& __m128i_result[1]) = 0x0000006f00001f0a; + *((unsigned long*)& __m128i_result[0]) = 0x0000c000ffffc000; + __m128i_out = __lsx_vsat_h(__m128i_op0,0xe); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffffff; + __m128i_out = __lsx_vsat_h(__m128i_op0,0xd); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0038d800ff000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00fffe00fffffe00; + *((unsigned long*)& __m128i_result[1]) = 0x0038f000ff000000; + *((unsigned long*)& __m128i_result[0]) = 0x00fffe00fffffe00; + __m128i_out = __lsx_vsat_h(__m128i_op0,0xc); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_h(__m128i_op0,0xb); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_h(__m128i_op0,0xd); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x7fff00007fff0000; + *((unsigned long*)& __m128i_op0[0]) = 0x7fff00007fff0000; + *((unsigned long*)& __m128i_result[1]) = 0x003f0000003f0000; + *((unsigned long*)& __m128i_result[0]) = 0x003f0000003f0000; + __m128i_out = __lsx_vsat_h(__m128i_op0,0x6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0674c886fcba4e98; + *((unsigned long*)& __m128i_op0[0]) = 0xfdce8003090b0906; + *((unsigned long*)& __m128i_result[1]) = 0x003fffc0ffc0003f; + *((unsigned long*)& __m128i_result[0]) = 0xffc0ffc0003f003f; + __m128i_out = __lsx_vsat_h(__m128i_op0,0x6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_h(__m128i_op0,0x8); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x04e00060ffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x04e00060ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x007fffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x007fffffffffffff; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x17); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000017f0a82; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000003f; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x1d); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + unsigned_int_out = __lsx_vpickve2gr_wu(__m128i_op0,0x3); + *((unsigned long*)& __m128i_op0[1]) = 0x8006000080020000; + *((unsigned long*)& __m128i_op0[0]) = 0x8004000080020000; + *((unsigned long*)& __m128i_result[1]) = 0xfffffff8fffffff8; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff8fffffff8; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x3); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x12); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0xffffffffffffffff; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x10); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000008; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000008; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x6363636363636363; + *((unsigned long*)& __m128i_op0[0]) = 0xffd27db010d20fbf; + *((unsigned long*)& __m128i_result[1]) = 0x0000000f0000000f; + *((unsigned long*)& __m128i_result[0]) = 0xfffffff00000000f; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000003ff8; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000003ff8; + __m128i_out = __lsx_vsat_w(__m128i_op0,0x11); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_d(__m128i_op0,0x35); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-2.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-2.c new file mode 100644 index 00000000000..1cd5d6db0c0 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsat-2.c @@ -0,0 +1,271 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0xffff1739ffff48aa; + *((unsigned long*)& __m128i_op0[0]) = 0xffff2896ffff5b88; + *((unsigned long*)& __m128i_result[1]) = 0x3f3f17393f3f3f3f; + *((unsigned long*)& __m128i_result[0]) = 0x3f3f283f3f3f3f3f; + __m128i_out = __lsx_vsat_bu(__m128i_op0,0x5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0002000000020000; + *((unsigned long*)& __m128i_op0[0]) = 0x000001fc00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0001000000010000; + *((unsigned long*)& __m128i_result[0]) = 0x0000010100000000; + __m128i_out = __lsx_vsat_bu(__m128i_op0,0x0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffcc000b000b000b; + *((unsigned long*)& __m128i_op0[0]) = 0x000b000b010a000b; + *((unsigned long*)& __m128i_result[1]) = 0x7f7f000b000b000b; + *((unsigned long*)& __m128i_result[0]) = 0x000b000b010a000b; + __m128i_out = __lsx_vsat_bu(__m128i_op0,0x6); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000068; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000001f; + __m128i_out = __lsx_vsat_bu(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_bu(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffcd63ffffcd63; + *((unsigned long*)& __m128i_op0[0]) = 0xffffd765ffffd765; + *((unsigned long*)& __m128i_result[1]) = 0x1f1f1f1f1f1f1f1f; + *((unsigned long*)& __m128i_result[0]) = 0x1f1f1f1f1f1f1f1f; + __m128i_out = __lsx_vsat_bu(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_bu(__m128i_op0,0x4); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x000000120000000d; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000e0000000e; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000100000001; + __m128i_out = __lsx_vsat_bu(__m128i_op0,0x0); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xbf8000000000ffff; + *((unsigned long*)& __m128i_op0[0]) = 0xcf00000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x003f00000000003f; + *((unsigned long*)& __m128i_result[0]) = 0x003f000000000000; + __m128i_out = __lsx_vsat_hu(__m128i_op0,0x5); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000000007f8; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000000007f8; + *((unsigned long*)& __m128i_result[1]) = 0x00000000000000ff; + *((unsigned long*)& __m128i_result[0]) = 0x00000000000000ff; + __m128i_out = __lsx_vsat_hu(__m128i_op0,0x7); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_hu(__m128i_op0,0xc); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_hu(__m128i_op0,0xa); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000006de1; + *((unsigned long*)& __m128i_op0[0]) = 0x5f9ccf33cf600000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000007; + *((unsigned long*)& __m128i_result[0]) = 0x0007000700070000; + __m128i_out = __lsx_vsat_hu(__m128i_op0,0x2); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0xb); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000fff7fc01; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x000000000000000f; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0x3); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0x1d); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0x14); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000003; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000003; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0x3); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000bd3d00000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000bd3d00000000; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0x19); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0x12); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0x9); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0007000000050000; + *((unsigned long*)& __m128i_op0[0]) = 0x0003000000010000; + *((unsigned long*)& __m128i_result[1]) = 0x00003fff00003fff; + *((unsigned long*)& __m128i_result[0]) = 0x00003fff00003fff; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0xd); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x001a323b5430048c; + *((unsigned long*)& __m128i_op0[0]) = 0x008f792cab1cb915; + *((unsigned long*)& __m128i_result[1]) = 0x001a323b00ffffff; + *((unsigned long*)& __m128i_result[0]) = 0x008f792c00ffffff; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0x17); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_wu(__m128i_op0,0xc); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x20); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x25); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x7fffffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x7fffffffffffffff; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x3e); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x6363636389038903; + *((unsigned long*)& __m128i_op0[0]) = 0x6363636389038903; + *((unsigned long*)& __m128i_result[1]) = 0x000000000001ffff; + *((unsigned long*)& __m128i_result[0]) = 0x000000000001ffff; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x10); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x22); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x36); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x000000001fffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x1c); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x17); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x7); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000101010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0001000100010001; + *((unsigned long*)& __m128i_result[1]) = 0x0001000101010001; + *((unsigned long*)& __m128i_result[0]) = 0x0001000100010001; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x34); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000202020200; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000100; + *((unsigned long*)& __m128i_result[1]) = 0x000000001fffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000100; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x1c); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xa8a74bff9e9e0070; + *((unsigned long*)& __m128i_op0[0]) = 0x9e9e72ff9e9ff9ff; + *((unsigned long*)& __m128i_result[1]) = 0x0000ffffffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x0000ffffffffffff; + __m128i_out = __lsx_vsat_du(__m128i_op0,0x2f); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsigncov.c b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsigncov.c new file mode 100644 index 00000000000..bab6e08c4e4 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-vsigncov.c @@ -0,0 +1,424 @@ +/* { dg-do run } */ +/* { dg-options "-mlsx -w -fno-strict-aliasing" } */ +#include "../simd_correctness_check.h" +#include + +int main () +{ + __m128i __m128i_op0, __m128i_op1, __m128i_op2, __m128i_out, __m128i_result; + __m128 __m128_op0, __m128_op1, __m128_op2, __m128_out, __m128_result; + __m128d __m128d_op0, __m128d_op1, __m128d_op2, __m128d_out, __m128d_result; + + int int_op0, int_op1, int_op2, int_out, int_result, i=1, fail; + long int long_op0, long_op1, long_op2, lont_out, lont_result; + long int long_int_out, long_int_result; + unsigned int unsigned_int_out, unsigned_int_result; + unsigned long int unsigned_long_int_out, unsigned_long_int_result; + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffff00000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00003f803f800100; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsigncov_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000001; + *((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_vsigncov_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_vsigncov_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]) = 0x52527d7d52527d7d; + *((unsigned long*)& __m128i_op1[0]) = 0x52527d7d52527d7d; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsigncov_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x870968c1f56bb3cd; + *((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_vsigncov_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xf000e001bf84df83; + *((unsigned long*)& __m128i_op0[0]) = 0xfff8e001ff84e703; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ca354688; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xffffffff35cab978; + __m128i_out = __lsx_vsigncov_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]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x6a57a30ff0000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsigncov_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000000000000d; + *((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_vsigncov_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfe00fe00fe00fd01; + *((unsigned long*)& __m128i_op0[0]) = 0xfe00fffefe0100f6; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffff00000001; + *((unsigned long*)& __m128i_op1[0]) = 0xffffff0000010000; + *((unsigned long*)& __m128i_result[1]) = 0x0100010000000001; + *((unsigned long*)& __m128i_result[0]) = 0x0100010000010000; + __m128i_out = __lsx_vsigncov_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_vsigncov_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000020000000; + *((unsigned long*)& __m128i_op0[0]) = 0x000000183fffffe5; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000400000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000400000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsigncov_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]) = 0xffff3d06ffff4506; + *((unsigned long*)& __m128i_op1[0]) = 0x7ffffffe7ffff800; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsigncov_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]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_op1[0]) = 0x000a000a000a000a; + *((unsigned long*)& __m128i_result[1]) = 0xfff6fff6fff6fff6; + *((unsigned long*)& __m128i_result[0]) = 0xfff6fff6fff6fff6; + __m128i_out = __lsx_vsigncov_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_vsigncov_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x3fffff0000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x3fffff0000000000; + *((unsigned long*)& __m128i_op1[1]) = 0x3f8000003f800000; + *((unsigned long*)& __m128i_op1[0]) = 0x3f8000003f800000; + *((unsigned long*)& __m128i_result[1]) = 0x3f80000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x3f80000000000000; + __m128i_out = __lsx_vsigncov_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfff8fff8fff8fff8; + *((unsigned long*)& __m128i_op0[0]) = 0xfff8fff8fff8fff8; + *((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_vsigncov_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_vsigncov_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_vsigncov_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]) = 0x52525252525252cb; + *((unsigned long*)& __m128i_op1[0]) = 0x52525252525252cb; + *((unsigned long*)& __m128i_result[1]) = 0xaeaeaeaeaeaeae35; + *((unsigned long*)& __m128i_result[0]) = 0xaeaeaeaeaeaeae35; + __m128i_out = __lsx_vsigncov_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_vsigncov_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op0[0]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op1[1]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_op1[0]) = 0x370bdfecffecffec; + *((unsigned long*)& __m128i_result[1]) = 0x370bdfec00130014; + *((unsigned long*)& __m128i_result[0]) = 0x370bdfec00130014; + __m128i_out = __lsx_vsigncov_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0002020002020200; + *((unsigned long*)& __m128i_op0[0]) = 0x021f3b0205150600; + *((unsigned long*)& __m128i_op1[1]) = 0x0001000300400002; + *((unsigned long*)& __m128i_op1[0]) = 0x000100010040fffb; + *((unsigned long*)& __m128i_result[1]) = 0x0001000300400002; + *((unsigned long*)& __m128i_result[0]) = 0x000100010040fffb; + __m128i_out = __lsx_vsigncov_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_vsigncov_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000ff801c9e; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000810000; + *((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_vsigncov_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_vsigncov_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]) = 0x0080008000800080; + *((unsigned long*)& __m128i_op1[0]) = 0x008003496dea0c61; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsigncov_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_vsigncov_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_vsigncov_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0101000100010001; + *((unsigned long*)& __m128i_op0[0]) = 0x0101030100010001; + *((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_vsigncov_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000400000004; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000400000004; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000400000004; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000400000004; + *((unsigned long*)& __m128i_result[1]) = 0x0000000400000004; + *((unsigned long*)& __m128i_result[0]) = 0x0000000400000004; + __m128i_out = __lsx_vsigncov_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]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000004; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000004; + __m128i_out = __lsx_vsigncov_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op1[1]) = 0x1ab6021f72496458; + *((unsigned long*)& __m128i_op1[0]) = 0x7750af4954c29940; + *((unsigned long*)& __m128i_result[1]) = 0xe64afee18eb79ca8; + *((unsigned long*)& __m128i_result[0]) = 0x89b051b7ac3e67c0; + __m128i_out = __lsx_vsigncov_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsigncov_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x441ba9fcffffffff; + *((unsigned long*)& __m128i_op0[0]) = 0x181b2541ffffffff; + *((unsigned long*)& __m128i_op1[1]) = 0x7fffffff7ffffffe; + *((unsigned long*)& __m128i_op1[0]) = 0x7fffffff7ffffffe; + *((unsigned long*)& __m128i_result[1]) = 0x7fff010181010102; + *((unsigned long*)& __m128i_result[0]) = 0x7fffffff81010102; + __m128i_out = __lsx_vsigncov_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x00000000045340a6; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000028404044; + *((unsigned long*)& __m128i_op1[1]) = 0x003f0000ffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x003f0000ffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x00000000ffffffff; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffffffff; + __m128i_out = __lsx_vsigncov_w(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0010001000000010; + *((unsigned long*)& __m128i_op0[0]) = 0x0010001000100010; + *((unsigned long*)& __m128i_op1[1]) = 0x67eb85afb2ebb000; + *((unsigned long*)& __m128i_op1[0]) = 0xc8847ef6ed3f2000; + *((unsigned long*)& __m128i_result[1]) = 0x67eb85af0000b000; + *((unsigned long*)& __m128i_result[0]) = 0xc8847ef6ed3f2000; + __m128i_out = __lsx_vsigncov_h(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000100000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000103; + *((unsigned long*)& __m128i_op1[1]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op1[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[1]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_result[0]) = 0xfffffffffffffffc; + __m128i_out = __lsx_vsigncov_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op0[0]) = 0xfffffffffffffffc; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000100000001; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsigncov_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_vsigncov_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0000000000000034; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op1[0]) = 0x003ffffe00800000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000000; + __m128i_out = __lsx_vsigncov_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x004001be00dc008e; + *((unsigned long*)& __m128i_op1[1]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_op1[0]) = 0xffffffffffffffff; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x00ffff0100010001; + __m128i_out = __lsx_vsigncov_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0xfff9fffefff9ffff; + *((unsigned long*)& __m128i_op1[1]) = 0x04faf60009f5f092; + *((unsigned long*)& __m128i_op1[0]) = 0x04fafa9200000000; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0xfc06066e00000000; + __m128i_out = __lsx_vsigncov_b(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000001; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000fffe0002; + *((unsigned long*)& __m128i_op1[1]) = 0x000000000667ae56; + *((unsigned long*)& __m128i_op1[0]) = 0x0000000000000020; + *((unsigned long*)& __m128i_result[1]) = 0x000000000667ae56; + *((unsigned long*)& __m128i_result[0]) = 0x0000000000000020; + __m128i_out = __lsx_vsigncov_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op0[0]) = 0x0002000100020002; + *((unsigned long*)& __m128i_op1[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_op1[0]) = 0x0002000100020002; + *((unsigned long*)& __m128i_result[1]) = 0x0000000000000000; + *((unsigned long*)& __m128i_result[0]) = 0x0002000100020002; + __m128i_out = __lsx_vsigncov_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + *((unsigned long*)& __m128i_op0[1]) = 0x0001000100010012; + *((unsigned long*)& __m128i_op0[0]) = 0x00000000ffe1ffc0; + *((unsigned long*)& __m128i_op1[1]) = 0x0001000100010012; + *((unsigned long*)& __m128i_op1[0]) = 0x00000000ffe1ffc0; + *((unsigned long*)& __m128i_result[1]) = 0x0001000100010012; + *((unsigned long*)& __m128i_result[0]) = 0x00000000ffe1ffc0; + __m128i_out = __lsx_vsigncov_d(__m128i_op0,__m128i_op1); + ASSERTEQ_64(__LINE__, __m128i_result, __m128i_out); + + return 0; +}