diff options
author | Andrew Pinski <apinski@cavium.com> | 2016-10-31 22:20:52 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2016-10-31 15:20:52 -0700 |
commit | bd5849af5df5ef52037daf2729997dd0a0c688f0 (patch) | |
tree | 644f40cc59bade61bb074a6f49b1b6e8992a9c91 | |
parent | 8628bc67f12fbbe9e5d4072ff3b1e28f57b3ef8e (diff) | |
download | gcc-bd5849af5df5ef52037daf2729997dd0a0c688f0.zip gcc-bd5849af5df5ef52037daf2729997dd0a0c688f0.tar.gz gcc-bd5849af5df5ef52037daf2729997dd0a0c688f0.tar.bz2 |
driver-aarch64.c (host_detect_local_cpu): Rewrite handling of part num to handle the case where multiple implementers...
2016-10-31 Andrew Pinski <apinski@cavium.com>
* config/aarch64/driver-aarch64.c (host_detect_local_cpu):
Rewrite handling of part num to handle the case where
multiple implementers share the same part num.
From-SVN: r241726
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/aarch64/driver-aarch64.c | 44 |
2 files changed, 33 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b862943..d67a20f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-31 Andrew Pinski <apinski@cavium.com> + + * config/aarch64/driver-aarch64.c (host_detect_local_cpu): + Rewrite handling of part num to handle the case where + multiple implementers share the same part num. + 2016-10-31 Jan Kratochvil <jan.kratochvil@redhat.com> Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/config/aarch64/driver-aarch64.c b/gcc/config/aarch64/driver-aarch64.c index 658a4cd..c21942c 100644 --- a/gcc/config/aarch64/driver-aarch64.c +++ b/gcc/config/aarch64/driver-aarch64.c @@ -169,7 +169,6 @@ host_detect_local_cpu (int argc, const char **argv) bool tune = false; bool cpu = false; unsigned int i = 0; - unsigned int core_idx = 0; unsigned char imp = INVALID_IMP; unsigned int cores[2] = { INVALID_CORE, INVALID_CORE }; unsigned int n_cores = 0; @@ -219,18 +218,13 @@ host_detect_local_cpu (int argc, const char **argv) if (strstr (buf, "part") != NULL) { unsigned ccore = parse_field (buf); - for (i = 0; aarch64_cpu_data[i].name != NULL; i++) - if (ccore == aarch64_cpu_data[i].part_no - && !contains_core_p (cores, ccore)) - { - if (n_cores == 2) - goto not_found; - - cores[n_cores++] = ccore; - core_idx = i; - arch_id = aarch64_cpu_data[i].arch; - break; - } + if (!contains_core_p (cores, ccore)) + { + if (n_cores == 2) + goto not_found; + + cores[n_cores++] = ccore; + } continue; } if (!tune && !processed_exts && strstr (buf, "Features") != NULL) @@ -276,11 +270,19 @@ host_detect_local_cpu (int argc, const char **argv) if (n_cores == 0 || n_cores > 2 || imp == INVALID_IMP) goto not_found; - if (arch && !arch_id) - goto not_found; - if (arch) { + /* Search for one of the cores in the list. */ + for (i = 0; aarch64_cpu_data[i].name != NULL; i++) + if (aarch64_cpu_data[i].implementer_id == imp + && contains_core_p (cores, aarch64_cpu_data[i].part_no)) + { + arch_id = aarch64_cpu_data[i].arch; + break; + } + if (!arch_id) + goto not_found; + struct aarch64_arch_driver_info* arch_info = get_arch_from_id (arch_id); /* We got some arch indentifier that's not in aarch64-arches.def? */ @@ -312,7 +314,15 @@ host_detect_local_cpu (int argc, const char **argv) /* The simple, non-big.LITTLE case. */ else { - if (aarch64_cpu_data[core_idx].implementer_id != imp) + int core_idx = -1; + for (i = 0; aarch64_cpu_data[i].name != NULL; i++) + if (cores[0] == aarch64_cpu_data[i].part_no + && aarch64_cpu_data[i].implementer_id == imp) + { + core_idx = i; + break; + } + if (core_idx == -1) goto not_found; res = concat ("-m", cpu ? "cpu" : "tune", "=", |