From patchwork Wed Sep 6 10:45:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenxiaolong X-Patchwork-Id: 137568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp2224704vqo; Wed, 6 Sep 2023 03:45:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGWcPuM71pYLJ9IQu3/iiutm19jz244Sy8akIN9pYRQ/qhdN/dbnZvTl87z+xI696L/pJJ X-Received: by 2002:a17:906:3155:b0:99b:c038:fdac with SMTP id e21-20020a170906315500b0099bc038fdacmr1911320eje.20.1693997156650; Wed, 06 Sep 2023 03:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693997156; cv=none; d=google.com; s=arc-20160816; b=bej8A2pD0R9DH/Ztncc4cNyhTymYxFTvlbswZ30Qny0iIHt6WG9HkNhhO1lzz7xXK3 awUnHfjRkSKCl/KGB6bSdqkaZoWHYrOxgI43WQtVrs3iXJLZBFVH5QV37pJe6fFIYtDY F5Rn6dypfCwuV51mJ5OHlNYVFfNn5Rm8UsMmWJl0sPuyRDsVPp7sIXfUGLTdrL20OpcN VQWyKg9Kh1yMuXoUXV2OWjMI1kMAO62WzbI+jukmymLYzh//WTCYHpiJZyApa6fbK3ba OPA4MxqhXibeqgJJeUgSAnRFlD9TAbPAGSVHyqtUv7Ov7sCjWfhM5Eb2UnsAVh8ikq4a COmQ== 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:message-id:date:subject:to:from:dmarc-filter :delivered-to; bh=U5U3ehaBZBWBEUUpPF6LJoAlvytkaXQpDqHpSi9sIfU=; fh=BpFCyCzVJo4znJIvOjeDfKzcGsF6Q+JgJbJ+1ev/kM4=; b=hUU6uGxr6TvGkvp/PPLXYGYi/nYrzXEdDszFOVZuLEvGr4pQHFKGl4e7X3mpz8wX2C MfjJHv7ft26w06p7GiJ3OfuIqd37uJ8WSdM/0XCPe36n5qym9VfP035vSFYnlQrSsYjA em2WRK1Ar/q1EJJHZg+JfPEIsJe5Q0p53gzb3QHnFc7IBeYZdx7L0k1yTnAtrHMmUeaL 72GXA5/GfCF+wcXE1XCMUzSwRv9+8ujoDj4VwM6kdYIFKDKLjDGAnh2FI0pNrO6rhuj+ WVPtR4uwDtvRnfRbkggytDlsChq3oOqvqPBUOpnaILwyGw6K7CJTZzszLKJ1iTfSbYrO wt2Q== 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 pk24-20020a170906d7b800b00992f7fe9c0bsi9502725ejb.328.2023.09.06.03.45.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Sep 2023 03:45:56 -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 84F44385482E for ; Wed, 6 Sep 2023 10:45:45 +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 2B2613858C3A for ; Wed, 6 Sep 2023 10:45:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2B2613858C3A 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 _____8Cx77s9WPhki1AgAA--.5895S3; Wed, 06 Sep 2023 18:45:17 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxJ807WPhk3HpuAA--.1986S4; Wed, 06 Sep 2023 18:45:15 +0800 (CST) From: Xiaolong Chen To: gcc-patches@gcc.gnu.org Subject: [PATCH v1 2/4] LoongArch: Add testsuite framework for Loongson SX/ASX. Date: Wed, 6 Sep 2023 18:45:12 +0800 Message-Id: <20230906104512.46432-1-chenxiaolong@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxJ807WPhk3HpuAA--.1986S4 X-CM-SenderInfo: hfkh05xldrz0tqj6z05rqj20fqof0/1tbiAQAGBWT3-DUFDgAAsT X-Coremail-Antispam: 1Uk129KBj93XoWxWr1UurW5JFW8Gw18Ar45twc_yoWrJr43pa y7ur1a9a1xWa9xWrs3Way5Ar45ZFn7GrW2vFyfJ3y0kry7t3sFvF1kKrsIqFy3Ja45Cr4F 93Zxuw1UXanxZabCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUk0b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v2 6F4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc 02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAF wI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7V AKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCj r7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6x IIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAI w20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x 0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUwMKuUUUUU X-Spam-Status: No, score=-11.4 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: 1776284762590584628 X-GMAIL-MSGID: 1776284762590584628 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 | 39 +++++++++++++++++ 2 files changed, 81 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..b0616a26b0e --- /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 " -mlasx" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/lsx/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/lasx/*.\[cS\]]] \ + "" $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..7be199ee3a0 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h @@ -0,0 +1,39 @@ +#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)