From patchwork Mon Sep 11 03:44:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenxiaolong X-Patchwork-Id: 137873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp1857283vqo; Sun, 10 Sep 2023 20:46:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTykg1UHTN/rZRpZoFR93ViIre7jW5KxA++M+We/sz7i+3INWLIfBQE/eGvN3kTZ4C9/eo X-Received: by 2002:a2e:990b:0:b0:2bd:f8:1b6a with SMTP id v11-20020a2e990b000000b002bd00f81b6amr5753151lji.36.1694404013805; Sun, 10 Sep 2023 20:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694404013; cv=none; d=google.com; s=arc-20160816; b=cVjtq4dhLaXxG5xYOc/8txNHHYAJBttAzg3Iq8KVAzjW3fqydUUbm3cpYeTRsI81kW gm3S6EE461psm2g1rfjnbFXFy0WRG7Ehrz3YDltfz+NXW1845IxCbJBGagCt7RC5hft3 e+brTRNSI9cQwENM+rX89NtrbQEPUeZC5xe4socL0xkdoB33qkvedHHiGF4+YvptAngi CmDJPXPhzprCm1QP3e+UtiGUhLADuMstldiMLatdhcxGlWVCJA0ND4yiZHIrI+X2uhQw PWjcsBRZpLoXQKkywhRg27S2ndMUvut0fZE30XsMX/nwvnoSFuG2PI5Iq1iD4s2TpFe3 aNVw== 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=WA9R7l/imekZbfO0nvZE+5FEjUIZFXkFGLbrQ9y97VI=; fh=BpFCyCzVJo4znJIvOjeDfKzcGsF6Q+JgJbJ+1ev/kM4=; b=twMduQoMPTgNWRm7vu7IRSlLzSHY1Uw09Uq1EIFBtr1l+UpiJkud72ucfOsSn6ZQ21 IfLOz/p2wI9VO6YCzQUdHnJIF1RQnsabpMfww+6RHImmTcAqnihuqaW/z74ixNvnuZdJ 1CR9zizyldU+46uLhDA3Z1zvJZZnvjUx+7JP3YVJFc0BWnL4DxIuCZiFz/UifiKJCFYX wKRMEmPBrO0a9H5FDbrPpnViL9SkdutyDTRH3MwIopLiC/yTLqOMf04vcGMvQkoikC1z 8W3U6jF0qVZWFJCNCHP3v2UVoCRTTfviKyVq0Hky1vx2EwxOVON5d4gjh1Znzwc2Pf8j dCSQ== 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 mh25-20020a170906eb9900b009a59b604305si5975831ejb.406.2023.09.10.20.46.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Sep 2023 20:46:53 -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 2D1FC38515F7 for ; Mon, 11 Sep 2023 03:46:03 +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 619053858D3C for ; Mon, 11 Sep 2023 03:45:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 619053858D3C 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 _____8BxXetejf5k4kQkAA--.288S3; Mon, 11 Sep 2023 11:45:34 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dx_yNXjf5kzKZ2AA--.44820S6; Mon, 11 Sep 2023 11:45:32 +0800 (CST) From: Xiaolong Chen To: gcc-patches@gcc.gnu.org Subject: [PATCH v3 2/9] LoongArch: Add testsuite framework for Loongson SX/ASX. Date: Mon, 11 Sep 2023 11:44:32 +0800 Message-Id: <20230911034439.8266-3-chenxiaolong@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230911034439.8266-1-chenxiaolong@loongson.cn> References: <20230911034439.8266-1-chenxiaolong@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Dx_yNXjf5kzKZ2AA--.44820S6 X-CM-SenderInfo: hfkh05xldrz0tqj6z05rqj20fqof0/1tbiAQALBWT9QjYDlgAAs3 X-Coremail-Antispam: 1Uk129KBj93XoWxZw1kZr45JryxWr48CF1xWFX_yoWrJF17pa y7Zr1a9F4xWa9xWrnrWay5AF45ZFn7GFWavFyft3y8Cry7t3sFvF1kKrnxXFy3Ja45Ar4S 93Zxuw1UXan8ZabCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07UMpBfUUUUU= 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: 1776711383079196242 X-GMAIL-MSGID: 1776711383079196242 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..f33bad82cb2 --- /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..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)