[PATCH] arc: Add --with-fpu support for ARCv2 cpus
Claudiu Zissulescu
claziss@gmail.com
Fri Jun 4 07:29:09 GMT 2021
Hi Jeff,
I would like to add spport for selecting the ARCv2 FPU extension at
configuration-time.
The --with-fpu configuration option is ignored when -mfpu compiler
option is specified.
My concern is using `grep -P` when configuring. Is that ok?
Thanks,
Claudiu
gcc/
yyyy-mm-dd Claudiu Zissulescu <claziss@synopsys.com>
* config.gcc (arc): Add support for with_cpu option.
* config/arc/arc.h (OPTION_DEFAULT_SPECS): Add fpu.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
---
gcc/config.gcc | 56 ++++++++++++++++++++++++++++++++++++++++++--
gcc/config/arc/arc.h | 4 ++++
2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 610422fb29ee..f46b5e79af69 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4258,18 +4258,70 @@ case "${target}" in
;;
arc*-*-*)
- supported_defaults="cpu"
+ supported_defaults="cpu fpu"
+ new_cpu=hs38_linux
if [ x"$with_cpu" = x ] \
|| grep "^ARC_CPU ($with_cpu," \
${srcdir}/config/arc/arc-cpus.def \
> /dev/null; then
# Ok
- true
+ new_cpu=$with_cpu
else
echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2
exit 1
fi
+
+ # see if --with-fpu matches any of the supported FPUs
+ case "$with_fpu" in
+ "")
+ # OK
+ ;;
+ fpus | fpus_div | fpus_fma | fpus_all)
+ # OK if em or hs
+ if grep -P "^ARC_CPU \($new_cpu,\s+[emhs]+," \
+ ${srcdir}/config/arc/arc-cpus.def \
+ > /dev/null; then
+ # OK
+ true
+ else
+ echo "Unknown floating point type used in "\
+ "--with-fpu=$with_fpu for cpu $new_cpu" 1>&2
+ exit 1
+ fi
+ ;;
+ fpuda | fpuda_div | fpuda_fma | fpuda_all)
+ # OK only em
+ if grep -P "^ARC_CPU \($new_cpu,\s+em," \
+ ${srcdir}/config/arc/arc-cpus.def \
+ > /dev/null; then
+ # OK
+ true
+ else
+ echo "Unknown floating point type used in "\
+ "--with-fpu=$with_fpu for cpu $new_cpu" 1>&2
+ exit 1
+ fi
+ ;;
+ fpud | fpud_div | fpud_fma | fpud_all)
+ # OK only hs
+ if grep -P "^ARC_CPU \($new_cpu,\s+hs," \
+ ${srcdir}/config/arc/arc-cpus.def \
+ > /dev/null; then
+ # OK
+ true
+ else
+ echo "Unknown floating point type used in"\
+ "--with-fpu=$with_fpu for cpu $new_cpu" 1>&2
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Unknown floating point type used in "\
+ "--with-fpu=$with_fpu" 1>&2
+ exit 1
+ ;;
+ esac
;;
csky-*-*)
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 722bb10b8813..b9c4ba0398e5 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -100,7 +100,11 @@ extern const char *arc_cpu_to_as (int argc, const char **argv);
"%:cpu_to_as(%{mcpu=*:%*}) %{mspfp*} %{mdpfp*} " \
"%{mfpu=fpuda*:-mfpuda} %{mcode-density}"
+/* Support for a compile-time default CPU and FPU. The rules are:
+ --with-cpu is ignored if -mcpu, mARC*, marc*, mA7, mA6 are specified.
+ --with-fpu is ignored if -mfpu is specified. */
#define OPTION_DEFAULT_SPECS \
+ {"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}"}, \
{"cpu", "%{!mcpu=*:%{!mARC*:%{!marc*:%{!mA7:%{!mA6:-mcpu=%(VALUE)}}}}}" }
#ifndef DRIVER_ENDIAN_SELF_SPECS
--
2.31.1
More information about the Gcc-patches
mailing list