From patchwork Fri Jun 9 12:53:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard Earnshaw \(lists\)" X-Patchwork-Id: 103482 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp194271qgd; Fri, 9 Jun 2017 05:56:46 -0700 (PDT) X-Received: by 10.99.184.25 with SMTP id p25mr39466168pge.22.1497013006134; Fri, 09 Jun 2017 05:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497013006; cv=none; d=google.com; s=arc-20160816; b=ex19xNRg1bS/QIoknGNNA0GcVIySkt78EAKsT+ohw8Ce0f6GXwxFve6znMrrN0IcP2 1tHddeQ3YvHlvgWO/DkAMI6Mhxh9LnRtThdyUCRKfNMb16rIF7UE4zcT/OH0izmK5ADr 9BETA7H9CuoWTON1TvQaS4e8Ezr88EYjJJIKuH1Lq3+65lNP1ILwmTEwLFMMYiXeU7Vs WWw/yr0ZoppYIzbXj/wIJ6ubNNnX75t9MGccxy7OmMsnMjVN9OZNC5SxvjNwLdK5/Zig nR4SsBU/1WWnWmvHg30DE40/77lQgnHJRd7GfVQtTuJVlXKLS5tACpkSDCjVrScZ3C9K D2eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=UKKEoSkf34/Tfjb/5fJml/LSGHw9G73Ix4Cp4W6Xd5A=; b=TKqdQpqbw0ugnE/HfhdDdzxv/TAw4v9oqgLxTsNnt3OvJL2OdpDW2nbVZI+QAsYRK8 X6U1Y9RZPJxlPD63JAQUSTv27nFIUG1Qt91S1EYNsgMB//UJBqIlZ/rC0DvIVjDT4eFI X6FxEtcSc/1j2AfuBpgwju/qqHDg62hMsex64SpgvctvbbGqnTRDvmcE2KfHIwszgv9Q zCM0VUQS5pVI8XGyQe3gTbDw+IQDo4zwIZfvkOPA4ohSXfbEBUYGVMjcScz37qtwk/Il AYpnqvsMYWMrEcBforY0elB37v5+HTKzY5Q53qNcpprDOe0AQagvH6+zfmUglsmWgNly 7kqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-455526-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-455526-patch=linaro.org@gcc.gnu.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 20si922873pft.334.2017.06.09.05.56.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2017 05:56:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-455526-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-455526-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-455526-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references:mime-version:content-type; q=dns; s= default; b=WbBadYg/PJxUTV7V+TqIJNqptaJ/8hnUK84l8MquWtdrWJxvNYTsB dhqr/82EIqradPeVIxMirmgMMzSRFcYUCjKCcLCC4jhP5gN0eyaZTUgALw9df4x4 C/F6SVSshk7iI6JC/dHdY34lg4iolnhOJ7ZKTFHcsx5r4ubjxMspNQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references:mime-version:content-type; s=default; bh=dxT7MJ9Kn3mMvt/1hX7EiH0hxqI=; b=Z/lR3+s1CompYjVk+zq7DaTU/LyX H6O0CYCuO6ZtUDxWTseqrZ9gDM5cVvJK6UN8laTPCozcYPc1kF/ijeZ0dYtYMLki 2inTWWYixydyLjQfAgDs+UNUwT3Yr4Xak63NJqDmAPw2HuRLVPb+x3PFcA6EdxXz zJ2lb6MTHUMt2Fs= Received: (qmail 81418 invoked by alias); 9 Jun 2017 12:54:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 80953 invoked by uid 89); 9 Jun 2017 12:54:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=abilities, era, Hx-languages-length:4434, chk X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Jun 2017 12:54:17 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJJQg-0007YH-AH for gcc-patches@gcc.gnu.org; Fri, 09 Jun 2017 08:54:20 -0400 Received: from foss.arm.com ([217.140.101.70]:47128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJJQf-0007Te-W3 for gcc-patches@gcc.gnu.org; Fri, 09 Jun 2017 08:54:18 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC1932B; Fri, 9 Jun 2017 05:54:17 -0700 (PDT) Received: from e105689-lin.cambridge.arm.com (e105689-lin.cambridge.arm.com [10.2.207.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 36D893F3E1; Fri, 9 Jun 2017 05:54:17 -0700 (PDT) From: Richard Earnshaw To: gcc-patches@gcc.gnu.org Cc: Richard Earnshaw Subject: [PATCH 12/30] [arm] Allow new extended syntax CPU and architecture names during configure Date: Fri, 9 Jun 2017 13:53:41 +0100 Message-Id: <3868848ea778bb498c716d5d8bad2c5b4c1cc2e4.1497004220.git.Richard.Earnshaw@arm.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.140.101.70 This patch extends support for the new extended-style architecture strings to configure and the target default options. We validate any options passed by the user to configure against the permitted extensions for that CPU or architecture. * config.gcc (arm*-*-fucshia*): Set target_cpu_cname to the real cpu name. (arm*-*-*): Set target_cpu_default2 to a quoted string. * config/arm/parsecpu.awk (check_cpu): Validate any extension options. (check_arch): Likewise. * config/arm/arm.c (arm_configure_build_target): Handle TARGET_CPU_DEFAULT being a string constant. Scan any feature options in the default. --- gcc/config.gcc | 6 +++--- gcc/config/arm/arm.c | 8 +++++++- gcc/config/arm/parsecpu.awk | 36 ++++++++++++++++++++++++++++-------- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index f55dcaa..4d0f7ec 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1159,7 +1159,7 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia*) arm*-*-fuchsia*) tm_file="${tm_file} fuchsia.h arm/fuchsia-elf.h glibc-stdint.h" tmake_file="${tmake_file} arm/t-bpabi" - target_cpu_cname="genericv7a" + target_cpu_cname="generic-armv7-a" ;; arm*-*-rtems*) tm_file="${tm_file} rtems.h arm/rtems.h newlib-stdint.h" @@ -4494,9 +4494,9 @@ case ${target} in arm*-*-*) if test x$target_cpu_cname = x then - target_cpu_default2=TARGET_CPU_arm6 + target_cpu_default2="\\\"arm6\\\"" else - target_cpu_default2=TARGET_CPU_$target_cpu_cname + target_cpu_default2="\\\"$target_cpu_cname\\\"" fi ;; diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 73b1369..7296ad3 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -3161,7 +3161,9 @@ arm_configure_build_target (struct arm_build_target *target, bitmap_clear (sought_isa); auto_sbitmap default_isa (isa_num_bits); - arm_selected_cpu = &all_cores[TARGET_CPU_DEFAULT]; + arm_selected_cpu = arm_parse_cpu_option_name (all_cores, "default CPU", + TARGET_CPU_DEFAULT); + cpu_opts = strchr (TARGET_CPU_DEFAULT, '+'); gcc_assert (arm_selected_cpu->common.name); /* RWE: All of the selection logic below (to the end of this @@ -3172,6 +3174,8 @@ arm_configure_build_target (struct arm_build_target *target, support for the pre-thumb era cores is removed. */ sel = arm_selected_cpu; arm_initialize_isa (default_isa, sel->common.isa_bits); + arm_parse_option_features (default_isa, &arm_selected_cpu->common, + cpu_opts); /* Now check to see if the user has specified any command line switches that require certain abilities from the cpu. */ @@ -3259,6 +3263,8 @@ arm_configure_build_target (struct arm_build_target *target, structure. */ target->core_name = arm_selected_cpu->common.name; arm_initialize_isa (target->isa, arm_selected_cpu->common.isa_bits); + arm_parse_option_features (target->isa, &arm_selected_cpu->common, + cpu_opts); arm_selected_arch = all_architectures + arm_selected_cpu->arch; } diff --git a/gcc/config/arm/parsecpu.awk b/gcc/config/arm/parsecpu.awk index 61e8bc2..b6e5093 100644 --- a/gcc/config/arm/parsecpu.awk +++ b/gcc/config/arm/parsecpu.awk @@ -393,9 +393,19 @@ function gen_opt () { } function check_cpu (name) { - if (name in cpu_cnames) { - print cpu_cnames[name] - } else print "error" + exts = split (name, extensions, "+") + + if (! extensions[1] in cpu_cnames) { + return "error" + } + + for (n = 2; n <= exts; n++) { + if (!((extensions[1], extensions[n]) in cpu_opt_remove) \ + && !((extensions[1], extensions[n]) in cpu_optaliases)) { + return "error" + } + } + return name } function check_fpu (name) { @@ -405,9 +415,19 @@ function check_fpu (name) { } function check_arch (name) { - if (name in arch_isa) { - print name - } else print "error" + exts = split (name, extensions, "+") + + if (! extensions[1] in arch_isa) { + return "error" + } + + for (n = 2; n <= exts; n++) { + if (!((extensions[1], extensions[n]) in arch_opt_remove) \ + && !((extensions[1], extensions[n]) in arch_optaliases)) { + return "error" + } + } + return name } BEGIN { @@ -614,10 +634,10 @@ END { gen_opt() } else if (cmd ~ /^chk(cpu|tune) /) { split (cmd, target) - check_cpu(target[2]) + print check_cpu(target[2]) } else if (cmd ~ /^chkarch /) { split (cmd, target) - check_arch(target[2]) + print check_arch(target[2]) } else if (cmd ~ /^chkfpu /) { split (cmd, target) check_fpu(target[2])