From patchwork Thu Sep 7 07:00:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenxiaolong X-Patchwork-Id: 137612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp2782953vqo; Thu, 7 Sep 2023 00:03:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2xgTaNyWuWdbTfGcl6SGf3+NRHh0wuywO66df4XnjAfeYKii0A+WqHAUTBA7j8KRF4GTr X-Received: by 2002:a19:7903:0:b0:501:c406:c296 with SMTP id u3-20020a197903000000b00501c406c296mr3419613lfc.31.1694070185023; Thu, 07 Sep 2023 00:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694070184; cv=none; d=google.com; s=arc-20160816; b=F+v7wNORTm3AQw3XOkiTiGiTg477xKLvjgzXDp67Q15moK7IcEMewGfaVmo2bJ0opY O3rF4WVJwkmiLgWMpbfT9EL2EExg3tbjLTplona01ifDdJplQWK6kM9Kd/ArcRiFpYbQ CIsutV2XLU92KSRoeXE9Ls7GJYj5MXxyf9rcG/wkuYU/Va1s5xpz3I2GH5AbEN+YwOun 1y5v2+n2P5h45jzo1f2q2HH/rHmN2m+cAcyAiUgHIk0e0lN1ao8VKIw9pFzxw00pQCe+ aDpVxicgYRhMVN3+mAxZDda8ukcILdyHb07oeTJMzTXCemrNOAp9WzHFJQDm30qTc+J0 /jPQ== 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=U5U3ehaBZBWBEUUpPF6LJoAlvytkaXQpDqHpSi9sIfU=; fh=BpFCyCzVJo4znJIvOjeDfKzcGsF6Q+JgJbJ+1ev/kM4=; b=0KXBeOZET1goarB68q7Eu7PO2cGVr82KvPYzIUuTEDfLbXEkdy/DpJF67nRtHuQ+mA n5b+9/0AwjFr1RDSTlC+Od+ZJKH3L7DUWv7yRgicOy/vtqFz4ZAFalwZD69QpOBmH4Cm GFj6jPbZzQmKAZzHi4FN6Kae2MsQ0rSKnETXZVQ3NM4UwCO07qJitBq2uwT/fOlBS8s+ hsdkbtiMSu6eLmllptaL4BfvGg2ZQdrMJj0M1htdnTLtZnsqI3+kIN7kEkG0I63kHy3E rZoArukawqwNLO9H3XY2aBbBfDmZ0cziKwhu1RS/eQDaqpvz19DJGj4UZGBYKayz7/TN LLiw== 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 b14-20020aa7cd0e000000b005256886827esi10047232edw.607.2023.09.07.00.03.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 00:03:04 -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 37DE93857027 for ; Thu, 7 Sep 2023 07:02:07 +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 452353858C39 for ; Thu, 7 Sep 2023 07:01:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 452353858C39 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 1qe91B-0004DS-4l for gcc-patches@gcc.gnu.org; Thu, 07 Sep 2023 03:01:36 -0400 Received: from loongson.cn (unknown [10.10.130.252]) by gateway (Coremail) with SMTP id _____8AxuepFdflktiYhAA--.56288S3; Thu, 07 Sep 2023 15:01:25 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxzyM6dflkIzFwAA--.31156S6; Thu, 07 Sep 2023 15:01:22 +0800 (CST) From: Xiaolong Chen To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 2/4] LoongArch: Add testsuite framework for Loongson SX/ASX. Date: Thu, 7 Sep 2023 15:00:59 +0800 Message-Id: <20230907070101.22062-3-chenxiaolong@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230907070101.22062-1-chenxiaolong@loongson.cn> References: <20230907070101.22062-1-chenxiaolong@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8AxzyM6dflkIzFwAA--.31156S6 X-CM-SenderInfo: hfkh05xldrz0tqj6z05rqj20fqof0/1tbiAQAHBWT5TbUBUAAAs3 X-Coremail-Antispam: 1Uk129KBj93XoWxWr1UurW5JFW8Gw18Ar45twc_yoWrJr43pa y7ur1a9a1xWa9xWrs3Way5Ar45ZFn7GrW2vFyfJ3y0kry7t3sFvF1kKrsIqFy3Ja45Cr4F 93Zxuw1UXanxZabCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa 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.5 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: 1776361338674940352 X-GMAIL-MSGID: 1776361338674940352 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)