From patchwork Wed Dec 6 12:44:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Carlotti X-Patchwork-Id: 174562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4077123vqy; Wed, 6 Dec 2023 04:45:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtLA9Kv+fsflg82yU9QaF8smCGktdq1wK0Ix2wL7zcBcBy387eGEu3YA/EDYUpVk86Ukom X-Received: by 2002:a05:620a:2b9b:b0:77e:fba3:a79e with SMTP id dz27-20020a05620a2b9b00b0077efba3a79emr802675qkb.124.1701866711141; Wed, 06 Dec 2023 04:45:11 -0800 (PST) ARC-Seal: i=4; a=rsa-sha256; t=1701866711; cv=pass; d=google.com; s=arc-20160816; b=miQ8Qd8aFEYI0N2aTYf64Saf0hfIZ+5uw96kWx24fcia4B96wgWHKmaEp7fUf4DApP LluHj9s8yhuN/3wpZtvry9y+AX5jDCU1uQfInIptKgsydc1dY7IA//bXnaNbUv/5hWvM w4ajQGRyc44/o+tTxVrTOxoOqJbszBHp2UqINzeNTXtVPhDeNTgYrPqOo8kVZ1BMNays 4J8e9ysAix4CULAb1OH3Wsg9irJ5rSQxqn019KHhNNuQ0eafXaA9V2E79H3q/bv5bmYc NN1iz4+BlhdewwNC1GDCR6oSaheDQcTMVdBZSflcd+sZIQ4nS9FLTUpzwoWVMIbLn7ml gN4A== ARC-Message-Signature: i=4; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:original-authentication-results :nodisclaimer:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date :authentication-results-original:dkim-signature:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=iDRExrwg/O1oUsa8Eq5Xg1M6afVp5FkdPU/BZIJHvoM=; fh=C4nEn4uRKApr1WsFtLyJD8L5BeRuRc+JFyqoopFjd9M=; b=hKzLjSAZy677KLnFMF9tdxgomSOe1s7TXfP3Ee7cnxcfc+Vqi8KVqHWczG9Li5IVPB Dh/7Uxe+6n6rA+xpOhgON6/pSdtsIB0koJrIq6SKIuf+z2Di18Eox0efAPc+XpnlbPxE 0g02t4EYgY3JhrCr/zIG1x1shEA6I0bXONOTdF44y7KMYhRFu6rR3fjW/375KG1FN0O1 R38Tg++3qpsC+YI1APOHOy0k9g73kgFg7p8rE2IZYWTMHW1XlEXGdYQKzK5j4s9V0RPZ nlCNMqgQjXZPmxdmHhSEFKe16ELAqLCwtasqQygrK9Anx3FnKXUiKk/JRbv1wsm6VDG3 UR9Q== ARC-Authentication-Results: i=4; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=zSiUuXHT; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=zSiUuXHT; arc=pass (i=3); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id a40-20020a05620a43a800b0077d59d88b35si14067739qkp.666.2023.12.06.04.45.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 04:45:11 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=zSiUuXHT; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=zSiUuXHT; arc=pass (i=3); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DC5243858423 for ; Wed, 6 Dec 2023 12:45:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2041.outbound.protection.outlook.com [40.107.22.41]) by sourceware.org (Postfix) with ESMTPS id 62F52385840B for ; Wed, 6 Dec 2023 12:44:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 62F52385840B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 62F52385840B Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.22.41 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1701866686; cv=pass; b=mtOMkq+EKjcPRK+r27oEvoVyDNFpydNO3I9ha9tNPQtLV1wm4HMDKxtIO+X1UnJNWVAtDYFDKcmWKYWXCqohn29iCQXbvAJXFpY3d8Cs6B2zA5anPSxjP+HfqLjiN2r5ct42eaV3ntUgPykSpR6kfUznCpR43hY8T0elyf1F+L4= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1701866686; c=relaxed/simple; bh=dQlvnArCTucnw82CW88pXL8pRRBYldLtAvtFR9GugXQ=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=xfLpCEDooJLvab5PMtJGvDa1EcK0ghDuExBkZVC5AJpOe0gc5JhTK2oRUPRw7Biids4JpRVkws/p3WsKG0DZhpv5ytmtJ/k+zK5DYrlN/OlRebvsPWm2fukggNfjgAE0hA/lD6HVrvWZjvjKVh0V62kgcIb8Yj09xm61vePKDMQ= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Aszk1+ngO1lEPoU7rV0ZKij9JHDmNl16mD0hhXSNSJZkPapZnM8Bd/NgdM46fK7D/mChAnksjL9Zv7TH9024EUibBSCSxLkjVFLLUs12VBiqeSdJAx+LPf8k0zc8zhq1VYm2d4gOfAfe/cvbiOHGtKuVEmKud5sjCpJ1uTbVU8ZomkNr1yxn1LPSgJieYoYGBP/IcfuhCUBDszgsPBPj92Yiqqn1JinltxoBeP0xkMkirP4AR9nJZIKdtZrlUUXJadkDsebF0Vv/r39UEByNgjxgqiGnrCdSliIolbsyDJchZ9AGokcqcuA48Qb7d6w68/GhsvBjXzl1ozFU8t6Btg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iDRExrwg/O1oUsa8Eq5Xg1M6afVp5FkdPU/BZIJHvoM=; b=gjZhKLFn4t8x1rn5KY4LNGkY94p/VxNtMuVQpFgBpt+zbiT28kdIH5JFIlLQ99kFutfamCHsQNi1BynLS+xilvV5ty93XzypCpmVIRlCxltjD1a2BN1xe8fgKTJle5QYJ7siVHpMDygf1hYGOIfRIp9IlEt8n3TN/ApH7zwP9f/dL0pJSUBOrNLEzbXU6KyN5hzjyQ916IjAqmpxSk0oJwzpGL2FZecHMeidvGJ1D339DZ+a9SNhgiWYAJ/qgCM7D06odNSNZWXpEUzV36YcQLeREooekYiL2vGPfEIa8pLjLDVCxYDKvLzqfi6JbAHJ4NaZcTQGDWxRjghNgBTt5A== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iDRExrwg/O1oUsa8Eq5Xg1M6afVp5FkdPU/BZIJHvoM=; b=zSiUuXHTtqMZ8KmrTPmYmXiRKHGG6NwVrMIXA9sc5B78U1YcZ0tcpd/Y1sdSBk5TziUYnoJvOuDZGH8l0NPg5bgoe8imQCDQM0n7RBFsq4znexj+AvWcbKNSj9fdfGYxiugdGDqyo9sa5XU3OrVwSCqEhxIbINnsrBgZumlf1KQ= Received: from AS9P194CA0020.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:46d::20) by DB3PR08MB9897.eurprd08.prod.outlook.com (2603:10a6:10:436::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Wed, 6 Dec 2023 12:44:38 +0000 Received: from AM3PEPF0000A79C.eurprd04.prod.outlook.com (2603:10a6:20b:46d:cafe::7c) by AS9P194CA0020.outlook.office365.com (2603:10a6:20b:46d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.29 via Frontend Transport; Wed, 6 Dec 2023 12:44:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM3PEPF0000A79C.mail.protection.outlook.com (10.167.16.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.24 via Frontend Transport; Wed, 6 Dec 2023 12:44:38 +0000 Received: ("Tessian outbound 385ad2f98d71:v228"); Wed, 06 Dec 2023 12:44:38 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: dfe5d51c7ab5631c X-CR-MTA-TID: 64aa7808 Received: from ca13b0140954.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EF173670-1C11-45C0-B99B-57810E0FE8DD.1; Wed, 06 Dec 2023 12:44:32 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ca13b0140954.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 06 Dec 2023 12:44:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ea8FKQdOf6takQraslT75rr/FyfuQBPzAVlnMG9diWfASdZxfhuLMzisoSBGFsfo4z8OvgjStvp+yyZPiOv4eHYsEzTpeMl2J0vnn0XWyY9LmbuX1hYkKHItW9RXeHikMISucHi4MKVhBZ2VTgfRz5RYmXaP1akH3ff7hIqzvfnnquEVw9h7f/eLTD6fV/i+A+DFGMlEbKq+D6aJ7qgAJrgM59HQFVhhQ4woeWfqt4YB8qVMeB585KzgcAEQ9CwgcRc5QL5NjDPgXomNaFhVebaukp0JsfLobiTbTpvIX2fbARURO6mvBXQ2B40WRbCn4ShyjYlt4ts5v0z6xd9XVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iDRExrwg/O1oUsa8Eq5Xg1M6afVp5FkdPU/BZIJHvoM=; b=X9FT4zCvEb+DZVsK3bqSCNHvndR86lVU7qiTl1UwvF/rOveVb/T2l9Uxil9osq/0GYfZDrvXtet4ZP8e3PgLVTImYoii7yvd4pQx0RT3vyA8vazyGdtbOkN17oqqwiCzuTVDkK/SY9rL6i36k4UGnqY5vLA86dVcjx5T5RE9HgVZN+PkBApFyyCtbcMLz3qMTPikE+JPwgTx4ma6xrRX/egmmvB4vO6bR+kDNRfYLpVd7nYwWGjFM+N5PyAXjUh1KWqJbpSWgDUTk4DowHCvHlrrCjzm+19EZG1c9pfkYQAgsyufvd/RRzMnOpCXkxVwpP8uE1DgRR7LZxI9+LvUUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iDRExrwg/O1oUsa8Eq5Xg1M6afVp5FkdPU/BZIJHvoM=; b=zSiUuXHTtqMZ8KmrTPmYmXiRKHGG6NwVrMIXA9sc5B78U1YcZ0tcpd/Y1sdSBk5TziUYnoJvOuDZGH8l0NPg5bgoe8imQCDQM0n7RBFsq4znexj+AvWcbKNSj9fdfGYxiugdGDqyo9sa5XU3OrVwSCqEhxIbINnsrBgZumlf1KQ= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6678.eurprd08.prod.outlook.com (2603:10a6:20b:398::8) by AS8PR08MB5942.eurprd08.prod.outlook.com (2603:10a6:20b:29f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.25; Wed, 6 Dec 2023 12:44:30 +0000 Received: from AS8PR08MB6678.eurprd08.prod.outlook.com ([fe80::af15:c9d7:cd8c:6da2]) by AS8PR08MB6678.eurprd08.prod.outlook.com ([fe80::af15:c9d7:cd8c:6da2%7]) with mapi id 15.20.7068.025; Wed, 6 Dec 2023 12:44:30 +0000 Date: Wed, 6 Dec 2023 12:44:26 +0000 From: Andrew Carlotti To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford Subject: [1/5] aarch64: Add cpu feature detection to libgcc Message-ID: References: <4cdd7089-edd4-96b9-5c0e-120d5357f01b@e124511.cambridge.arm.com> Content-Disposition: inline In-Reply-To: <4cdd7089-edd4-96b9-5c0e-120d5357f01b@e124511.cambridge.arm.com> X-ClientProxiedBy: LNXP265CA0045.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::33) To AS8PR08MB6678.eurprd08.prod.outlook.com (2603:10a6:20b:398::8) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB6678:EE_|AS8PR08MB5942:EE_|AM3PEPF0000A79C:EE_|DB3PR08MB9897:EE_ X-MS-Office365-Filtering-Correlation-Id: f3d473c1-60df-4a71-356f-08dbf6591c01 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: +4MEz0ocwX1FnwmaNBCrOzbhBO80svPDx+pN082SGxfQ41ZxSwJAR6gHncnE9VldeR4yGrs4JPi4JAQpyQSUvgzgZ6UW7vIi2/f6XlnWm6iZXYzMXbX8fAQTYuYyjnf1oVvMSBnzXvHtO/ebzr/ISCm/tVYZLQVGFHfqjvQCJ6cJTAyWNWlO8GDCxSoQmqsCD/CfxiZaYeVWwjvKpLe5ztxVyUv5yzqYTSCbPUYoev0fwIpTwH4iMR4lVWF6b31kTpMxXmxPKbkV2m/ceLk9e/bV/jecG6kdZ+57A1trbbGifj99n2jl7YgQf9lpu+7cDXtnnyP/Gx5myKDanu1E2NeNfXjaDxA/C83mtgiOjoptHobtgBZnkmFo98ykU6eTgxSUu31fydNmk3dRdy7dyRM8npxTXH43WXW3sRl5GEQcMkX6PKbjAnn73A73VZJwGWos3sZOCXpMAOmBAIDxTgnaXruNHxXBYog79kpEOklwV2N/pgvJLmmODm8Nk1F1xS5kTvnZ5jLdJlBFcl1BfSiqWz50zD8GJVroRW4IQKFsZQJs3L7esyo0JKTLCtRhjAk2k91+j1MYhXLu4gST6mK/8VZFTHonMX0AV9VeXv8= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB6678.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(346002)(376002)(366004)(396003)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(5660300002)(44832011)(6506007)(6666004)(86362001)(8676002)(8936002)(4326008)(31696002)(41300700001)(38100700002)(31686004)(2906002)(30864003)(6512007)(26005)(83380400001)(478600001)(316002)(66556008)(66946007)(6916009)(66476007)(6486002)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB5942 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A79C.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0ac3ef26-2a76-4897-4c03-08dbf65916e2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dW0WPVem8bAVQeI9DU8UdJ9DquhHOj6aD5vX+CauS3m8KGy/IrEUnH0IhYnkJC6OMmoWF76mkeY/irMqt/7da2JMdHoC+HtwEEpq+TRs149NS9twQF9pwx5NdP10YfCUV+7TIQhTX53EZeI6iG+MiU0ceLI4oNqd2EX5vtGg24OkEpzCSPms4YgtTMDzul5ZIpnS9tLS5OSSRtjwwB1zSxJE8zVlmUn4gfKMF1lqMffz3MqMe4xAs7XeeeB2PNL8avTnhAv1iYIBRp9+HKg9dOn5k2SqCg1IW5Ka0HeSa/VS+wjvGZ1apsOuuAH4KdOIGyAWm+9AAGuRw17vkDPLoox8O8mDZTDn+bBNDpdLjiGZ/w+LX4PscFFxi13p/CumiyDfBHLYf8x6PdVkcUjzz03W+yapvt3NXEpbcNwhwte6Fv457NnEimYB90fB+0J2xSTiK+b7XF2vz8svhq8a1kB8JsGPy1C4XVOY5hfrEc9xnE56MiTyZL2wwEDTHE3hNTaFOsi1iPvTZzR6Rq9TTgp4RWJzzxb/trBWdwGlf0jKhAD/VvbTf69ec+87glRkl51kwYo3Q4EdZ8aBpPjt27v+tXYQZvrtsbfbor+MMeLtqogiGXcu10FilahgRdrjEDILYX4WbzMoFZsvCYVydD1pHRSVxR49W/0px8NnKz4Dx2S4RSA6hguDHv2MusPh+LnuXPjZ0sO4PmI+uyWxlQ== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230031)(4636009)(346002)(376002)(136003)(396003)(39850400004)(230922051799003)(1800799012)(451199024)(186009)(82310400011)(64100799003)(46966006)(36840700001)(31686004)(40480700001)(316002)(478600001)(8676002)(6486002)(47076005)(336012)(6506007)(6666004)(26005)(4326008)(70206006)(70586007)(6916009)(83380400001)(8936002)(82740400003)(5660300002)(30864003)(6512007)(81166007)(356005)(44832011)(2906002)(86362001)(36860700001)(31696002)(41300700001)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2023 12:44:38.4795 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3d473c1-60df-4a71-356f-08dbf6591c01 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM3PEPF0000A79C.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR08MB9897 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784536588902144576 X-GMAIL-MSGID: 1784536588902144576 This is added to enable function multiversioning, but can also be used directly. The interface is chosen to match that used in LLVM's compiler-rt, to facilitate cross-compiler compatibility. The content of the patch is derived almost entirely from Pavel's prior contributions to compiler-rt/lib/builtins/cpu_model.c. I have made minor changes to align more closely with GCC coding style, and to exclude any code from other LLVM contributors, and am adding this to GCC with Pavel's approval. libgcc/ChangeLog: * config/aarch64/t-aarch64: Include cpuinfo.c * config/aarch64/cpuinfo.c: New file (__init_cpu_features_constructor) New. (__init_cpu_features_resolver) New. (__init_cpu_features) New. Co-authored-by: Pavel Iliin diff --git a/libgcc/config/aarch64/cpuinfo.c b/libgcc/config/aarch64/cpuinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..634f591c194bc70048f714d7eb0ace1f2f4137ea --- /dev/null +++ b/libgcc/config/aarch64/cpuinfo.c @@ -0,0 +1,500 @@ +/* CPU feature detection for AArch64 architecture. + Copyright (C) 2023 Free Software Foundation, Inc. + + This file is part of GCC. + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#if __has_include() +#include + +#if __has_include() +#include +#else +typedef struct __ifunc_arg_t { + unsigned long _size; + unsigned long _hwcap; + unsigned long _hwcap2; +} __ifunc_arg_t; +#endif + +#if __has_include() +#include + +/* CPUFeatures must correspond to the same AArch64 features in aarch64.cc */ +enum CPUFeatures { + FEAT_RNG, + FEAT_FLAGM, + FEAT_FLAGM2, + FEAT_FP16FML, + FEAT_DOTPROD, + FEAT_SM4, + FEAT_RDM, + FEAT_LSE, + FEAT_FP, + FEAT_SIMD, + FEAT_CRC, + FEAT_SHA1, + FEAT_SHA2, + FEAT_SHA3, + FEAT_AES, + FEAT_PMULL, + FEAT_FP16, + FEAT_DIT, + FEAT_DPB, + FEAT_DPB2, + FEAT_JSCVT, + FEAT_FCMA, + FEAT_RCPC, + FEAT_RCPC2, + FEAT_FRINTTS, + FEAT_DGH, + FEAT_I8MM, + FEAT_BF16, + FEAT_EBF16, + FEAT_RPRES, + FEAT_SVE, + FEAT_SVE_BF16, + FEAT_SVE_EBF16, + FEAT_SVE_I8MM, + FEAT_SVE_F32MM, + FEAT_SVE_F64MM, + FEAT_SVE2, + FEAT_SVE_AES, + FEAT_SVE_PMULL128, + FEAT_SVE_BITPERM, + FEAT_SVE_SHA3, + FEAT_SVE_SM4, + FEAT_SME, + FEAT_MEMTAG, + FEAT_MEMTAG2, + FEAT_MEMTAG3, + FEAT_SB, + FEAT_PREDRES, + FEAT_SSBS, + FEAT_SSBS2, + FEAT_BTI, + FEAT_LS64, + FEAT_LS64_V, + FEAT_LS64_ACCDATA, + FEAT_WFXT, + FEAT_SME_F64, + FEAT_SME_I64, + FEAT_SME2, + FEAT_RCPC3, + FEAT_MAX, + FEAT_EXT = 62, /* Reserved to indicate presence of additional features field + in __aarch64_cpu_features. */ + FEAT_INIT /* Used as flag of features initialization completion. */ +}; + +/* Architecture features used in Function Multi Versioning. */ +struct { + unsigned long long features; + /* As features grows new fields could be added. */ +} __aarch64_cpu_features __attribute__((visibility("hidden"), nocommon)); + +#ifndef _IFUNC_ARG_HWCAP +#define _IFUNC_ARG_HWCAP (1ULL << 62) +#endif +#ifndef AT_HWCAP +#define AT_HWCAP 16 +#endif +#ifndef HWCAP_CPUID +#define HWCAP_CPUID (1 << 11) +#endif +#ifndef HWCAP_FP +#define HWCAP_FP (1 << 0) +#endif +#ifndef HWCAP_ASIMD +#define HWCAP_ASIMD (1 << 1) +#endif +#ifndef HWCAP_AES +#define HWCAP_AES (1 << 3) +#endif +#ifndef HWCAP_PMULL +#define HWCAP_PMULL (1 << 4) +#endif +#ifndef HWCAP_SHA1 +#define HWCAP_SHA1 (1 << 5) +#endif +#ifndef HWCAP_SHA2 +#define HWCAP_SHA2 (1 << 6) +#endif +#ifndef HWCAP_ATOMICS +#define HWCAP_ATOMICS (1 << 8) +#endif +#ifndef HWCAP_FPHP +#define HWCAP_FPHP (1 << 9) +#endif +#ifndef HWCAP_ASIMDHP +#define HWCAP_ASIMDHP (1 << 10) +#endif +#ifndef HWCAP_ASIMDRDM +#define HWCAP_ASIMDRDM (1 << 12) +#endif +#ifndef HWCAP_JSCVT +#define HWCAP_JSCVT (1 << 13) +#endif +#ifndef HWCAP_FCMA +#define HWCAP_FCMA (1 << 14) +#endif +#ifndef HWCAP_LRCPC +#define HWCAP_LRCPC (1 << 15) +#endif +#ifndef HWCAP_DCPOP +#define HWCAP_DCPOP (1 << 16) +#endif +#ifndef HWCAP_SHA3 +#define HWCAP_SHA3 (1 << 17) +#endif +#ifndef HWCAP_SM3 +#define HWCAP_SM3 (1 << 18) +#endif +#ifndef HWCAP_SM4 +#define HWCAP_SM4 (1 << 19) +#endif +#ifndef HWCAP_ASIMDDP +#define HWCAP_ASIMDDP (1 << 20) +#endif +#ifndef HWCAP_SHA512 +#define HWCAP_SHA512 (1 << 21) +#endif +#ifndef HWCAP_SVE +#define HWCAP_SVE (1 << 22) +#endif +#ifndef HWCAP_ASIMDFHM +#define HWCAP_ASIMDFHM (1 << 23) +#endif +#ifndef HWCAP_DIT +#define HWCAP_DIT (1 << 24) +#endif +#ifndef HWCAP_ILRCPC +#define HWCAP_ILRCPC (1 << 26) +#endif +#ifndef HWCAP_FLAGM +#define HWCAP_FLAGM (1 << 27) +#endif +#ifndef HWCAP_SSBS +#define HWCAP_SSBS (1 << 28) +#endif +#ifndef HWCAP_SB +#define HWCAP_SB (1 << 29) +#endif + +#ifndef HWCAP2_DCPODP +#define HWCAP2_DCPODP (1 << 0) +#endif +#ifndef HWCAP2_SVE2 +#define HWCAP2_SVE2 (1 << 1) +#endif +#ifndef HWCAP2_SVEAES +#define HWCAP2_SVEAES (1 << 2) +#endif +#ifndef HWCAP2_SVEPMULL +#define HWCAP2_SVEPMULL (1 << 3) +#endif +#ifndef HWCAP2_SVEBITPERM +#define HWCAP2_SVEBITPERM (1 << 4) +#endif +#ifndef HWCAP2_SVESHA3 +#define HWCAP2_SVESHA3 (1 << 5) +#endif +#ifndef HWCAP2_SVESM4 +#define HWCAP2_SVESM4 (1 << 6) +#endif +#ifndef HWCAP2_FLAGM2 +#define HWCAP2_FLAGM2 (1 << 7) +#endif +#ifndef HWCAP2_FRINT +#define HWCAP2_FRINT (1 << 8) +#endif +#ifndef HWCAP2_SVEI8MM +#define HWCAP2_SVEI8MM (1 << 9) +#endif +#ifndef HWCAP2_SVEF32MM +#define HWCAP2_SVEF32MM (1 << 10) +#endif +#ifndef HWCAP2_SVEF64MM +#define HWCAP2_SVEF64MM (1 << 11) +#endif +#ifndef HWCAP2_SVEBF16 +#define HWCAP2_SVEBF16 (1 << 12) +#endif +#ifndef HWCAP2_I8MM +#define HWCAP2_I8MM (1 << 13) +#endif +#ifndef HWCAP2_BF16 +#define HWCAP2_BF16 (1 << 14) +#endif +#ifndef HWCAP2_DGH +#define HWCAP2_DGH (1 << 15) +#endif +#ifndef HWCAP2_RNG +#define HWCAP2_RNG (1 << 16) +#endif +#ifndef HWCAP2_BTI +#define HWCAP2_BTI (1 << 17) +#endif +#ifndef HWCAP2_MTE +#define HWCAP2_MTE (1 << 18) +#endif +#ifndef HWCAP2_RPRES +#define HWCAP2_RPRES (1 << 21) +#endif +#ifndef HWCAP2_MTE3 +#define HWCAP2_MTE3 (1 << 22) +#endif +#ifndef HWCAP2_SME +#define HWCAP2_SME (1 << 23) +#endif +#ifndef HWCAP2_SME_I16I64 +#define HWCAP2_SME_I16I64 (1 << 24) +#endif +#ifndef HWCAP2_SME_F64F64 +#define HWCAP2_SME_F64F64 (1 << 25) +#endif +#ifndef HWCAP2_WFXT +#define HWCAP2_WFXT (1UL << 31) +#endif +#ifndef HWCAP2_EBF16 +#define HWCAP2_EBF16 (1UL << 32) +#endif +#ifndef HWCAP2_SVE_EBF16 +#define HWCAP2_SVE_EBF16 (1UL << 33) +#endif + +static void +__init_cpu_features_constructor(unsigned long hwcap, + const __ifunc_arg_t *arg) { +#define setCPUFeature(F) __aarch64_cpu_features.features |= 1ULL << F +#define getCPUFeature(id, ftr) __asm__("mrs %0, " #id : "=r"(ftr)) +#define extractBits(val, start, number) \ + (val & ((1ULL << number) - 1ULL) << start) >> start + unsigned long hwcap2 = 0; + if (hwcap & _IFUNC_ARG_HWCAP) + hwcap2 = arg->_hwcap2; + if (hwcap & HWCAP_CRC32) + setCPUFeature(FEAT_CRC); + if (hwcap & HWCAP_PMULL) + setCPUFeature(FEAT_PMULL); + if (hwcap & HWCAP_FLAGM) + setCPUFeature(FEAT_FLAGM); + if (hwcap2 & HWCAP2_FLAGM2) { + setCPUFeature(FEAT_FLAGM); + setCPUFeature(FEAT_FLAGM2); + } + if (hwcap & HWCAP_SM3 && hwcap & HWCAP_SM4) + setCPUFeature(FEAT_SM4); + if (hwcap & HWCAP_ASIMDDP) + setCPUFeature(FEAT_DOTPROD); + if (hwcap & HWCAP_ASIMDFHM) + setCPUFeature(FEAT_FP16FML); + if (hwcap & HWCAP_FPHP) { + setCPUFeature(FEAT_FP16); + setCPUFeature(FEAT_FP); + } + if (hwcap & HWCAP_DIT) + setCPUFeature(FEAT_DIT); + if (hwcap & HWCAP_ASIMDRDM) + setCPUFeature(FEAT_RDM); + if (hwcap & HWCAP_ILRCPC) + setCPUFeature(FEAT_RCPC2); + if (hwcap & HWCAP_AES) + setCPUFeature(FEAT_AES); + if (hwcap & HWCAP_SHA1) + setCPUFeature(FEAT_SHA1); + if (hwcap & HWCAP_SHA2) + setCPUFeature(FEAT_SHA2); + if (hwcap & HWCAP_JSCVT) + setCPUFeature(FEAT_JSCVT); + if (hwcap & HWCAP_FCMA) + setCPUFeature(FEAT_FCMA); + if (hwcap & HWCAP_SB) + setCPUFeature(FEAT_SB); + if (hwcap & HWCAP_SSBS) + setCPUFeature(FEAT_SSBS2); + if (hwcap2 & HWCAP2_MTE) { + setCPUFeature(FEAT_MEMTAG); + setCPUFeature(FEAT_MEMTAG2); + } + if (hwcap2 & HWCAP2_MTE3) { + setCPUFeature(FEAT_MEMTAG); + setCPUFeature(FEAT_MEMTAG2); + setCPUFeature(FEAT_MEMTAG3); + } + if (hwcap2 & HWCAP2_SVEAES) + setCPUFeature(FEAT_SVE_AES); + if (hwcap2 & HWCAP2_SVEPMULL) { + setCPUFeature(FEAT_SVE_AES); + setCPUFeature(FEAT_SVE_PMULL128); + } + if (hwcap2 & HWCAP2_SVEBITPERM) + setCPUFeature(FEAT_SVE_BITPERM); + if (hwcap2 & HWCAP2_SVESHA3) + setCPUFeature(FEAT_SVE_SHA3); + if (hwcap2 & HWCAP2_SVESM4) + setCPUFeature(FEAT_SVE_SM4); + if (hwcap2 & HWCAP2_DCPODP) + setCPUFeature(FEAT_DPB2); + if (hwcap & HWCAP_ATOMICS) + setCPUFeature(FEAT_LSE); + if (hwcap2 & HWCAP2_RNG) + setCPUFeature(FEAT_RNG); + if (hwcap2 & HWCAP2_I8MM) + setCPUFeature(FEAT_I8MM); + if (hwcap2 & HWCAP2_EBF16) + setCPUFeature(FEAT_EBF16); + if (hwcap2 & HWCAP2_SVE_EBF16) + setCPUFeature(FEAT_SVE_EBF16); + if (hwcap2 & HWCAP2_DGH) + setCPUFeature(FEAT_DGH); + if (hwcap2 & HWCAP2_FRINT) + setCPUFeature(FEAT_FRINTTS); + if (hwcap2 & HWCAP2_SVEI8MM) + setCPUFeature(FEAT_SVE_I8MM); + if (hwcap2 & HWCAP2_SVEF32MM) + setCPUFeature(FEAT_SVE_F32MM); + if (hwcap2 & HWCAP2_SVEF64MM) + setCPUFeature(FEAT_SVE_F64MM); + if (hwcap2 & HWCAP2_BTI) + setCPUFeature(FEAT_BTI); + if (hwcap2 & HWCAP2_RPRES) + setCPUFeature(FEAT_RPRES); + if (hwcap2 & HWCAP2_WFXT) + setCPUFeature(FEAT_WFXT); + if (hwcap2 & HWCAP2_SME) + setCPUFeature(FEAT_SME); + if (hwcap2 & HWCAP2_SME_I16I64) + setCPUFeature(FEAT_SME_I64); + if (hwcap2 & HWCAP2_SME_F64F64) + setCPUFeature(FEAT_SME_F64); + if (hwcap & HWCAP_CPUID) { + unsigned long ftr; + getCPUFeature(ID_AA64PFR1_EL1, ftr); + /* ID_AA64PFR1_EL1.MTE >= 0b0001 */ + if (extractBits(ftr, 8, 4) >= 0x1) + setCPUFeature(FEAT_MEMTAG); + /* ID_AA64PFR1_EL1.SSBS == 0b0001 */ + if (extractBits(ftr, 4, 4) == 0x1) + setCPUFeature(FEAT_SSBS); + /* ID_AA64PFR1_EL1.SME == 0b0010 */ + if (extractBits(ftr, 24, 4) == 0x2) + setCPUFeature(FEAT_SME2); + getCPUFeature(ID_AA64PFR0_EL1, ftr); + /* ID_AA64PFR0_EL1.FP != 0b1111 */ + if (extractBits(ftr, 16, 4) != 0xF) { + setCPUFeature(FEAT_FP); + /* ID_AA64PFR0_EL1.AdvSIMD has the same value as ID_AA64PFR0_EL1.FP */ + setCPUFeature(FEAT_SIMD); + } + /* ID_AA64PFR0_EL1.SVE != 0b0000 */ + if (extractBits(ftr, 32, 4) != 0x0) { + /* get ID_AA64ZFR0_EL1, that name supported if sve enabled only */ + getCPUFeature(S3_0_C0_C4_4, ftr); + /* ID_AA64ZFR0_EL1.SVEver == 0b0000 */ + if (extractBits(ftr, 0, 4) == 0x0) + setCPUFeature(FEAT_SVE); + /* ID_AA64ZFR0_EL1.SVEver == 0b0001 */ + if (extractBits(ftr, 0, 4) == 0x1) + setCPUFeature(FEAT_SVE2); + /* ID_AA64ZFR0_EL1.BF16 != 0b0000 */ + if (extractBits(ftr, 20, 4) != 0x0) + setCPUFeature(FEAT_SVE_BF16); + } + getCPUFeature(ID_AA64ISAR0_EL1, ftr); + /* ID_AA64ISAR0_EL1.SHA3 != 0b0000 */ + if (extractBits(ftr, 32, 4) != 0x0) + setCPUFeature(FEAT_SHA3); + getCPUFeature(ID_AA64ISAR1_EL1, ftr); + /* ID_AA64ISAR1_EL1.DPB >= 0b0001 */ + if (extractBits(ftr, 0, 4) >= 0x1) + setCPUFeature(FEAT_DPB); + /* ID_AA64ISAR1_EL1.LRCPC != 0b0000 */ + if (extractBits(ftr, 20, 4) != 0x0) + setCPUFeature(FEAT_RCPC); + /* ID_AA64ISAR1_EL1.LRCPC == 0b0011 */ + if (extractBits(ftr, 20, 4) == 0x3) + setCPUFeature(FEAT_RCPC3); + /* ID_AA64ISAR1_EL1.SPECRES == 0b0001 */ + if (extractBits(ftr, 40, 4) == 0x2) + setCPUFeature(FEAT_PREDRES); + /* ID_AA64ISAR1_EL1.BF16 != 0b0000 */ + if (extractBits(ftr, 44, 4) != 0x0) + setCPUFeature(FEAT_BF16); + /* ID_AA64ISAR1_EL1.LS64 >= 0b0001 */ + if (extractBits(ftr, 60, 4) >= 0x1) + setCPUFeature(FEAT_LS64); + /* ID_AA64ISAR1_EL1.LS64 >= 0b0010 */ + if (extractBits(ftr, 60, 4) >= 0x2) + setCPUFeature(FEAT_LS64_V); + /* ID_AA64ISAR1_EL1.LS64 >= 0b0011 */ + if (extractBits(ftr, 60, 4) >= 0x3) + setCPUFeature(FEAT_LS64_ACCDATA); + } else { + /* Set some features in case of no CPUID support. */ + if (hwcap & (HWCAP_FP | HWCAP_FPHP)) { + setCPUFeature(FEAT_FP); + /* FP and AdvSIMD fields have the same value. */ + setCPUFeature(FEAT_SIMD); + } + if (hwcap & HWCAP_DCPOP || hwcap2 & HWCAP2_DCPODP) + setCPUFeature(FEAT_DPB); + if (hwcap & HWCAP_LRCPC || hwcap & HWCAP_ILRCPC) + setCPUFeature(FEAT_RCPC); + if (hwcap2 & HWCAP2_BF16 || hwcap2 & HWCAP2_EBF16) + setCPUFeature(FEAT_BF16); + if (hwcap2 & HWCAP2_SVEBF16) + setCPUFeature(FEAT_SVE_BF16); + if (hwcap2 & HWCAP2_SVE2 && hwcap & HWCAP_SVE) + setCPUFeature(FEAT_SVE2); + if (hwcap & HWCAP_SHA3) + setCPUFeature(FEAT_SHA3); + } + setCPUFeature(FEAT_INIT); +} + +void +__init_cpu_features_resolver(unsigned long hwcap, const __ifunc_arg_t *arg) { + if (__aarch64_cpu_features.features) + return; + __init_cpu_features_constructor(hwcap, arg); +} + +void __attribute__ ((constructor)) +__init_cpu_features(void) { + unsigned long hwcap; + unsigned long hwcap2; + /* CPU features already initialized. */ + if (__aarch64_cpu_features.features) + return; + hwcap = getauxval(AT_HWCAP); + hwcap2 = getauxval(AT_HWCAP2); + __ifunc_arg_t arg; + arg._size = sizeof(__ifunc_arg_t); + arg._hwcap = hwcap; + arg._hwcap2 = hwcap2; + __init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg); +#undef extractBits +#undef getCPUFeature +#undef setCPUFeature +} +#endif /* __has_include() */ +#endif /* __has_include() */ diff --git a/libgcc/config/aarch64/t-aarch64 b/libgcc/config/aarch64/t-aarch64 index a40b6241c86ecc4007b5cfd28aa989ee894aa410..8bc1a4ca0c2eb75c17e62a25aa45a875bfd472f8 100644 --- a/libgcc/config/aarch64/t-aarch64 +++ b/libgcc/config/aarch64/t-aarch64 @@ -19,3 +19,4 @@ # . LIB2ADD += $(srcdir)/config/aarch64/sync-cache.c +LIB2ADD += $(srcdir)/config/aarch64/cpuinfo.c