From patchwork Fri Jun 4 07:29:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu Ianculescu X-Patchwork-Id: 1487644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=veOV1x+q; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FxDyz3yVVz9sRf for ; Fri, 4 Jun 2021 17:33:47 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 86DD53848414 for ; Fri, 4 Jun 2021 07:33:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86DD53848414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1622792024; bh=u87SKgrycwhIteqNda8Xg3aiPeOQ1Z790Zh31cqWgI8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=veOV1x+qY8ssonKXeXPGeZrEsG5ZWBuPWqbZy0m5HY6QRqvHAAFXqhdlkhvkDnYDB FLRiRBCgK0MeqVDc5FMI1yQz2Y+TYmh0Qw4AACznl+Q0btTFZsYHbEAsFodf6Ecq/z QbfiwCXYl2h4r3IAaKuw/vfUnRctxD3jFK9MAVIg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 99F213890425 for ; Fri, 4 Jun 2021 07:29:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 99F213890425 Received: by mail-ej1-x635.google.com with SMTP id l1so13014802ejb.6 for ; Fri, 04 Jun 2021 00:29:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=u87SKgrycwhIteqNda8Xg3aiPeOQ1Z790Zh31cqWgI8=; b=d7bYtevWqB5u1NMKuuGkBXxXDx4eonjcPrv5dcUxycwqYCWUpBwD758Hm2r2i1dB8L NEaHlTc0PutRBdVZjvWxG3n5QJP7GXMhU871On8xOqqIKw1QMQOOZzDbPIIKuPgSrIyY GpIpiaeBsj8VwVQZed1e0R3Ev0CpGXyGdJVowdKP7RhJWewEnj/WLA2i0aeytHP2AZq0 7bHMk2t/1LnRzTNmb1IfURmjlmMiqlf7Z0PXlk/gZiDPB/zhP/9S+7Ic39otwnq+vg5K dE404sL6YnQo9yN/BghI6ps4QPGNXHhYMTNL28yeaEn36dcyY35JqLACwzMFJneIeu6W mMnA== X-Gm-Message-State: AOAM5330hm2o9h+ciVdz5GaaGlJViRWAHHzDi9pne+GQ2R04Oub3MRlU jU3Zso+CCMULTRSqebkagiCUXjx8uzRvdc0P X-Google-Smtp-Source: ABdhPJzC322pdZHdYPUPZZiOhrZVVAyEo35/RbjQpEJ+qyjsa8nTqJm4GXJM19EoLARm+/RNvsmUSw== X-Received: by 2002:a17:906:e01:: with SMTP id l1mr2993973eji.280.1622791755317; Fri, 04 Jun 2021 00:29:15 -0700 (PDT) Received: from localhost.localdomain ([86.105.9.116]) by smtp.gmail.com with ESMTPSA id n26sm2429558ejc.27.2021.06.04.00.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 00:29:15 -0700 (PDT) X-Google-Original-From: Claudiu Zissulescu To: gcc-patches@gcc.gnu.org Subject: [PATCH] arc: Add --with-fpu support for ARCv2 cpus Date: Fri, 4 Jun 2021 10:29:09 +0300 Message-Id: <20210604072909.575524-1-claziss@synopsys.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Claudiu Zissulescu via Gcc-patches From: Claudiu Zissulescu Ianculescu Reply-To: Claudiu Zissulescu Cc: fbedard@synopsys.com, law@redhat.com Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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 * config.gcc (arc): Add support for with_cpu option. * config/arc/arc.h (OPTION_DEFAULT_SPECS): Add fpu. Signed-off-by: Claudiu Zissulescu --- 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