1 Star 0 Fork 128

花花世界/gcc

forked from src-openEuler/gcc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LoongArch-Add-testsuite-framework-for-Loongson-SX-AS.patch 6.36 KB
一键复制 编辑 原始数据 按行查看 历史
ticat_fp 提交于 2024-03-26 09:26 . LoongArch: update from gcc upstream
From aebd03c944312be767f03d129eeebc0c4cdf5b4a Mon Sep 17 00:00:00 2001
From: Xiaolong Chen <chenxiaolong@loongson.cn>
Date: Mon, 11 Sep 2023 09:36:35 +0800
Subject: [PATCH 077/124] LoongArch: Add testsuite framework for Loongson
SX/ASX.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/vector/loongarch-vector.exp: New test.
* gcc.target/loongarch/vector/simd_correctness_check.h: New test.
Signed-off-by: Peng Fan <fanpeng@loongson.cn>
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
---
.../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 000000000..2c37aa91d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp
@@ -0,0 +1,42 @@
+#Copyright(C) 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
+# <http: //www.gnu.org/licenses/>.
+
+#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 000000000..eb7fbd59c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h
@@ -0,0 +1,54 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#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)
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/suwei1202/gcc.git
git@gitee.com:suwei1202/gcc.git
suwei1202
gcc
gcc
master

搜索帮助