From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60479 invoked by alias); 6 Sep 2016 13:15:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 60441 invoked by uid 89); 6 Sep 2016 13:15:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=BLKmode, blkmode, Hx-languages-length:1710, H*MI:outlook X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Sep 2016 13:14:57 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03lp0088.outbound.protection.outlook.com [94.245.120.88]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-8-kIi0zRZpPTCWurBF2c-dEQ-1; Tue, 06 Sep 2016 14:14:53 +0100 Received: from AM5PR0802MB2610.eurprd08.prod.outlook.com (10.175.46.18) by AM5PR0802MB2610.eurprd08.prod.outlook.com (10.175.46.18) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Tue, 6 Sep 2016 13:14:52 +0000 Received: from AM5PR0802MB2610.eurprd08.prod.outlook.com ([10.175.46.18]) by AM5PR0802MB2610.eurprd08.prod.outlook.com ([10.175.46.18]) with mapi id 15.01.0609.013; Tue, 6 Sep 2016 13:14:52 +0000 From: Wilco Dijkstra To: GCC Patches CC: nd Subject: [PATCH][AArch64] Improve legitimize_address Date: Tue, 06 Sep 2016 13:31:00 -0000 Message-ID: x-ms-office365-filtering-correlation-id: cf6f9532-f8ea-46fc-5e7a-08d3d657ca10 x-microsoft-exchange-diagnostics: 1;AM5PR0802MB2610;20:DyMHc04fI6Ir7ij9ALBKXEwqmdD/o08PoZV6/rWc7bfgrBO/jjYNGZAALBNB4e7Kf+oo+cLrlHPl8+wuw+BPhfjpLpoNifsi9vR5uAdnhoY22njvbBGWqd3ChBswWz8Vpli52wYarkyIMPTILM/nZJMbFnvhMNFaCz96LwoQ9gQ= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0802MB2610; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026);SRVR:AM5PR0802MB2610;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0802MB2610; x-forefront-prvs: 0057EE387C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(54534003)(377424004)(199003)(189002)(19580405001)(19580395003)(81166006)(8936002)(5002640100001)(81156014)(77096005)(122556002)(50986999)(101416001)(54356999)(3280700002)(8676002)(7736002)(575784001)(7696003)(86362001)(450100001)(3660700001)(7846002)(4326007)(5660300001)(2906002)(10400500002)(11100500001)(586003)(3846002)(74316002)(102836003)(6116002)(97736004)(92566002)(229853001)(76576001)(87936001)(9686002)(33656002)(68736007)(189998001)(66066001)(106116001)(305945005)(106356001)(105586002)(2900100001)(110136002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0802MB2610;H:AM5PR0802MB2610.eurprd08.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2016 13:14:52.9580 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2610 X-MC-Unique: kIi0zRZpPTCWurBF2c-dEQ-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2016-09/txt/msg00303.txt.bz2 Improve aarch64_legitimize_address - avoid splitting the offset if it is supported. When we do split, take the mode size into account. BLKmode falls into the unaligned case but should be treated like LDP/STP. This improves codesize slightly due to fewer base address calculations: int f(int *p) { return p[5000] + p[7000]; } Now generates: f: add x0, x0, 16384 ldr w1, [x0, 3616] ldr w0, [x0, 11616] add w0, w1, w0 ret instead of: f: add x1, x0, 16384 add x0, x0, 24576 ldr w1, [x1, 3616] ldr w0, [x0, 3424] add w0, w1, w0 ret OK for trunk? ChangeLog: 2016-09-06 Wilco Dijkstra gcc/ * config/aarch64/aarch64.c (aarch64_legitimize_address): Avoid use of base_offset if offset already in range. -- diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 27bbdbad8cddc576f9ed4fd0670116bd6d318412..119ff0aecb0c9f88899fa141b2c= 7f9158281f9c3 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5058,9 +5058,19 @@ aarch64_legitimize_address (rtx x, rtx /* orig_x */= , machine_mode mode) /* For offsets aren't a multiple of the access size, the limit is -256...255. */ else if (offset & (GET_MODE_SIZE (mode) - 1)) - base_offset =3D (offset + 0x100) & ~0x1ff; + { + base_offset =3D (offset + 0x100) & ~0x1ff; + + /* BLKmode typically uses LDP of X-registers. */ + if (mode =3D=3D BLKmode) + base_offset =3D (offset + 512) & ~0x3ff; + } + /* Small negative offsets are supported. */ + else if (IN_RANGE (offset, -256, 0)) + base_offset =3D 0; + /* Use 12-bit offset by access size. */ else - base_offset =3D offset & ~0xfff; + base_offset =3D offset & (~0xfff * GET_MODE_SIZE (mode)); =20 if (base_offset !=3D 0) {