diff --git a/.github/workflows/gcc-compilation.yml b/.github/workflows/gcc-compilation.yml
new file mode 100644
index 000000000..211591c24
--- /dev/null
+++ b/.github/workflows/gcc-compilation.yml
@@ -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
diff --git a/g++-auto-generated.exp b/g++-auto-generated.exp
new file mode 100644
index 000000000..281c09a58
--- /dev/null
+++ b/g++-auto-generated.exp
@@ -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
+# .
+
+# 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
diff --git a/gcc-auto-generated.exp b/gcc-auto-generated.exp
new file mode 100644
index 000000000..d1c9b7b99
--- /dev/null
+++ b/gcc-auto-generated.exp
@@ -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
+# .
+
+# 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
diff --git a/rvv-intrinsic-generator/Makefile b/rvv-intrinsic-generator/Makefile
index fbc33e700..b17770a24 100644
--- a/rvv-intrinsic-generator/Makefile
+++ b/rvv-intrinsic-generator/Makefile
@@ -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
@@ -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
###############################################################################