From patchwork Tue Nov 17 22:10:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 56882 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2206948lbb; Tue, 17 Nov 2015 14:11:21 -0800 (PST) X-Received: by 10.68.174.196 with SMTP id bu4mr66193762pbc.155.1447798281245; Tue, 17 Nov 2015 14:11:21 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id qd4si60042616pac.42.2015.11.17.14.11.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Nov 2015 14:11:21 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-414430-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; spf=pass (google.com: domain of gcc-patches-return-414430-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-414430-patch=linaro.org@gcc.gnu.org; dkim=pass header.i=@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; q=dns; s= default; b=WvcnjBRNrtnp74O1rBvybheSokTKm+78FvCu36+aqxI3Da5VSAqdQ v4+qPHOlJukRIIOBcNKw0LdVZrOMmITw5y9a15n1PcJt/fkn11neGh6RkdpeFhhZ zXct2PR5I69pSMi/6x0M+0HLPK6N1qWdLG5pSugn2BwwCzYFmhI+ig= 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; s= default; bh=7lmqyOJkN1BjAIVvOeEB09Qki8U=; b=k7zihAJ6ULwfX2vrrKgx 0fZH619fKfhps7pwqdsyrF7RnMrZ/9jsqWco8nRed3BGqE08fpb+LRTaSYHHVcNi 9NU2sdXgu0S61bjHMeOIEv/m7rXFTcQcFSWgxOP2qCaLSQnZ/H5QJrMO0Rj6Kv64 XOvcHMLnlLPz+D63Vjibykk= Received: (qmail 73786 invoked by alias); 17 Nov 2015 22:10:45 -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 73706 invoked by uid 89); 17 Nov 2015 22:10:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-io0-f174.google.com Received: from mail-io0-f174.google.com (HELO mail-io0-f174.google.com) (209.85.223.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 17 Nov 2015 22:10:44 +0000 Received: by iofh3 with SMTP id h3so34215854iof.3 for ; Tue, 17 Nov 2015 14:10:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MTo1CKYUct4fCYTV2OvNb06ArDy6U4072jdUP4/65kc=; b=kfDQHoXf+LSOGa2U3u1r05/OQIrlIrSPupBk7Hu2TuqBw9Y+pRuKp/vrB0kymlOFhu 3BhaQrCFLhw4Rd5RSUDmvxXLWh1SCy+z5HrSrf8Z4FCPgP8k3CSynXNok/A6Ut4ZOJog uZssayXhyNzQpeduklAQy3yX/5CfR2xJlxWfAnyFtBw/rld5p+jao4JTw9hB6oP7DSx3 yvWYrICRFTeCEtRRuGb5pX72gppD+TF8M/SYyhqut4tP61K1QMnnXuoR2i900GMJfY5B xKNBu2HGo6ZNpc3RD2Im8qZp/OGO7t7+0Gwj5YAi35n7lzr1e2JuunGoz6VGNCoeEXYv A5hA== X-Gm-Message-State: ALoCoQlEhS8TGr3OV/48BCswApgZkeHwG0YgHlkutE69UXsTOIL2JFKmX4h2+v0gtzO4Uaxjzm5R X-Received: by 10.107.158.10 with SMTP id h10mr41513808ioe.63.1447798242057; Tue, 17 Nov 2015 14:10:42 -0800 (PST) Received: from localhost.localdomain ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id o77sm68097ioe.11.2015.11.17.14.10.40 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Nov 2015 14:10:41 -0800 (PST) Received: from localhost.localdomain (apinskidesktop [127.0.0.1]) by localhost.localdomain (8.14.3/8.14.3/Debian-9.4) with ESMTP id tAHMAdPH029652 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Tue, 17 Nov 2015 14:10:39 -0800 Received: (from apinski@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id tAHMAdBo029651; Tue, 17 Nov 2015 14:10:39 -0800 From: Andrew Pinski To: gcc-patches@gcc.gnu.org Cc: Andrew Pinski Subject: [PATCH 3/5] [AARCH64] Fix part num and implement indendent. Date: Tue, 17 Nov 2015 14:10:36 -0800 Message-Id: <1447798238-29608-4-git-send-email-apinski@cavium.com> In-Reply-To: <1447798238-29608-1-git-send-email-apinski@cavium.com> References: <1447798238-29608-1-git-send-email-apinski@cavium.com> The way the current code was written assumes all cores have an unique part num which is not true. What they have is an unique pair of implementer and part num. This changes the code to look up that pair after the parsing of the two is done. Someone should test this on a big.little target too just to make sure the parsing is done correctly as I don't have access to one off hand. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. Thanks, Andrew Pinski * 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. --- gcc/config/aarch64/driver-aarch64.c | 46 ++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-) -- 1.9.1 diff --git a/gcc/config/aarch64/driver-aarch64.c b/gcc/config/aarch64/driver-aarch64.c index 92388a9..ea1e856 100644 --- a/gcc/config/aarch64/driver-aarch64.c +++ b/gcc/config/aarch64/driver-aarch64.c @@ -158,7 +158,7 @@ host_detect_local_cpu (int argc, const char **argv) bool tune = false; bool cpu = false; unsigned int i = 0; - unsigned int core_idx = 0; + int core_idx = -1; unsigned char imp = INVALID_IMP; unsigned int cores[2] = { INVALID_CORE, INVALID_CORE }; unsigned int n_cores = 0; @@ -206,18 +206,13 @@ host_detect_local_cpu (int argc, const char **argv) if (strstr (buf, "part") != NULL) { unsigned ccore = parse_field (buf); - for (i = 0; cpu_data[i].name != NULL; i++) - if (ccore == 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 = 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) @@ -253,11 +248,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; cpu_data[i].name != NULL; i++) + if (cpu_data[i].implementer_id == imp + && contains_core_p (cores, cpu_data[i].part_no)) + { + arch_id = cpu_data[i].arch; + break; + } + if (!arch_id) + goto not_found; + const char* arch_name = get_arch_name_from_id (arch_id); /* We got some arch indentifier that's not in aarch64-arches.def? */ @@ -284,8 +287,15 @@ host_detect_local_cpu (int argc, const char **argv) /* The simple, non-big.LITTLE case. */ else { - if (cpu_data[core_idx].implementer_id != imp) - goto not_found; + for (i = 0; cpu_data[i].name != NULL; i++) + if (cores[0] == cpu_data[i].part_no + && cpu_data[i].implementer_id == imp) + { + core_idx = i; + break; + } + if (core_idx == -1) + goto not_found; res = concat ("-m", cpu ? "cpu" : "tune", "=", cpu_data[core_idx].name, NULL);