Skip to content

Commit

Permalink
Add workflow to test latest GNU GCC toolchain compilation for the int…
Browse files Browse the repository at this point in the history
…rinsics
  • Loading branch information
yulong18 authored and eopXD committed Oct 11, 2023
1 parent 66cfdc2 commit 3f0ac66
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/gcc-compilation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: GNU GCC intrinsic test cases compilation
on:
push:
branches:
- main
schedule:
- cron: "0 18 * * 0-6"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prerequisites
run:
sudo apt-get install autoconf automake autotools-dev curl python3 python3-pip
libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf
libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev
dejagnu expect tcl
- name: Download GCC
run: |
cd .. && rm -rf riscv-gnu-toolchain
git clone --recursive https://github.com/riscv-collab/riscv-gnu-toolchain.git
echo $(pwd)
cd $(pwd)/riscv-gnu-toolchain/gcc
git remote update
git reset --hard origin/master
cd ../binutils
git remote update
git reset --hard origin/master
- name: Run auto generated test cases
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
make -C rvv-intrinsic-generator report-gnu GNU_TOOLCHAIN_DIR=$(pwd)/../riscv-gnu-toolchain
- name: Check gcc result
run: |
tail -n 17 $(pwd)/../riscv-gnu-toolchain/build-gcc-newlib-stage2/gcc/testsuite/gcc/gcc.log
- name: Check g++ result
run: |
tail -n 27 $(pwd)/../riscv-gnu-toolchain/build-gcc-newlib-stage2/gcc/testsuite/g++/g++.log
51 changes: 51 additions & 0 deletions g++-auto-generated.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (C) 2022-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 RISC-V target.
if ![istarget riscv*-*-*] then {
return
}

# Load support procs.
load_lib g++-dg.exp

# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
set DEFAULT_CFLAGS " -ansi -pedantic-errors"
}

set gcc_march "rv64gcv_zvfh"
set gcc_mabi "lp64d"

# Initialize `dg'.
dg-init

# Main loop.
set CFLAGS "$DEFAULT_CFLAGS -march=$gcc_march -mabi=$gcc_mabi -O3"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/policy_funcs/gnu-api-tests/*.\[cS\]]] \
"" $CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/policy_funcs/gnu-overloaded-tests/*.\[cS\]]] \
"" $CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/gnu-api-tests/*.\[cS\]]] \
"" $CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/gnu-overloaded-tests/*.\[cS\]]] \
"" $CFLAGS

# All done.
dg-finish
51 changes: 51 additions & 0 deletions gcc-auto-generated.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (C) 2022-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 RISC-V target.
if ![istarget riscv*-*-*] 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 " -ansi -pedantic-errors"
}

set gcc_march "rv64gcv_zvfh"
set gcc_mabi "lp64d"

# Initialize `dg'.
dg-init

# Main loop.
set CFLAGS "$DEFAULT_CFLAGS -march=$gcc_march -mabi=$gcc_mabi -O3"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/policy_funcs/gnu-api-tests/*.\[cS\]]] \
"" $CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/policy_funcs/gnu-overloaded-tests/*.\[cS\]]] \
"" $CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/gnu-api-tests/*.\[cS\]]] \
"" $CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/gnu-overloaded-tests/*.\[cS\]]] \
"" $CFLAGS

# All done.
dg-finish
31 changes: 31 additions & 0 deletions rvv-intrinsic-generator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ TRIGGER_SKIP_DEFAULT_INST := --skip-default-inst
else
TRIGGER_SKIP_DEFAULT_INST :=
endif
# Directory that stores the gnu toolchain
GNU_TOOLCHAIN_DIR :=
# Directory that stores the gcc cases
GCC_CASES_DIR := $(GNU_TOOLCHAIN_DIR)/gcc/gcc/testsuite/gcc.target/riscv/rvv/gcc-auto-generated
# Directory that stores the g++ cases
G++_CASES_DIR := $(GNU_TOOLCHAIN_DIR)/gcc/gcc/testsuite/g++.target/riscv/rvv/g++-auto-generated

###############################################################################
# Functions
Expand Down Expand Up @@ -323,6 +329,31 @@ run-test:
CC=${COMPILER} \
-f ${API_MAKEFILE} -j${nproc}

# Test gnu auto generaged overloaded-api-testing with testing-report
report-gnu:
cd ${GNU_TOOLCHAIN_DIR} && ./configure --prefix="${GNU_TOOLCHAIN_DIR}/install" \
--with-arch=rv64gcv \
--with-abi=lp64d \
--with-isa-spec=20191213 \
--with-sim=qemu
cd ${GNU_TOOLCHAIN_DIR} && make distclean
cd ${GNU_TOOLCHAIN_DIR} && make -j 8
mkdir -p $(GCC_CASES_DIR)/gnu-api-tests
mkdir -p $(GCC_CASES_DIR)/policy_funcs/gnu-api-tests
cp $(DIR)/../gcc-auto-generated.exp $(GCC_CASES_DIR)/auto-generated.exp
cp -r $(DIR)/gnu-api-tests/* $(GCC_CASES_DIR)/gnu-api-tests/
cp -r $(DIR)/policy_funcs/gnu-api-tests/* $(GCC_CASES_DIR)/policy_funcs/gnu-api-tests/
mkdir -p $(G++_CASES_DIR)/gnu-api-tests
mkdir -p $(G++_CASES_DIR)/policy_funcs/gnu-api-tests
mkdir -p $(G++_CASES_DIR)/gnu-overloaded-tests
mkdir -p $(G++_CASES_DIR)/policy_funcs/gnu-overloaded-tests
cp $(DIR)/../g++-auto-generated.exp $(G++_CASES_DIR)/auto-generated.exp
cp -r $(DIR)/gnu-api-tests/* $(G++_CASES_DIR)/gnu-api-tests/
cp -r $(DIR)/policy_funcs/gnu-api-tests/* $(G++_CASES_DIR)/policy_funcs/gnu-api-tests/
cp -r $(DIR)/gnu-overloaded-tests/* $(G++_CASES_DIR)/gnu-overloaded-tests/
cp -r $(DIR)/policy_funcs/gnu-overloaded-tests/* $(G++_CASES_DIR)/policy_funcs/gnu-overloaded-tests/
cd ${GNU_TOOLCHAIN_DIR} && make report -j 8 RUNTESTFLAGS="auto-generated.exp"

###############################################################################
# Custom Vendor Generator Target
###############################################################################
Expand Down

0 comments on commit 3f0ac66

Please sign in to comment.