From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80087.outbound.protection.outlook.com [40.107.8.87]) by sourceware.org (Postfix) with ESMTPS id 4B32C386103D for ; Wed, 22 Jul 2020 19:45:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4B32C386103D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Andrea.Corallo@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=7QDVlDExW1pwVW8iCvzQSFWtaEWmw0wShk7EP3GremM=; b=In/2bke9ckHNN5bJbyNcni+3sRSY9NsmBACWhKpe5SDu9xRUyn1n1GDeVfNVfuKJ30JAmTHe4l/qyvzVoha7ZkTOTyXWjjc98XyxOF4exZ40+2hjsIq578pZpHxW2NfG7KPU+OLAECcQ/ST/rW0GuMZgR7ji+HeoGGpu4Kz9ABQ= Received: from AM7PR03CA0007.eurprd03.prod.outlook.com (2603:10a6:20b:130::17) by VI1PR08MB3744.eurprd08.prod.outlook.com (2603:10a6:803:bc::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.25; Wed, 22 Jul 2020 19:45:18 +0000 Received: from VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:130:cafe::e0) by AM7PR03CA0007.outlook.office365.com (2603:10a6:20b:130::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Wed, 22 Jul 2020 19:45:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; dmarc=bestguesspass 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT005.mail.protection.outlook.com (10.152.18.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.10 via Frontend Transport; Wed, 22 Jul 2020 19:45:17 +0000 Received: ("Tessian outbound c4059ed8d7bf:v62"); Wed, 22 Jul 2020 19:45:17 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6e99f480f14186d6 X-CR-MTA-TID: 64aa7808 Received: from 585bd6f3f2bc.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 43542F6F-23FD-4DEB-B28C-7AED472D1D0F.1; Wed, 22 Jul 2020 19:45:12 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 585bd6f3f2bc.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 22 Jul 2020 19:45:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gISHX2hjXkiQm6umeNvXpzny2QRPH2XfLoMoegQ/Jw+PnxINFxOX6ZIYvWowV5smooTo6osw7GOsXfRmgUeve3gRWb0JR71Te25jT4mX//B5GHxgSYjYvH9KqgxE17D9mp+LyyIwcgVKcGQVzezokKkGidcgpvDCh7SJSqxUYLeMqXLJL4TFff+qVZkb6DUMYhkzIfsao83yWvm/mn7hO27AlWa46uhcT5WMZiYpiQ5Tv57lGtXLIvjBUq8QagNR9bAf8Nwc8bFNke9+bFmpuKjDdreaw0eWRC+u2juGxmFORPkjg+1dqtOpcjenHXzs4wT23+TI6beeq4RbRby14Q== 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-SenderADCheck; bh=7QDVlDExW1pwVW8iCvzQSFWtaEWmw0wShk7EP3GremM=; b=Z13rBOWxdlOPzWP8q4yuqvxl75SzYYEJBnBi2ERIq4dnKqt2fK4SCAjGPcTF3bxeyJLjjqzuGda+mX+iWiHYRpfXo1+QyBHuCZq3YiYYL8sgfWj8mFaj5HIIpKAgdRAM661ZrDCrXmhLhFCImdBaZILezVWLMipnswKPbsgF6VGyiLbbBz0tq+z8Y2dzEsp6dBiMgFbGLgBGfLD97ZJqZPLf/Nejy14oPA5lIUD4HhIw11zAgAtrF42KOv52Gle0pKiKjEFxm7vzo+04q0EF+1JxxTQcHU8LTGeqI0IEoTM9e7Dkl8oYF4B6FCQNigH3OHqx6ccpR11+I52YCY+zeQ== 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=7QDVlDExW1pwVW8iCvzQSFWtaEWmw0wShk7EP3GremM=; b=In/2bke9ckHNN5bJbyNcni+3sRSY9NsmBACWhKpe5SDu9xRUyn1n1GDeVfNVfuKJ30JAmTHe4l/qyvzVoha7ZkTOTyXWjjc98XyxOF4exZ40+2hjsIq578pZpHxW2NfG7KPU+OLAECcQ/ST/rW0GuMZgR7ji+HeoGGpu4Kz9ABQ= Authentication-Results-Original: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received: from DB7PR08MB3594.eurprd08.prod.outlook.com (2603:10a6:10:4e::11) by DBBPR08MB4678.eurprd08.prod.outlook.com (2603:10a6:10:dc::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.25; Wed, 22 Jul 2020 19:45:11 +0000 Received: from DB7PR08MB3594.eurprd08.prod.outlook.com ([fe80::9f3:461:834d:7ca]) by DB7PR08MB3594.eurprd08.prod.outlook.com ([fe80::9f3:461:834d:7ca%7]) with mapi id 15.20.3195.026; Wed, 22 Jul 2020 19:45:10 +0000 From: Andrea Corallo To: Segher Boessenkool Cc: Andrew Pinski , Richard Earnshaw , nd , GCC Patches Subject: Re: [PATCH 2/2] Aarch64: Add branch diluter pass References: <20200722164322.GA32057@gate.crashing.org> Date: Wed, 22 Jul 2020 21:45:08 +0200 In-Reply-To: <20200722164322.GA32057@gate.crashing.org> (Segher Boessenkool's message of "Wed, 22 Jul 2020 11:43:22 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-ClientProxiedBy: LO2P265CA0473.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::29) To DB7PR08MB3594.eurprd08.prod.outlook.com (2603:10a6:10:4e::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from e112547 (217.140.99.251) by LO2P265CA0473.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Wed, 22 Jul 2020 19:45:09 +0000 X-Originating-IP: [217.140.99.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 30815ed3-040a-4753-09b6-08d82e77c2d6 X-MS-TrafficTypeDiagnostic: DBBPR08MB4678:|VI1PR08MB3744: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 0l3TY7xEoHAaY7CddZtFe0dcWLaYIju6AYx6wsbLqL+nIVQrHwEcE/Lf0kpTv8Pt4P7NXKbFlJaaYHSjxPWfomkfzCwrX67u4MVg6VI1r9Kdy30Qu1kuD/NhPdz17RWCx47dOQ2MZPEBn5d62oofIZoSHb9kCVW+iBCXEkIQ0a82WLsu2nRna0kNskU08es7E/v7vIWKLQX4xLu5/jS1iyPcPihZ09kcFXgI2FMKnexETilbjqq60uJTg3md0aUjloxZWvi/C0TZKIzFGZxDLD5JvMwfH6ipBH9YqMeChjmRUpAtqjZ5t/nu2/mI/AjqCCI7stL9zWdm9+PNjGlKUw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR08MB3594.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(39860400002)(136003)(346002)(396003)(366004)(8676002)(4326008)(26005)(16526019)(8936002)(956004)(186003)(6486002)(6496006)(6916009)(2616005)(44832011)(36756003)(52116002)(478600001)(5660300002)(86362001)(66556008)(83380400001)(316002)(2906002)(66476007)(66946007)(54906003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: vMCQJvKCMiCjwSZoUNsT5Q2vyqF7it2cIZ71DWTHFCa2XGVkk/bkjoazR6EN0CysVe5NPKe+MhuEvaN3akXTa/iT6uurZYaBaC2NBFWdhsruSMY85mH3KiH4/frFbskIR/cbANyuW16/n9TEsu/NvMMEoJHawQopgTcjlvqjlAGWS0swD5vecfXw7vyla1vzJoDLriENTI9eJYOJL0X3zOYrINyflQ/LuKjGtKw2GRbZJNvp6HWS/2jFnLv0MbEyJ1x5WuA0UsPZcoXM0LrakXlskKzBBw8PymwdJdEej9/NzAxwwK7AmxqYhwZpIjDIOB8iHOs5SJQJFjKgfC61PmkdJ5oF1El8OzyhRQkwhp2UCXXeBwEKfe6EjwxveGstFVMOpuDdHLH1eimaszrEA0umOdzGMyYTxsKKeAbhcs4eVbbE8EiQ5hdxeZpdpVKVkKD51+jNP28elUkKV0rmgvQ541MA9so5i9pI9zYAbYe7B4YvBBPkPSbFIT4T0w9t X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4678 Original-Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5668ef1c-0431-483c-a446-08d82e77be62 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CFDZ5rG8Vt0dsYyuz6DEskDY3wsqZ4ui2cRWxkLaxE0TYpiDWlxS65INXlTvei52GJanM9Bv9ld8Nz4HjHgjACKu4z1nfx/HQdedIyIg8Ei7tjxotwTdWrLRkT5VFJV+FuL6/eQeFisiFO4670YHMh2lcCCRricvAUpwli9xdt+A6TU5tg5QwPLgstABxfUsqaEu0+jIcm9vUEzKT0CuWJ0mQuVWyiTMUvv7gUuQnZ3kFd7WZfW4mKj6ETdTVoMXxlwWvFpLhR1unKTgrmaVeZCzaPKgB+HMcrwlUxBwzGF9qmwqQ8iWLcJtPAAWkn04d7vHebm2BYaV7Hzjht9LB8cdk/xwH+kwDKks6sHuaccba1Ni8mVJSI8ePgJ9Eag09bJ1YqyQUj5zR2B/lYvgOA== 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; SFTY:; SFS:(4636009)(346002)(376002)(39860400002)(136003)(396003)(46966005)(83380400001)(356005)(478600001)(81166007)(82310400002)(6496006)(82740400003)(5660300002)(47076004)(2906002)(336012)(86362001)(16526019)(36756003)(186003)(26005)(54906003)(8676002)(316002)(44832011)(6862004)(8936002)(4326008)(70206006)(70586007)(36906005)(2616005)(956004)(6486002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2020 19:45:17.6565 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30815ed3-040a-4753-09b6-08d82e77c2d6 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: VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3744 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jul 2020 19:45:22 -0000 Segher Boessenkool writes: > Hi! > > On Wed, Jul 22, 2020 at 03:53:34PM +0200, Andrea Corallo wrote: >> Andrew Pinski writes: >> > Can you give a simple example of what this patch does? >> >> Sure, this pass simply moves a sliding window over the insns trying to >> make sure that we never have more then 'max_branch' branches for every >> 'granule_size' insns. >> >> If too many branches are detected nops are added where considered less >> armful to correct that. > > Should that actually be a sliding window, or should there actually just > not be more than N branches per aligned block of machine code? Like, > per fetch group. > > Can you not use ASM_OUTPUT_ALIGN_WITH_NOP (or ASM_OUTPUT_MAX_SKIP_ALIGN > even) then? GCC has infrastructure for that, already. Correct, it's a sliding window only because the real load address is not known to the compiler and the algorithm is conservative. I believe we could use ASM_OUTPUT_ALIGN_WITH_NOP if we align each function to (al least) the granule size, then we should be able to insert 'nop aligned labels' precisely. My main fear is that given new cores tend to have big granules code size would blow. One advantage of the implemented algorithm is that even if slightly conservative it's impacting code size only where an high branch density shows up. Andrea