From patchwork Mon Apr 11 09:22:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Greenhalgh X-Patchwork-Id: 65494 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp1355564lbl; Mon, 11 Apr 2016 02:23:13 -0700 (PDT) X-Received: by 10.98.73.88 with SMTP id w85mr31796602pfa.82.1460366593230; Mon, 11 Apr 2016 02:23:13 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id d10si2570392pap.88.2016.04.11.02.23.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Apr 2016 02:23:13 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-424623-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-424623-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-424623-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 :mime-version:content-type; q=dns; s=default; b=N6eI60YV4sZ/Rwpm YL16PGSBEZXgRyjkqi4QU48yk62c3tJdY1qSbEi4X7ggedRQy2iPzZLG6YCFpMJS ZqREC/OZlTTfos7P/FodBnRwTbjYsM7B5GT5CXC7U2iZBKVLbOJfla/lmHpnn8z8 AUhqY+4iCu6E6L0UzurwZRDB8us= 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 :mime-version:content-type; s=default; bh=GMSrKvo0ogGk7pKC/ZqZCq 37gKc=; b=Ljh/G5GMjYR/Mkq+OqCqfdZSweKF1GSYDtcAgc9nbX8zM/oDLku54H DRPB/z9zm9+L+bO2IsAgDoLHV344OaNW1DlZKWtcIZG+CzLlF2vN607524P5gB+G vSWovf13LipTWMm3S1UD2t2y9b3hI+5b9Hd7WSwytcPWxwqSoUTKA= Received: (qmail 29982 invoked by alias); 11 Apr 2016 09:22:59 -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 29905 invoked by uid 89); 11 Apr 2016 09:22:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HAuthentication-Results:gcc.gnu.org, PART, Hx-spam-relays-external:14.3.279.2, H*RU:14.3.279.2 X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com Received: from mail-db5eur01on0067.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (104.47.2.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA256 encrypted) ESMTPS; Mon, 11 Apr 2016 09:22:47 +0000 Received: from DB6PR0701CA0009.eurprd07.prod.outlook.com (10.168.7.147) by HE1PR07MB1690.eurprd07.prod.outlook.com (10.166.124.144) with Microsoft SMTP Server (TLS) id 15.1.466.12; Mon, 11 Apr 2016 09:22:43 +0000 Received: from AM1FFO11FD019.protection.gbl (2a01:111:f400:7e00::158) by DB6PR0701CA0009.outlook.office365.com (2603:10a6:4:3::19) with Microsoft SMTP Server (TLS) id 15.1.466.12 via Frontend Transport; Mon, 11 Apr 2016 09:22:43 +0000 Authentication-Results: spf=pass (sender IP is 217.140.96.140) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=none (message not signed) header.d=none; gcc.gnu.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 217.140.96.140 as permitted sender) receiver=protection.outlook.com; client-ip=217.140.96.140; helo=nebula.arm.com; Received: from nebula.arm.com (217.140.96.140) by AM1FFO11FD019.mail.protection.outlook.com (10.174.64.208) with Microsoft SMTP Server (TLS) id 15.1.453.6 via Frontend Transport; Mon, 11 Apr 2016 09:22:43 +0000 Received: from e107456-lin.cambridge.arm.com (10.1.2.79) by mail.arm.com (10.1.105.66) with Microsoft SMTP Server id 14.3.279.2; Mon, 11 Apr 2016 10:22:41 +0100 From: James Greenhalgh To: CC: , , , Subject: Re: [Patch AArch64 3/3] Fix up for pr70133 Date: Mon, 11 Apr 2016 10:22:28 +0100 Message-ID: <1460366548-25891-1-git-send-email-james.greenhalgh@arm.com> In-Reply-To: <1459937403-22657-4-git-send-email-james.greenhalgh@arm.com> References: <1459937403-22657-4-git-send-email-james.greenhalgh@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131048401633572962; (7f4fb8e1-17aa-4746-8602-08d27e8c8cd0); () X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:NLI; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(377424004)(92566002)(2476003)(450100001)(77096005)(50226001)(87936001)(33646002)(2950100001)(106466001)(86362001)(11100500001)(5890100001)(110136002)(568964002)(76176999)(50986999)(84326002)(189998001)(6806005)(104016004)(36756003)(19580395003)(586003)(1220700001)(1096002)(4326007)(19580405001)(164054004)(4610100001)(512874002)(5008740100001)(5003600100002)(2351001)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR07MB1690; H:nebula.arm.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD019; 1:M/cnFoRlKJzXhaWGNxJPzm1cR5nFLDryz9xpiLDCPAVMNCNq8/vUWjx0X2/4QO7zY42q04H86ZSKiV75sZyy8thybDdihuMp581gT0cAU4FqnuenhAPdLg++BjkYBWXPU6e1dEXfpBPIuoKXh2vBBoCJbngrlW+fRLSOHt0Emp+TzXhHfyIcge2N8/saPw9DzkUWMVKv+C54IuBhqwFCzWJAQswxzWfRnOeTZqEyI3gqgGE9lINrbTwUvP6RKemgwyB/z2Iiwhx71b83in+ChHlBv2bPiXNN01XXNuJfUx5XnCEYn1lZ9a01GnqBtll8xVrTBoImimBwzYvBbIJhVra3eO4j/SfO/g6bHGUkDIU1lZzz/jrbJZ0C7BjNC8uXK5k7q3TDj1jqNr3Ibc8lPs3zXahC2QBZUrDRSJPhoekCG7yq4w+sWg+PULNOjla+P07NjPG56bpWxRfGtR2offrRjCskF/WlaUAw9eWsfm4YsNpWu9I9ngDsSClYqh4HgWhJppi5uRyrZn/2ETsMEzIFkh7pleaQTO3uRDtokvU= X-MS-Office365-Filtering-Correlation-Id: e55eda92-40a0-49de-b5a0-08d361ead632 X-Microsoft-Exchange-Diagnostics: 1; HE1PR07MB1690; 2:/lcDNbD3WEYiO8T+PAfeZIPsQuR+79RId1r5a+O+N14UXce2E57T486eo1Ylphc0kcWOkUQgE/IJgvqjCBJKygt2aa/+gXlRxAdK/0mME/udvohOTbzC0NimHP8iwNFOVeIEYDs6eWumaa+xw++zeO4eNc2vD6uU8DVCfkWliKLribyH1fnJGExFPNqYcAHu; 3:FHbth2GSPsRpWjwe30kerAhud5WdLPz3wwBB9YMTSVNE2Ie4rFwdJEw1RbXfr9Z69uMXw3K2WAhc0V0oLWWHvUfvaPaH27kldZpp0nTgOgf6KWD0ekTPO+dEbJ5LpWzfLJQ6TsoBQY/X29XbNwmUtcIg09R5epQtGf5Fx5pM61pHZlCUNy2li3uvKnWGBCtSfBnUHTDsUI9g/cb3TTD+u5DlOiJ7DeDJcthbFU7VV06PnGoTw44QcsdPkIdKaUqawtKgFFFBIHOJOwf2bIIm/g==; 25:UgWgTA4WQtou/qWf/FfsaJSW8oR5zU/dFl4Ldx4H6VJHZ/PbZjqKa1ShX0yAKsDCD6JB4oAmAJJ/P8ChaFAXPI36D/1ygRpktNj3/rxHcR4uEhz3kFaeQ0I2MzGq2fBeEam9Eej+lWZ3M0QB+7Yz93meJ2LzVL9I0aoNu8RPm4+x0Zz1Nxu+93cam5TUA3nXxj2mMGPRycdDYzbMoUTg13zQ42VyGSACtj24IUPSVWMFiy8R/qDKK+Q4Kbcasafj2EFHk4Zf45mftzeQTa3XHgQq0eeNYfK4pMDueoeSWLO+DLACeuk4+o8UOqnesahDo25oS7pcsa9joOwsCmaDpRtpuIuxYN00CXhuxfRhRaHbsN2Zxgqb6pXvVt7S6VLm X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:HE1PR07MB1690; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415293)(102615271)(601004)(2401047)(5005006)(13018025)(13016025)(13024025)(13023025)(8121501046)(10201501046)(3002001)(6055026); SRVR:HE1PR07MB1690; BCL:0; PCL:0; RULEID:(400006); SRVR:HE1PR07MB1690; X-Microsoft-Exchange-Diagnostics: 1; HE1PR07MB1690; 4:Mg1Uewx4JqtZ0Z4lxuyYTYTcWgKJ4kZjcrDFmYmaVZ6iwHPEOpb5fJGdNXWo15RvqdcQCGp5mPjPcmHY1t+eqY0Jhrom5KGbsre06PRs0X2fWHaRUdKwcThIiDYQwX9/sIDBGdzuvqtvxd2vJ6hElmbwOnmIa2cqSB8IkyhDVGtrtS0gF1uyPdnxuaCzc6ppTApTsG2D0LFY0QB3v+jzjl+btaxRS2kTQROgdwh2JE/7M89RS8Qo7DDeK7fO9HjVbqmcpLaZ2lO1xUcptWktgkf7Wk28ZjbqQ7/Bp7J3crpM4Fgo+tXO2jC4yaImJfPLCr6eXZbKSBHKEDoVqOQSrnR4B0DkKp1CxVP+QRBbem5uAOqqMjHlT6WoFBR15TaWgnEe1Y8I91lnSeBYTCI2jub/u36kZz2UQ40MjtLaM6L3ZPDHqkShbg/W3Qp+QRMUgXchMn14kFqXSfhRWCGysOXBgqA+5JJAAvdkPATUv9YH9tBAtbI08vYpzMJAqXc/ X-Forefront-PRVS: 09090B6B69 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR07MB1690; 23:IKygqKOEukvIgJq8HtOfnxWKCcaUrluzWSKFOaj/O?= =?us-ascii?Q?2rEqdcBWPxM3ZDcT5MscG4y1olTid7ppb1GZKHRZJlc8h8qvBryFMeWqlHPI?= =?us-ascii?Q?yAz765ioyUM995TcsnkfyTzI6Cv16Hv4e7dLzZtnBT321VmEdTeKHM/4+xNF?= =?us-ascii?Q?Ae3micVnkhULdLMdaV03nkbVhPDSeWsALD/bysDsnuBuuBM13gF5j0qsywCK?= =?us-ascii?Q?mAtY7nEIjE7q48NxEW0+UxZpBK1BwIBWWgk3TPdCEBKzVVj0pPD0o7FlJVz/?= =?us-ascii?Q?SufM1f52jjO+JBsaGWG1sZ+qty4RtrKdQ0vugqlFipJwq+RWn3Up8FYqd1ZO?= =?us-ascii?Q?JNV8L1COvUFxPhHOxpwNpzizhj71a8PzitvFGUUyY6EOLEzHnebSuWKF8Icd?= =?us-ascii?Q?gjaTotoVCXxSiZLQ4EFf/VbSpQ4Ukrv1AmzDMjIHrwykN7rv7bpUPLcHBpg9?= =?us-ascii?Q?8HLpS0jvO15fYYvdvkstmewiFX3IOQZIFtw1MycMHSKIdO69PU3dzHlKt2HR?= =?us-ascii?Q?g7gwu+fPM54neqWiZHYcT2gmqQP/qZT4WIvX9lwjrkGkEjzldriGgeG2grjC?= =?us-ascii?Q?+Ckwql1n/mtw9/EKRdVXoZU3gSUr+qunqnnTwPtFGQ72rQfheI7oXBQoicke?= =?us-ascii?Q?RyWwNKqJWkgFS5NJL9Px4UUZ8FutGR+0K29sAQuS7lJslEllb3OCI+bQ6xho?= =?us-ascii?Q?FaPoNz7di6dA4UEgnvox7/eM9c6yjAtP/XEHpyVSOh0bfZxMm0ykWUaamZhs?= =?us-ascii?Q?tqZJw9Dos8RV1eR53k2iX/kdraMOm8XtS/12n/yNqFj52h+rOV3ux4I8/JmZ?= =?us-ascii?Q?4REDR81eUrW9RanQNt0lOkpw0bbTdemKVZR2rnBR43NArOb+g7AtKF5gHWSa?= =?us-ascii?Q?Yyq9y5qeqJkBUAEF6Z9p1kWUT2ynbuzmvRK7m4o8xiZGdjF+GtwKaaXalxtl?= =?us-ascii?Q?syEAsE3fJvyLsJkgqvNnLv47lvpvxOfF2X1XPbUd821QTLGUGZE/RORLhAQS?= =?us-ascii?Q?NthP34wXft6ZsjkW08pXzPgmv64xD/lAGdWnNQ7sjHi03fDKfS+3MUyB7PbS?= =?us-ascii?Q?fdZf5Y=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR07MB1690; 5:FV4v0SUx25ZvMS6LgDmjB2/GvOcrAHu3SJGxjQforEUxz5NjxhyuFyli3pIEqwsh9Six6wceDu4c99+q+lskD/CDWeUX8xElqD1fkzZ9eXA1/hlUJGc8ByzkRQMcTCa8AQ60sWnnbbuOlILMDwyV26UjHhu8st8l4gm/1rvjjvSkkT8ON9R7O6BfwDwQ0tf4m92Ef9864BF1pJK6sAF2ew==; 24:YS1qUWFsbbX+WOYUI8kadR2RMJ3BcUAMjxHppRElyInTP0ji2IFj9Rd4z0xnrrlBwR7VHpy3yCz2DvLTJs/sFjfQ79Anl+Qd6xhbPt3yUiM=; 7:t5no0eTe9yKQEQqobm98cSuDDbPsNKgoARnfWCtEDPBJu6K+XEycoBVi1NyLEq02HqCKMlmFa4b3ibEmjRZLYGcH4D91gitMMx1/hv2EDhrgeR+JT1rYkBeQ7mB9G2+E9ueSa0liv9sbhqvrmOKTdK4N4SnDU++Rwb9mvpvnYCV98ctf/EdjUIozcb97A5aCLD9/mkZZM5fORiIrLHFE/eBSiSfMz8fCeFLa4C5G0KU= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2016 09:22:43.0764 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB1690 X-IsSubscribed: yes > Hi, > > Having updated the way we parse and output extension strings, now we just > need to wire up the native detection to use these new features. > > In doing some cleanup and rename I ended up fixing 8-spaces to tabs in > about half the file. I've done the rest while I'm here to save us from > some a mixed-style file. Richard Earnshaw pointed out off-list that it was perhaps a little anti-social to ask a reviewer to wade through all the tabs-to-spaces changes to find the real content of this patch. I can't disagree with that. Here's the diff regenerated with '-w' to skip the whitespace changes. OK? Thanks, James > --- > 2016-04-06 James Greenhalgh > > PR target/70133 > > * config/aarch64/driver-aarch64.c > (aarch64_get_extension_string_for_isa_flags): New. > (arch_extension): Rename to... > (aarch64_arch_extension): ...This. > (ext_to_feat_string): Rename to... > (aarch64_extensions): ...This. > (aarch64_core_data): Keep track of architecture extension flags. > (cpu_data): Rename to... > (aarch64_cpu_data): ...This. > (aarch64_arch_driver_info): Keep track of architecture extension > flags. > (get_arch_name_from_id): Rename to... > (get_arch_from_id): ...This, change return type. > (host_detect_local_cpu): Update and reformat for renames, handle > extensions through common infrastructure. > diff --git a/gcc/config/aarch64/driver-aarch64.c b/gcc/config/aarch64/driver-aarch64.c index 8925ec1..ce771ec 100644 --- a/gcc/config/aarch64/driver-aarch64.c +++ b/gcc/config/aarch64/driver-aarch64.c @@ -18,9 +18,16 @@ . */ #include "config.h" +#define INCLUDE_STRING #include "system.h" +#include "coretypes.h" +#include "tm.h" -struct arch_extension +/* Defined in common/config/aarch64/aarch64-common.c. */ +std::string aarch64_get_extension_string_for_isa_flags (unsigned long, + unsigned long); + +struct aarch64_arch_extension { const char *ext; unsigned int flag; @@ -29,7 +36,7 @@ struct arch_extension #define AARCH64_OPT_EXTENSION(EXT_NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF, FEATURE_STRING) \ { EXT_NAME, FLAG_CANONICAL, FEATURE_STRING }, -static struct arch_extension ext_to_feat_string[] = +static struct aarch64_arch_extension aarch64_extensions[] = { #include "aarch64-option-extensions.def" }; @@ -42,15 +49,16 @@ struct aarch64_core_data const char* arch; const char* implementer_id; const char* part_no; + const unsigned long flags; }; #define AARCH64_CORE(CORE_NAME, CORE_IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART) \ - { CORE_NAME, #ARCH, IMP, PART }, + { CORE_NAME, #ARCH, IMP, PART, FLAGS }, -static struct aarch64_core_data cpu_data [] = +static struct aarch64_core_data aarch64_cpu_data[] = { #include "aarch64-cores.def" - { NULL, NULL, NULL, NULL } + { NULL, NULL, NULL, NULL, 0 } }; #undef AARCH64_CORE @@ -59,37 +67,37 @@ struct aarch64_arch_driver_info { const char* id; const char* name; + const unsigned long flags; }; #define AARCH64_ARCH(NAME, CORE, ARCH_IDENT, ARCH_REV, FLAGS) \ - { #ARCH_IDENT, NAME }, + { #ARCH_IDENT, NAME, FLAGS }, static struct aarch64_arch_driver_info aarch64_arches[] = { #include "aarch64-arches.def" - {NULL, NULL} + {NULL, NULL, 0} }; #undef AARCH64_ARCH -/* Return the full architecture name string corresponding to the - identifier ID. */ +/* Return an aarch64_arch_driver_info for the architecture described + by ID, or NULL if ID describes something we don't know about. */ -static const char* -get_arch_name_from_id (const char* id) +static struct aarch64_arch_driver_info* +get_arch_from_id (const char* id) { unsigned int i = 0; for (i = 0; aarch64_arches[i].id != NULL; i++) { if (strcmp (id, aarch64_arches[i].id) == 0) - return aarch64_arches[i].name; + return &aarch64_arches[i]; } return NULL; } - /* Check wether the string CORE contains the same CPU part numbers as BL_STRING. For example CORE="{0xd03, 0xd07}" and BL_STRING="0xd07.0xd03" should return true. */ @@ -142,7 +150,7 @@ host_detect_local_cpu (int argc, const char **argv) { const char *arch_id = NULL; const char *res = NULL; - static const int num_exts = ARRAY_SIZE (ext_to_feat_string); + static const int num_exts = ARRAY_SIZE (aarch64_extensions); char buf[128]; FILE *f = NULL; bool arch = false; @@ -156,6 +164,8 @@ host_detect_local_cpu (int argc, const char **argv) unsigned int n_imps = 0; bool processed_exts = false; const char *ext_string = ""; + unsigned long extension_flags = 0; + unsigned long default_flags = 0; gcc_assert (argc); @@ -184,14 +194,15 @@ host_detect_local_cpu (int argc, const char **argv) { if (strstr (buf, "implementer") != NULL) { - for (i = 0; cpu_data[i].name != NULL; i++) - if (strstr (buf, cpu_data[i].implementer_id) != NULL - && !contains_string_p (imps, cpu_data[i].implementer_id)) + for (i = 0; aarch64_cpu_data[i].name != NULL; i++) + if (strstr (buf, aarch64_cpu_data[i].implementer_id) != NULL + && !contains_string_p (imps, + aarch64_cpu_data[i].implementer_id)) { if (n_imps == 2) goto not_found; - imps[n_imps++] = cpu_data[i].implementer_id; + imps[n_imps++] = aarch64_cpu_data[i].implementer_id; break; } @@ -200,16 +211,16 @@ host_detect_local_cpu (int argc, const char **argv) if (strstr (buf, "part") != NULL) { - for (i = 0; cpu_data[i].name != NULL; i++) - if (strstr (buf, cpu_data[i].part_no) != NULL - && !contains_string_p (cores, cpu_data[i].part_no)) + for (i = 0; aarch64_cpu_data[i].name != NULL; i++) + if (strstr (buf, aarch64_cpu_data[i].part_no) != NULL + && !contains_string_p (cores, aarch64_cpu_data[i].part_no)) { if (n_cores == 2) goto not_found; - cores[n_cores++] = cpu_data[i].part_no; + cores[n_cores++] = aarch64_cpu_data[i].part_no; core_idx = i; - arch_id = cpu_data[i].arch; + arch_id = aarch64_cpu_data[i].arch; break; } continue; @@ -218,24 +229,34 @@ host_detect_local_cpu (int argc, const char **argv) { for (i = 0; i < num_exts; i++) { - bool enabled = true; char *p = NULL; - char *feat_string = concat (ext_to_feat_string[i].feat_string, NULL); + char *feat_string + = concat (aarch64_extensions[i].feat_string, NULL); + bool enabled = true; + /* This may be a multi-token feature string. We need + to match all parts, which could be in any order. + If this isn't a multi-token feature string, strtok is + just going to return a pointer to feat_string. */ p = strtok (feat_string, " "); - while (p != NULL) { if (strstr (buf, p) == NULL) { + /* Failed to match this token. Turn off the + features we'd otherwise enable. */ enabled = false; break; } p = strtok (NULL, " "); } - ext_string = concat (ext_string, "+", enabled ? "" : "no", - ext_to_feat_string[i].ext, NULL); + + if (enabled) + extension_flags |= aarch64_extensions[i].flag; + else + extension_flags &= ~(aarch64_extensions[i].flag); } + processed_exts = true; } } @@ -252,24 +273,31 @@ host_detect_local_cpu (int argc, const char **argv) if (arch) { - const char* arch_name = get_arch_name_from_id (arch_id); + 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? */ - if (!arch_name) + if (!arch_info) goto not_found; - res = concat ("-march=", arch_name, NULL); + res = concat ("-march=", arch_info->name, NULL); + default_flags = arch_info->flags; } /* We have big.LITTLE. */ else if (n_cores == 2) { - for (i = 0; cpu_data[i].name != NULL; i++) + for (i = 0; aarch64_cpu_data[i].name != NULL; i++) { - if (strchr (cpu_data[i].part_no, '.') != NULL - && strncmp (cpu_data[i].implementer_id, imps[0], strlen (imps[0]) - 1) == 0 - && valid_bL_string_p (cores, cpu_data[i].part_no)) + if (strchr (aarch64_cpu_data[i].part_no, '.') != NULL + && strncmp (aarch64_cpu_data[i].implementer_id, + imps[0], + strlen (imps[0]) - 1) == 0 + && valid_bL_string_p (cores, aarch64_cpu_data[i].part_no)) { - res = concat ("-m", cpu ? "cpu" : "tune", "=", cpu_data[i].name, NULL); + res = concat ("-m", + cpu ? "cpu" : "tune", "=", + aarch64_cpu_data[i].name, + NULL); + default_flags = aarch64_cpu_data[i].flags; break; } } @@ -279,17 +307,22 @@ host_detect_local_cpu (int argc, const char **argv) /* The simple, non-big.LITTLE case. */ else { - if (strncmp (cpu_data[core_idx].implementer_id, imps[0], + if (strncmp (aarch64_cpu_data[core_idx].implementer_id, imps[0], strlen (imps[0]) - 1) != 0) goto not_found; res = concat ("-m", cpu ? "cpu" : "tune", "=", - cpu_data[core_idx].name, NULL); + aarch64_cpu_data[core_idx].name, NULL); + default_flags = aarch64_cpu_data[core_idx].flags; } if (tune) return res; + ext_string + = aarch64_get_extension_string_for_isa_flags (extension_flags, + default_flags).c_str (); + res = concat (res, ext_string, NULL); return res;