From patchwork Wed Sep 13 03:31:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenxiaolong X-Patchwork-Id: 138579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp830119vqx; Tue, 12 Sep 2023 20:33:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkT18iSAGFGfwKC+XnuW7EiZc0EQVXTh38odfn5idnnFJ9qop9r75n0Rx7l77QL6Uo/bhS X-Received: by 2002:a17:906:9c1:b0:9a2:2635:daa8 with SMTP id r1-20020a17090609c100b009a22635daa8mr1046058eje.56.1694576021271; Tue, 12 Sep 2023 20:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694576021; cv=none; d=google.com; s=arc-20160816; b=0Ii5OKr/vm451Pz+/ebcQZvujV9GYIEf5mkPbO6+d2phmMRTZft4mGUMbRj3THNfeT Bs3h4799MFR6jA+IvBJORsW//83ftzlDCiVOwRybSPRKhmM48O2wAFuCRsFQWLSVo+14 JkRnKZFftpZc9DEY3ksAzbP1IxoKS53GkMhegXMSHrzyOb9iVDwMfoFFvoNJ1r6qbK3K Ix812HTxSiIwcCabyGotuWz09hdIX612Mgp5rLsKoeGKtLkd/Ef0gpDUE5XJJKjxVGku dc18BzhK4ezY5v+3qkji7c1nHWz2342d+VdvQuLTl15JJ+Um3bXzg0YzBUdTnkqbnV36 uwEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dmarc-filter:delivered-to; bh=FrgN5TuoS7UONcFDNRlHlCFtqCDnpD/i2+aVlrbe89M=; fh=3pFUYcpS/27XRzOf17GfR86AuNQu+P1CET04YURgCLs=; b=Af2tWfhwvHlcKCZDt83P96eFSyuJCJHb5NkwIx/PMsxiahUObyfcFz5ZDZfpXqufc5 KKUBu/+UPDuKTxmJoOjv9/Vnuo7mVyJsi0QjY2+DnwIKaD/1Nn5mdhEVj8S1aKtd5QnF EIdjRkhhL3Uz+13O3qQdS2udt5itNYeSbQGyk3RZdEUw6ry6fOgcD3x7BoTgoDjrR1+I XDNmE+ZH3+ehonu4QI9g0wp4ERhSdmCb95y2aZjGIRgJou3c0uWZgzvmYpg5h4SNu+Wh c+VmqN8ujv+0kxgxCzZkX/tuOHVnfBhlJHYmkC/I5lx/Qet519w0RJHdEkqij0CSXttK LGxA== 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 si9-20020a170906cec900b009a1f53509a7si10256999ejb.135.2023.09.12.20.33.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 20:33:41 -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 E8B5838319E7 for ; Wed, 13 Sep 2023 03:32:41 +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 6C1E73857C40 for ; Wed, 13 Sep 2023 03:32:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C1E73857C40 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 1qgGbn-0000zU-7w for gcc-patches@gcc.gnu.org; Tue, 12 Sep 2023 23:32:11 -0400 Received: from loongson.cn (unknown [10.10.130.252]) by gateway (Coremail) with SMTP id _____8Dx_7sxLQFlKjAmAA--.15081S3; Wed, 13 Sep 2023 11:32:01 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxrdwqLQFlxQ4CAA--.3491S6; Wed, 13 Sep 2023 11:32:00 +0800 (CST) From: Xiaolong Chen To: gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, i@xen0n.name, xuchenghua@loongson.cn, chenglulu@loongson.cn, Xiaolong Chen Subject: [PATCH v4 02/23] LoongArch: Add testsuite framework for Loongson SX/ASX. Date: Wed, 13 Sep 2023 11:31:27 +0800 Message-Id: <20230913033148.5752-3-chenxiaolong@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230913033148.5752-1-chenxiaolong@loongson.cn> References: <20230913033148.5752-1-chenxiaolong@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxrdwqLQFlxQ4CAA--.3491S6 X-CM-SenderInfo: hfkh05xldrz0tqj6z05rqj20fqof0/1tbiAQANBWUBHCIA6gAAs5 X-Coremail-Antispam: 1Uk129KBj93XoWxZw4UXrykCr45CFWkXr4DKFX_yoWrJF1kpa y7Zr1a9F4xWa9xWrnrWay5AF45AFn7GFWavFyft3yUCry7t3sFvFn5KrsxXFy3Ja45Ar4F g3Zxuw1UJan8ZabCm3ZEXasCq-sJn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j1LvtUUUUU= 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776891745867025799 X-GMAIL-MSGID: 1776891745867025799 gcc/testsuite/ChangeLog: * gcc.target/loongarch/vector/loongarch-vector.exp: New test. * gcc.target/loongarch/vector/simd_correctness_check.h: New test. --- .../loongarch/vector/loongarch-vector.exp | 42 +++++++++++++++ .../loongarch/vector/simd_correctness_check.h | 54 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h diff --git a/gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp b/gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp new file mode 100644 index 00000000000..2cbf9ac6ac1 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp @@ -0,0 +1,42 @@ +#Copyright(C) 2021 - 2023 Free Software Foundation, Inc. + +#This program is free software; you can redistribute it and / or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 3 of the License, or +#(at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with GCC; see the file COPYING3.If not see +# . + +#GCC testsuite that uses the `dg.exp' driver. + +#Exit immediately if this isn't a LoongArch target. +if ![istarget loongarch*-*-*] then { + return +} + +#Load support procs. +load_lib gcc-dg.exp + +#If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS "" +} + +#Initialize `dg'. +dg-init + +#Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/lsx/*.\[cS\]]] \ + "-mlsx" $DEFAULT_CFLAGS +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/lasx/*.\[cS\]]] \ + "-mlasx" $DEFAULT_CFLAGS +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h b/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h new file mode 100644 index 00000000000..eb7fbd59cc7 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h @@ -0,0 +1,54 @@ +#include +#include +#include + +#define ASSERTEQ_64(line, ref, res) \ + do \ + { \ + int fail = 0; \ + for (size_t i = 0; i < sizeof (res) / sizeof (res[0]); ++i) \ + { \ + long *temp_ref = &ref[i], *temp_res = &res[i]; \ + if (abs (*temp_ref - *temp_res) > 0) \ + { \ + printf (" error: %s at line %ld , expected " #ref \ + "[%ld]:0x%lx, got: 0x%lx\n", \ + __FILE__, line, i, *temp_ref, *temp_res); \ + fail = 1; \ + } \ + } \ + if (fail == 1) \ + abort (); \ + } \ + while (0) + +#define ASSERTEQ_32(line, ref, res) \ + do \ + { \ + int fail = 0; \ + for (size_t i = 0; i < sizeof (res) / sizeof (res[0]); ++i) \ + { \ + int *temp_ref = &ref[i], *temp_res = &res[i]; \ + if (abs (*temp_ref - *temp_res) > 0) \ + { \ + printf (" error: %s at line %ld , expected " #ref \ + "[%ld]:0x%x, got: 0x%x\n", \ + __FILE__, line, i, *temp_ref, *temp_res); \ + fail = 1; \ + } \ + } \ + if (fail == 1) \ + abort (); \ + } \ + while (0) + +#define ASSERTEQ_int(line, ref, res) \ + do \ + { \ + if (ref != res) \ + { \ + printf (" error: %s at line %ld , expected %d, got %d\n", __FILE__, \ + line, ref, res); \ + } \ + } \ + while (0)