From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1957) id D217F3836029; Mon, 14 Jun 2021 12:35:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D217F3836029 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Claudiu Zissulescu To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1422] arc: Add --with-fpu support for ARCv2 cpus X-Act-Checkin: gcc X-Git-Author: Claudiu Zissulescu X-Git-Refname: refs/heads/master X-Git-Oldrev: 831589c227cf1a53cb08490edbafb612d0a9db7c X-Git-Newrev: c4c47a84a16a29d7077f537051d90de1f3475957 Message-Id: <20210614123509.D217F3836029@sourceware.org> Date: Mon, 14 Jun 2021 12:35:09 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2021 12:35:09 -0000 https://gcc.gnu.org/g:c4c47a84a16a29d7077f537051d90de1f3475957 commit r12-1422-gc4c47a84a16a29d7077f537051d90de1f3475957 Author: Claudiu Zissulescu Date: Mon Jun 14 15:33:17 2021 +0300 arc: Add --with-fpu support for ARCv2 cpus Support for a compile-time default FPU. The --with-fpu configuration option is ignored if -mfpu compiler option is specified. The FPU options are only available for ARCv2 cpus. gcc/ 2021-06-14 Claudiu Zissulescu * config.gcc (arc): Add support for with_cpu option. * config/arc/arc.h (OPTION_DEFAULT_SPECS): Add fpu. Signed-off-by: Claudiu Zissulescu Diff: --- gcc/config.gcc | 44 +++++++++++++++++++++++++++++++++++++++----- gcc/config/arc/arc.h | 4 ++++ 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index 4dc4fe0b65c..1be8d96f5e5 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4260,18 +4260,52 @@ 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 + || grep -q -E "^ARC_CPU[[:blank:]]*\($with_cpu," \ + ${srcdir}/config/arc/arc-cpus.def + 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 + flags_ok="[emhs]+" + ;; + fpuda | fpuda_div | fpuda_fma | fpuda_all) + # OK only em + flags_ok="em" + ;; + fpud | fpud_div | fpud_fma | fpud_all) + # OK only hs + flags_ok="hs" + ;; + *) + echo "Unknown floating point type used in "\ + "--with-fpu=$with_fpu" 1>&2 + exit 1 + ;; + esac + + if [ -n "$flags_ok" ] \ + && ! grep -q -E "^ARC_CPU[[:blank:]]*\($new_cpu,[[:blank:]]*$flags_ok," \ + ${srcdir}/config/arc/arc-cpus.def + then + echo "Unknown floating point type used in "\ + "--with-fpu=$with_fpu for cpu $new_cpu" 1>&2 + exit 1 + fi ;; csky-*-*) diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 0224ae65074..8cd63500044 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