public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Earnshaw <Richard.Earnshaw@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>
Subject: [PATCH 12/30] [arm] Allow new extended syntax CPU and architecture names during configure
Date: Fri, 09 Jun 2017 12:54:00 -0000	[thread overview]
Message-ID: <3868848ea778bb498c716d5d8bad2c5b4c1cc2e4.1497004220.git.Richard.Earnshaw@arm.com> (raw)
In-Reply-To: <cover.1497004220.git.Richard.Earnshaw@arm.com>
In-Reply-To: <cover.1497004220.git.Richard.Earnshaw@arm.com>

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]


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(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0012-arm-Allow-new-extended-syntax-CPU-and-architecture-n.patch --]
[-- Type: text/x-patch; name="0012-arm-Allow-new-extended-syntax-CPU-and-architecture-n.patch", Size: 3948 bytes --]

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])

  parent reply	other threads:[~2017-06-09 12:54 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 12:54 [PATCH 00/30] [ARM] Reworking the -mcpu, -march and -mfpu options Richard Earnshaw
2017-06-09 12:54 ` [PATCH 05/30] [arm] Add architectural options Richard Earnshaw
2017-06-09 12:54 ` [PATCH 10/30] [arm] Use standard option parsing code for detecting thumb-only targets Richard Earnshaw
2017-06-09 12:54 ` [PATCH 06/30] [arm] Add default FPUs for CPUs Richard Earnshaw
2017-06-09 12:54 ` [PATCH 17/30] [arm] Make 'auto' the default FPU selection option Richard Earnshaw
2017-06-09 12:54 ` [PATCH 04/30] [arm] Allow +opt on arbitrary cpu and architecture specifications Richard Earnshaw
2017-06-13 17:14   ` Richard Earnshaw (lists)
2017-06-09 12:54 ` [PATCH 23/30] [arm][rtems] Update t-rtems for new option framework Richard Earnshaw
2017-06-09 13:03   ` Sebastian Huber
2017-06-09 12:54 ` [PATCH 28/30] [arm] Add a few missing architecture extension options Richard Earnshaw
2017-06-09 12:54 ` [PATCH 18/30] [arm] Rewrite t-aprofile using new selector methodology Richard Earnshaw
2017-06-09 12:54 ` [PATCH 25/30] [arm][phoenix] reset all multilib variables Richard Earnshaw
2017-06-09 12:54 ` [PATCH 24/30] [arm][linux-eabi] Ensure all multilib variables are reset Richard Earnshaw
2017-06-09 12:54 ` [PATCH 29/30] [arm][doc] Document new -march= syntax Richard Earnshaw
2017-06-09 12:54 ` Richard Earnshaw [this message]
2017-06-09 12:54 ` [PATCH 02/30] [arm] Rewrite -march and -mcpu options for passing to the assembler Richard Earnshaw
2017-06-09 12:55 ` [PATCH 16/30] [arm] Update basic multilib configuration Richard Earnshaw
2017-06-09 12:55 ` [PATCH 09/30] [ARM] Move cpu and architecture option name parsing code to arm-common.c Richard Earnshaw
2017-06-13 17:19   ` Richard Earnshaw (lists)
2017-06-09 12:55 ` [PATCH 07/30] [build] Make sbitmap code available to the driver programs Richard Earnshaw
2017-06-14 14:35   ` Richard Earnshaw (lists)
2017-06-16  8:03     ` Richard Biener
2017-06-09 12:55 ` [PATCH 22/30] [arm] Rewrite t-rmprofile multilib specification Richard Earnshaw
2017-06-09 12:55 ` [PATCH 11/30] [arm] Allow CPU and architecture extensions to be defined as aliases Richard Earnshaw
2017-06-09 12:55 ` [PATCH 01/30] [arm] Use strings for -march, -mcpu and -mtune options Richard Earnshaw
2017-06-13 13:23   ` Christophe Lyon
2017-06-13 15:33     ` Richard Earnshaw (lists)
2017-06-13 17:11   ` Richard Earnshaw (lists)
2017-06-09 12:55 ` [PATCH 08/30] [arm] Split CPU, architecture and tuning data tables Richard Earnshaw
2017-06-13 17:17   ` Richard Earnshaw (lists)
2017-06-09 12:55 ` [PATCH 13/30] [arm] Force a CPU default in the config args defaults list Richard Earnshaw
2017-06-09 12:55 ` [PATCH 27/30] [arm][fuchsia] Rework multilib support Richard Earnshaw
2017-06-09 12:55 ` [PATCH 03/30] [arm] Don't pass -mfpu=auto through to the assembler Richard Earnshaw
2017-06-09 12:55 ` [PATCH 19/30] [arm] Explicitly set .fpu in cmse_nonsecure_call.S Richard Earnshaw
2017-06-09 12:55 ` [PATCH 20/30] [genmultilib] Allow explicit periods to be escaped in MULTILIB_REUSE Richard Earnshaw
2017-06-09 12:55 ` [PATCH 30/30] [arm][doc] Document changes to -mcpu, -mtune and -mfpu Richard Earnshaw
2017-06-09 22:19   ` Gerald Pfeifer
2017-06-09 12:55 ` [PATCH 21/30] [arm][testsuite] Use -march=armv7-a+fp when testing hard-float ABI Richard Earnshaw
2017-06-09 12:55 ` [PATCH 14/30] [arm] Generate a canonical form for -march Richard Earnshaw
2017-06-13 17:25   ` Richard Earnshaw (lists)
2017-06-09 12:55 ` [PATCH 15/30] [arm] Make -mfloat-abi=softfp work when there are no FPU instructions Richard Earnshaw
2017-06-09 12:55 ` [PATCH 26/30] [arm] Rework multlib builds for symbianelf Richard Earnshaw
2017-06-09 22:45 ` [PATCH 00/30] [ARM] Reworking the -mcpu, -march and -mfpu options Christophe Lyon
2017-06-09 23:27   ` Richard Earnshaw (lists)
2017-06-12 11:49     ` Christophe Lyon
2017-06-12 14:34       ` Richard Earnshaw (lists)
2017-06-12 17:11         ` Joseph Myers
2017-06-12 21:27           ` Richard Earnshaw (lists)
2017-06-13  9:40             ` Richard Earnshaw (lists)
2017-06-13 10:29               ` Joseph Myers
2017-06-13 15:26         ` Richard Earnshaw (lists)
2017-06-13 16:08           ` Christophe Lyon
2017-06-12 11:48 ` Nathan Sidwell
2017-06-13 17:27 ` [PATCH 31/30] [arm] Mark -marm and -mthumb as being inverse options Richard Earnshaw (lists)
2017-06-13 17:29 ` [PATCH 32/30][arm][testsuite] Fix neon-thumb2-move.c test Richard Earnshaw (lists)
2017-06-14 14:27   ` [PATCH 32/30][arm][testsuite] Fix various tests Richard Earnshaw (lists)
2017-06-14 19:26     ` Christophe Lyon
2017-06-13 17:36 ` [PATCH 00/30] [ARM] Reworking the -mcpu, -march and -mfpu options Richard Earnshaw (lists)
2017-06-14  9:08   ` Christophe Lyon
2017-06-14 10:21     ` Richard Earnshaw (lists)
2017-06-16 21:11   ` Richard Earnshaw
2017-06-16 21:16     ` Ramana Radhakrishnan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3868848ea778bb498c716d5d8bad2c5b4c1cc2e4.1497004220.git.Richard.Earnshaw@arm.com \
    --to=richard.earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).