From patchwork Tue May 17 09:22:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Greenhalgh X-Patchwork-Id: 67933 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1966532qge; Tue, 17 May 2016 02:23:43 -0700 (PDT) X-Received: by 10.98.96.130 with SMTP id u124mr361634pfb.28.1463477023890; Tue, 17 May 2016 02:23:43 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id pk7si3368990pac.166.2016.05.17.02.23.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 May 2016 02:23:43 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-427443-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-427443-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-427443-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=AslBMguUC7Q/x3i5 94b+CrHQLSMdTg5piS7DiBCrbkRr0j0G8S3a5KSLCSRJFxL2zbEkwDnK8hxt+eLK WeIcjJZ3vpWqE9FPWmp9RGW+kLVGglyNE+BgiM/LKmUl60ZT3m2Mkmjszwk83E6s VLZctGVvzzitLnNlOYjZnuFIwkU= 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=8ZArE2Jk6rNx4fZR8WiOcz Y6d7A=; b=EKXXxOpZFPWf/+49CM2a56CEAk8lXvoL31MPdZnDWyqpdwnPVL8oyj IuBXm/7ZxVHdiAeMZOpP7X7CLKcZNfHaZ6u6V4NfC5v2/Xpsexe/SY2h9y/qTavW QvtX+S5kze14J0lxlwheybxIkRp0uM4+HxpX0IQ4ZkIWpKD4oI7pg= Received: (qmail 62066 invoked by alias); 17 May 2016 09:23:17 -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 61151 invoked by uid 89); 17 May 2016 09:23:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:135, H*RU:135, HX-Exchange-Antispam-Report-CFA-Test:102415293, HX-Exchange-Antispam-Report-CFA-Test:102615271 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 May 2016 09:23:08 +0000 Received: from emea01-db3-obe.outbound.protection.outlook.com (mail-db3lrp0077.outbound.protection.outlook.com [213.199.154.77]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-47-IMk1LMv8RbyFCvFsZJK8GA-1; Tue, 17 May 2016 10:23:03 +0100 Received: from DB6PR0801CA0001.eurprd08.prod.outlook.com (10.165.173.139) by AM2PR08MB0532.eurprd08.prod.outlook.com (10.163.149.142) with Microsoft SMTP Server (TLS) id 15.1.497.12; Tue, 17 May 2016 09:23:01 +0000 Received: from AM1FFO11FD031.protection.gbl (2a01:111:f400:7e00::135) by DB6PR0801CA0001.outlook.office365.com (2603:10a6:4:2::11) with Microsoft SMTP Server (TLS) id 15.1.497.12 via Frontend Transport; Tue, 17 May 2016 09:23:01 +0000 Received: from nebula.arm.com (217.140.96.140) by AM1FFO11FD031.mail.protection.outlook.com (10.174.64.220) with Microsoft SMTP Server (TLS) id 15.1.497.8 via Frontend Transport; Tue, 17 May 2016 09:23:01 +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; Tue, 17 May 2016 10:22:45 +0100 From: James Greenhalgh To: CC: , , , Subject: [Patch AArch64 2/2] Some more cleanup of ldp/stp generation Date: Tue, 17 May 2016 10:22:31 +0100 Message-ID: <1463476951-1567-3-git-send-email-james.greenhalgh@arm.com> In-Reply-To: <1463476951-1567-1-git-send-email-james.greenhalgh@arm.com> References: <1463476951-1567-1-git-send-email-james.greenhalgh@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:CAL; SCL:-1; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(2980300002)(438002)(189002)(377424004)(199003)(33646002)(2906002)(5008740100001)(104016004)(450100001)(5003600100002)(87936001)(19580405001)(19580395003)(5000100001)(92566002)(512874002)(4610100001)(229853001)(2351001)(36756003)(106466001)(86362001)(50986999)(76176999)(189998001)(586003)(84326002)(568964002)(8676002)(8936002)(4326007)(50226002)(5890100001)(11100500001)(6806005)(2476003)(1220700001)(110136002)(77096005)(2950100001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR08MB0532; H:nebula.arm.com; FPR:; SPF:Pass; MLV:ovrnspm; MX:1; A:1; PTR:fw-tnat.cambridge.arm.com; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD031; 1:dxZNXu1B2lPA3VFU3HuL94CioBrNMgNk1xRpDn7pEx2EGkO7lGTr61382KwWa4yjCmKhOdiFCSC8piNhBFHZjvqS2qVjOXcabiLNipnkK6SavmyaLXYL5LZ8kJrBJociTne5+4nySGzya27iTvz7Tm0yDjCbxvwq8sAIA/9mQkKn9NIfFD/gxbgtRdmiwI5PEg2QUIgePcMZCGHqRUDYfcsSwD34oQ7otsUGSsdTgqBMTGwS0ypnURnbmYcorux3BC0h+oC2Anh5tm40j4ZkxBLA9Ioxx0sm6T7YyLNhCSBqH2ncUEpdESTcBQa05I9J0Et1YoU/l4kwf+d4Fq3eLxr1IEvWHLz9lOaXbbLy+4WHaD8cVm1JhF8YRkM6s5/61BkvZczd9Y4Q9ZlDHycJhV9P8DzG+QMDg8XvFitGplq2NA+pZt0lohLHoqWKWcB/1+AXW/9s2/tpcD1gIdwRrHyWGptrYjc/1gw2cMHTs0Ehf/u2y4x+qQ1e2jtB+Y6e X-MS-Office365-Filtering-Correlation-Id: 09287e3b-244b-42c1-a442-08d37e34d7f3 X-Microsoft-Exchange-Diagnostics: 1; AM2PR08MB0532; 2:HyA0HnueJkt8wZpgRTtiTpvhfQSYjC/3caJYc0fWk6f7RxG6UeNKR9RFnXIvrPDaXjLasNXkOWYgG1pbmzergiYm/cQV8a0J0SinxqAYDVErHB4nVqaZp52mwa6ZgRwi42A543Fw65HQp/dt9xnnC2zmUJG7a6wSAFmK9MQnbVsaiGgoR38cnm+IeR5ROGCB; 3:zCLzwFttO2TzOVa3ui8koY7w3Blu2rdPXouu/H6FuNO5qsxgpeKpGULppx8zALCpT1LHCy7Shv15O5RMRWuo+Q0MTedY63vXcwgrQA4ikEAwnpMaJTa23aGCPiyD7YmOuHjcAKtTJvGLakMmUzh2YZogxSe1fJieIEzayLrZdK6ChFQUllhL5X897zlqYIaBhxtujK+mAN1N/tqdInE5vZBtEBJY/xvaMXMRJFTbOEqSv5Cp6Adgi7gd+PhDZVfAEtyAy+HABLxFCUb4XEBu6Q== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:AM2PR08MB0532; X-Microsoft-Exchange-Diagnostics: 1; AM2PR08MB0532; 25:mHMcOpW4OS4Hn0CHhQnAFWS34TEe5p1pM3iWZIgmcepE2KBMXRLNXhR/FC9WHpWOH6WcXEZC2LF0BbFZQfU34nobmRcK713IXOGTc70Ipy8bHXZlJ8naEFsiMM9L4+JNEz33s33GMwguOtEHACoMQfWdXQ5noh/WrICvZnAjPDFZ9IJDp7I/j3cjuJP9BHNvOexQKKUJJDFbWZoyTaMYZKDgAwawLsOQRGuY/DVL5k0zi/yuV8IMpZEmJr8gIbbA8233rftD4K2hJ4w99bFy0WYJxCtIUjVQ/j1d3DjPkilEcxBYXLlts3wIFUDvpeihwVyx6KUgm7kENK2mlRXztg6p+noVaDyjqnvnOdbZ0nr3LN1IzQaNkiicnR1+/2FDb5AGmQ22WOX8VuSELs991otjweXHr1isfQ8r4osSIlUrJRwT+FCV3fTjSfNhwwg81+hRmqVjqHH0z61zJ59BMM4rrPPcRdOnKvqd+Qr33boQ/5QUPsAX9BBmAlgfENt+; 20:mucJfRRc8c9nkitH6uPG+BnJiUVSkWWcaSTy0Obi0AxykJOh8Gl0nQZ4nsXWfHH4KsuY/a8/zEk5w6APoJFPfG4+nmrQhUloCFNyXQp3pjCD7piE154k1u42RNFg289pXKoblUHEPsnlAqlEm3btH1bPk2VQeUoTQydVi2J5OVLj4u8pEhVgl0n2B6U45YGpjkq/hDeguxgLJAujil0YD6K35FzkGalFr72usVHWpVEGnSP3Z+TS1ETn9BYXUcbS NoDisclaimer: True 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)(13023025)(13024025)(13013025)(13020025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:AM2PR08MB0532; BCL:0; PCL:0; RULEID:; SRVR:AM2PR08MB0532; X-Microsoft-Exchange-Diagnostics: 1; AM2PR08MB0532; 4:ri6cxvUBFORh8a/6ytjgnw7ByAyHaIPUF8+W1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P/7idbQP/H2ZehXIP8L2816wO?= =?us-ascii?Q?MakG9h1DI1I6hTu4S4Ix5JlIXTlNTIO9ba6XSYXZGlYAQfGsQ/W0vaDlX23W?= =?us-ascii?Q?4EpgEfh4cnNoOgZ9b7wO+vTVKfcEvYy2rn3Kky74qW2xVHduPQWdfJspHwo7?= =?us-ascii?Q?Jqi8eMLQQaxe/S4swQEpqPmPTxibIXx3sr3FZkFWUc8FBOT1nRRAMMb4JgZj?= =?us-ascii?Q?g/d6UFZ9NM2/B9Uwveh68tWzOXw8am88P5XFwkHyzUCHmmSk1yv4KEnxcfLx?= =?us-ascii?Q?msWM2K5z2OSAczjP1G17LodmzcNQwc4d6fVtutwQd9u/+c0qyjBV0XZvULnO?= =?us-ascii?Q?Twwo6zSzcbHHe1FP42lcYK50fJxAVdrPo81D7Kl7SkdD37zIMrxvbsTidk2N?= =?us-ascii?Q?WnaT10qe/KJQTJ918d2HYrDySMgNxYQ6FPM7hENne7Hc5Zc0za1X+nNGtmS7?= =?us-ascii?Q?NffvTjP9a9fLrBdNjEVyO4GZtfCEf663wAEXUzsJgccAqYs9A+QxCuL9i+aD?= =?us-ascii?Q?2gUCmuYocFIvjuzxBR4QPPdliVcfjZD7bhn6SRfOrQkF+jKkOJXm/7tlDoCB?= =?us-ascii?Q?kSDpAGO4FnfO/u48gM0mKS2p8nvVFJPxdbl6ZAOJjXXnIqf+fJrGSu9aNNXF?= =?us-ascii?Q?tVApyFzJFJW/x+owUc/Wn44hSIuLkaw872Z4IGxPYsxzp2v9+rjPgnFFxaWk?= =?us-ascii?Q?7gl7+XSp1JkgNWWE6GsDpenJFS3yvwujYRbF/Pj52WmOdYCRasMulU23FXNc?= =?us-ascii?Q?i6ebDKIGC8/gu/CXToDhgVPkMi14mRXnT0a?= X-Microsoft-Exchange-Diagnostics: 1; AM2PR08MB0532; 5:irzlDVJi2TJm5c83cv8XkW5KwiFT743BOpjT843Ab5q/8R5EV1UcgINN1RrST1bxSgbdI8EIDETpyvObUjS0VpXufgEydOrmSegMegV3oYxGZCF104NDdbcC7/e8rGz6qMA/e0Yk0ieS/dVTe/q+4w==; 24:aRaLSZtHhbpVQKb6z7IaJdYqr7nizg0Vb2bzKZEU4IMoQS0/Llo2sEf5Atbx0LwSAdIMoEOjVRtPsuomjVilEN3yInFj34fedw48vOHb/ak=; 7:VkK4pzREnoJXrjUZtF4KrQZObEmsUvJ8ARxVf1qzTOgQTRHkaviqbpzgiK2ntUZhEpNHFB9Bv5hNicHehX/R50zLDygmPbVXqb+DVz+ZfJ8qGhCA/oFJDf/qZiEj+7m8uou73P4gfXsSgOWyiGrAGXhTNpDm95n5nVHnivrPCVd69OjSjAkCkvsXqziVNWgQ; 20:HRLpWTkD3glarIDHhNRtqsjYQGRr6amxm2kI+jWVEzjeJyDjcLmOpCQXlFkV6LRz+9f9d2avO2Z+wj5urfgcaeQxeEVtUKjKnppwDG4txN/P5qDnG6nBuhqTbyRFy0YTcf4huwBKqyMpRQEwtu7e+r9SnCc2ZJYSrbEWIWVqZ+Y= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2016 09:23:01.3499 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR08MB0532 X-MC-Unique: IMk1LMv8RbyFCvFsZJK8GA-1 X-IsSubscribed: yes This is another refactoring patch to clean up more of the ldp/stp handling code and avoid duplicating quite as much code. Much like the other refactoring patch, this reduces the use of reg_1, reg_2, etc. leading to a cleaner implementation. Bootstrapped on AArch64 with no issues. OK? Thanks, James --- 2016-05-17 James Greenhalgh * config/aarch64/aarch64.c (aarch64_gen_adjusted_ldpstp): Refactor. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 434c154..01bbe81 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -13549,26 +13549,18 @@ aarch64_gen_adjusted_ldpstp (rtx *operands, bool load, enum machine_mode mode, RTX_CODE code) { rtx base, offset, t1, t2; - rtx mem_1, mem_2, mem_3, mem_4; + rtx mem[4]; HOST_WIDE_INT off_val, abs_off, adj_off, new_off, stp_off_limit, msize; - if (load) - { - mem_1 = operands[1]; - mem_2 = operands[3]; - mem_3 = operands[5]; - mem_4 = operands[7]; - } - else - { - mem_1 = operands[0]; - mem_2 = operands[2]; - mem_3 = operands[4]; - mem_4 = operands[6]; - gcc_assert (code == UNKNOWN); - } + unsigned op_offset = load ? 1 : 0; + + for (int i = 0; i < 4; i++) + mem[i] = operands[(2 * i) + op_offset]; - extract_base_offset_in_addr (mem_1, &base, &offset); + if (!load) + gcc_assert (code == UNKNOWN); + + extract_base_offset_in_addr (mem[0], &base, &offset); gcc_assert (base != NULL_RTX && offset != NULL_RTX); /* Adjust offset thus it can fit in ldp/stp instruction. */ @@ -13597,59 +13589,32 @@ aarch64_gen_adjusted_ldpstp (rtx *operands, bool load, } /* Create new memory references. */ - mem_1 = change_address (mem_1, VOIDmode, - plus_constant (DImode, operands[8], new_off)); + mem[0] = change_address (mem[0], VOIDmode, + plus_constant (Pmode, operands[8], new_off)); /* Check if the adjusted address is OK for ldp/stp. */ - if (!aarch64_mem_pair_operand (mem_1, mode)) + if (!aarch64_mem_pair_operand (mem[0], mode)) return false; msize = GET_MODE_SIZE (mode); - mem_2 = change_address (mem_2, VOIDmode, - plus_constant (DImode, - operands[8], - new_off + msize)); - mem_3 = change_address (mem_3, VOIDmode, - plus_constant (DImode, - operands[8], - new_off + msize * 2)); - mem_4 = change_address (mem_4, VOIDmode, - plus_constant (DImode, - operands[8], - new_off + msize * 3)); - - if (code == ZERO_EXTEND) - { - mem_1 = gen_rtx_ZERO_EXTEND (DImode, mem_1); - mem_2 = gen_rtx_ZERO_EXTEND (DImode, mem_2); - mem_3 = gen_rtx_ZERO_EXTEND (DImode, mem_3); - mem_4 = gen_rtx_ZERO_EXTEND (DImode, mem_4); - } - else if (code == SIGN_EXTEND) - { - mem_1 = gen_rtx_SIGN_EXTEND (DImode, mem_1); - mem_2 = gen_rtx_SIGN_EXTEND (DImode, mem_2); - mem_3 = gen_rtx_SIGN_EXTEND (DImode, mem_3); - mem_4 = gen_rtx_SIGN_EXTEND (DImode, mem_4); - } - if (load) - { - operands[1] = mem_1; - operands[3] = mem_2; - operands[5] = mem_3; - operands[7] = mem_4; - } - else - { - operands[0] = mem_1; - operands[2] = mem_2; - operands[4] = mem_3; - operands[6] = mem_4; - } + for (int i = 1; i < 4; i++) + mem[i] = change_address (mem[i], VOIDmode, + plus_constant (Pmode, + operands[8], + new_off + (msize * i))); + + for (int i = 0; i < 4; i++) + if (code == ZERO_EXTEND) + mem[i] = gen_rtx_ZERO_EXTEND (Pmode, mem[i]); + else if (code == SIGN_EXTEND) + mem[i] = gen_rtx_SIGN_EXTEND (Pmode, mem[i]); + + for (int i = 0; i < 4; i++) + operands[(2 * i) + op_offset] = mem[i]; /* Emit adjusting instruction. */ - emit_insn (gen_rtx_SET (operands[8], plus_constant (DImode, base, adj_off))); + emit_insn (gen_rtx_SET (operands[8], plus_constant (Pmode, base, adj_off))); /* Emit ldp/stp instructions. */ t1 = gen_rtx_SET (operands[0], operands[1]); t2 = gen_rtx_SET (operands[2], operands[3]);