From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10046.outbound.protection.outlook.com [40.107.1.46]) by sourceware.org (Postfix) with ESMTPS id DFB4C385E83A for ; Tue, 28 Jul 2020 18:56:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DFB4C385E83A 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=HFold3LAZJ5fborE73PWDSyXifbGuzVDnqz8eYgBo5k=; b=M3Wj71Xyzo95FOaRDE+z/pCfxLVGY9y7GjXlq5AHeasbRUsR9M4jclZ9NRTXyoLkyQDyz3R/qKNu+xXWny7ud4Zr8QT7xh1xcpz7UnW0+Q2yNSvATlDrm4cGxyYfI93Ip5wM10nVmDwZA9vy0JRLMmuuiji1NUMDDsVS9+qXpOg= Received: from MR2P264CA0054.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:31::18) by DB6PR0802MB2151.eurprd08.prod.outlook.com (2603:10a6:4:84::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 18:56:06 +0000 Received: from VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:31:cafe::6f) by MR2P264CA0054.outlook.office365.com (2603:10a6:500:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16 via Frontend Transport; Tue, 28 Jul 2020 18:56:06 +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 VE1EUR03FT035.mail.protection.outlook.com (10.152.18.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.10 via Frontend Transport; Tue, 28 Jul 2020 18:56:06 +0000 Received: ("Tessian outbound 73b502bf693a:v62"); Tue, 28 Jul 2020 18:56:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 2d535d5477f3814a X-CR-MTA-TID: 64aa7808 Received: from 7ac2be566100.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4BA47A6C-0E4C-45FB-A9BF-D4346E32D8E5.1; Tue, 28 Jul 2020 18:56:00 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7ac2be566100.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 28 Jul 2020 18:56:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XAeGwPQlD0ZWSwWR8B/vHjAfY0sl7BgOcLT0z6xMcDEIBL3VAAr+9s9kgtB1PYRMhuu+6EVPxratJfO9qqQkb2j6dmMniZQ8vLiGhl9uhmr/DR1CRcFYdpTyO74Kiv25hpKrPKnvKV6NGg3bLqKohjKl0d0r2bAF9sD+8M7RJi+b5eFYHbkfcR9f44drFU0Wod49FegccKoQfMYzYdpvSDvvwnQaH5XAmtH0tB0y7lKL5yaVoUzkjDfykaKeiWnlqtX35UkDG9RLiCYsYnRu7TclCEW4Kdlfhy/kZTetqqHT4wUInLfwKKI/VoD9BvQiSD2fw2v3GzR01EfUbdXTwQ== 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=HFold3LAZJ5fborE73PWDSyXifbGuzVDnqz8eYgBo5k=; b=b8uAQPhoir0fY4EuQSHobbADKvZAXUAuxdG7ls6co6QYbtGYSdF79YvajKtYxFhV6WdTfNLjGKLBTOeT+B0fwVh1wbgrViS2uivJt+LnkUSiSMRo+i9aXKCW/kwrXb3P+LuoIrN2lTkoX6vv6fi3QZWiKC32Gqn6353mxKAPX7p36VLvin+AFCFUITsNXI35Keo/tYvjZ9cidMph7SSDovfPoghq6BvRlR050/q2MwJN/oQJj1nJHOjw+DUHue/fRRDtv1weSwmyE81NOhqtr3K9WhsmwwirpfzSvqUT1ql4rcszfPIt3+kVhkiHGkRpzVaPXFogtNhyd1mwv6TaBw== 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=HFold3LAZJ5fborE73PWDSyXifbGuzVDnqz8eYgBo5k=; b=M3Wj71Xyzo95FOaRDE+z/pCfxLVGY9y7GjXlq5AHeasbRUsR9M4jclZ9NRTXyoLkyQDyz3R/qKNu+xXWny7ud4Zr8QT7xh1xcpz7UnW0+Q2yNSvATlDrm4cGxyYfI93Ip5wM10nVmDwZA9vy0JRLMmuuiji1NUMDDsVS9+qXpOg= Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from DB7PR08MB3594.eurprd08.prod.outlook.com (2603:10a6:10:4e::11) by DB6PR0802MB2166.eurprd08.prod.outlook.com (2603:10a6:4:85::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.28; Tue, 28 Jul 2020 18:55:59 +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.3216.034; Tue, 28 Jul 2020 18:55:59 +0000 From: Andrea Corallo To: Segher Boessenkool Cc: gcc-patches@gcc.gnu.org, nd@arm.com, Richard Earnshaw Subject: Re: [PATCH 2/2] Aarch64: Add branch diluter pass References: <20200724220930.GT32057@gate.crashing.org> Date: Tue, 28 Jul 2020 19:55:58 +0100 In-Reply-To: <20200724220930.GT32057@gate.crashing.org> (Segher Boessenkool's message of "Fri, 24 Jul 2020 17:09:30 -0500") Message-ID: <87r1sv1nb5.fsf@arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-ClientProxiedBy: LO2P123CA0055.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::19) To DB7PR08MB3594.eurprd08.prod.outlook.com (2603:10a6:10:4e::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from krcb (217.140.106.50) by LO2P123CA0055.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16 via Frontend Transport; Tue, 28 Jul 2020 18:55:59 +0000 X-Originating-IP: [217.140.106.50] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 34e54d7d-eed8-433b-e119-08d83327e233 X-MS-TrafficTypeDiagnostic: DB6PR0802MB2166:|DB6PR0802MB2151: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6108;OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 364u0pXmelYSKggHxUl3f01SafNubfbpyKUA+yKV5RFc/HTCc00qIsNgrvUq++32oHAQ8J71Kgqdsc351MROBlYftmhxB40nC2Nykhh0J3559BULO9xGSCEJyxOpIoNtgWKSmqFwFmtLvRtDTSCZg7b9+mqB1Njzb7vO57KWepqE4kRp4i14E1RQm+0bF6fJWDVPsn24BwptbBoujo/SxujrebLQGYtbiE+YZ9uNY1V7buhXBcOJg/OKhzypLD3LmQ3m5acwkEOof0r2Wis+jvuOCzHED3VVC5e+CriHHFl4NP0h2sWBKzsvkCRh/Of5EZG0nY8hYfph3GvLo9JIbQ== 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)(136003)(366004)(376002)(346002)(39860400002)(396003)(8936002)(478600001)(6496006)(52116002)(36756003)(2906002)(8676002)(2616005)(44832011)(316002)(83380400001)(86362001)(6486002)(16526019)(186003)(66946007)(5660300002)(66556008)(66476007)(956004)(4326008)(26005)(6916009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: x9L7Y5WYbq7bdKhEKLriCdbjcGIR1k6K87qnpgfs1bB1Qm1rvbo2/oAzzbD6bqcPRDZZgKBtwz0qSY3+6V3YzcyC39dZlTm6+6VT9x6SAZ4shZ6YwmyEUDmblaii/VrC9oXwOoGJelU8gQrvZwfr8ULgLqMUDTX4PN6Hoxm6j2b6f+eUwJDuPli2SthxpqAWapRlZZdm2Zk/XAnCG3kleXJ6JbkBPDeCQ8peRliw2PaB4N+4c1cRrdJwlyYjFoYx2ngWyJaPCJA6thA6CePti6cE+TLi2EiqBevmBMA66u5N2G5ojnW3s891+w6LWPIyRTB8xxBQx4T9f69/oto98E5guBkjFNOb+G7LcAClBe8gQQTmGdBycbOMhDsYV1D9NIGIs2TJaL+Ml+qJXGx4rmlelQolAmJqpYQHXlts0zokttACjk+EbzTuhwLdZRqwkWg30/TR0cizixnTnQvIsxcEpDvLZM5r95Rzhf/QCD8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2166 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: fe38fee9-7fe2-4d5c-4820-08d83327ddf8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fyfaraTqGfKOxZm/CKhuZllreKX09nOX78wjZ5aZ2pyb723nbmnBa+2ozJLyWIN/pgnDTzlPSQModBlWpYl9tPr43dEYKQMLq5BM4yUxa7UXkesExsYr1wx097KYORTxoM+6dx19AVr09B96JUa0g8N8POTW7f5kz+4kd9heKJvLcLqiobAmwGvVqF78Hgm05vWqwgm4Kre0t0+eQNkyPp76LmQPFUA7EiPLIwT2994OspeXv/hKL3dMnPRfBP9kC/nkPb8qnel0oSiRRkdjmGWruuwRi92sbyaveO610rtr3xipKS7786f+ZHl2p62BX+sBWQrXDqLofqkCLqhShuTP/iiB4L6J6/774rN3FXgMNaHviH9em/LHRAFXciOgeRsEvS8eXeU92P1H3F721g== 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)(39860400002)(376002)(136003)(396003)(46966005)(8936002)(44832011)(186003)(70586007)(2616005)(26005)(16526019)(70206006)(86362001)(956004)(6496006)(478600001)(36756003)(6862004)(336012)(83380400001)(82310400002)(5660300002)(47076004)(6486002)(82740400003)(81166007)(316002)(356005)(2906002)(8676002)(4326008)(36906005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 18:56:06.3597 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34e54d7d-eed8-433b-e119-08d83327e233 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: VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2151 X-Spam-Status: No, score=-10.4 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: Tue, 28 Jul 2020 18:56:12 -0000 Segher Boessenkool writes: > Hi! Hi Segher, > [ Btw, the mailing list archive will not show your attachments (just lets > me download them); naming the files *.txt probably works, but you can > also use a sane mime type (like, text/plain) ]. [ Sure can do it np, I'm just less sure if text/x-diff is such and insane mime type for a mailing list software :) ] > On Wed, Jul 22, 2020 at 12:09:08PM +0200, Andrea Corallo wrote: >> this second patch implements the AArch64 specific back-end pass >> 'branch-dilution' controllable by the followings command line options: >> >> -mbranch-dilution >> >> --param=aarch64-branch-dilution-granularity={num} >> >> --param=aarch64-branch-dilution-max-branches={num} > > That sounds like something that would be useful generically, even? > Targets that do not want to use it can just skip it (that probably should > be the default then), via setting the granularity to 0 for example. > >> Observed performance improvements on Neoverse N1 SPEC CPU 2006 where >> up to ~+3% (xalancbmk) and ~+1.5% (sjeng). Average code size increase >> for all the testsuite proved to be ~0.4%. > > Can you share a geomean improvement as well? Also something like 0.4% > is sounds like, or is it more? After my first measure I was suggestted by a colleague a less noisy system to benchmark on and a more reproducable methodology. I repeated the tests on N1 with the following results: | Benchmark | Est. Peak Rate ration | | | diluted / baseline | |----------------+-----------------------| | 400.perlbench | 1.018x | | 401.bzip2 | 1.004x | | 403.gcc | 0.987x | | 429.mcf | 1.000x | | 445.gobmk | 0.998x | | 456.hmmer | 1.000x | | 458.sjeng | 1.008x | | 462.libquantum | 1.014x | | 464.h264ref | 1.004x | | 471.omnetpp | 1.017x | | 473.astar | 1.007x | | 483.xalancbmk | 0.998x | I was explained xalanc tend to be very noisy being memory bound so this explains the difference, not sure why sjeng looks less good. The overall ratio comparing spec rates is +~0.44%. >> - Unconditional branches must be the end of a basic block, and nops >> cannot be outside of a basic block. Thus the need for FILLER_INSN, >> which allows placement outside of a basic block > > But the new rtx class is recognised in just one location, so it could > recognise it on any other characteristic easily. Make sense, unless in the future this changes, but probably is not worth taking this in account now. >> --- /dev/null >> +++ b/gcc/testsuite/gcc.target/aarch64/branch-dilution-off.c >> @@ -0,0 +1,57 @@ >> +/* { dg-do compile } */ >> +/* { dg-options "-O1 -mcpu=cortex-a72 --param case-values-threshold=50" } */ >> +/* { dg-final { scan-assembler-not "\\s*b.*\n\\snop\n" } } */ > > You can write this simpler as > > /* { dg-final { scan-assembler-not {\s*b.*\n\snop\n} } } */ > > which shows a problem in this more clearly: . will match newlines as > well. Also, starting a RE with (anything)* does nothing, "anything" is > allowed to match 0 times after all. You probably meant the "b" should > start a mnemonic? > > /* { dg-final { scan-assembler-not {(?n)\mb.*\n\snop\n} } } */ > > (\m is a zero-width start-of-word match, like \< in grep; (?n) means . > does not match newlines (if you know Perl, it turns /m on and /s off -- > the opposite of the defaults for Tcl). > > (or you could do [^\n]* or even just \S* , no (?n) needed then). > > > Segher Thanks for the feedback! Andrea