From patchwork Mon Oct 23 17:39:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116841 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4902379qgn; Mon, 23 Oct 2017 10:39:30 -0700 (PDT) X-Received: by 10.101.82.1 with SMTP id o1mr12148383pgp.261.1508780370205; Mon, 23 Oct 2017 10:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508780370; cv=none; d=google.com; s=arc-20160816; b=Ob9hicbXX9hyH6DGtn90wUM+CupGOB/Tzx6FYcXk8rwiYdgtxmIyJDWKa6g0B43ybQ wBdsjNuhydPYAHYKGCKj838QKJ5hux0xDzAzJL/r9WVL2lJ/5UUs2xr8tv7M2AdeRibF +BII8IPdaeEkJ72sb9kEigt3jCgmLA825Hb9JLBxCJIyqO4SjuAwvRR1vDLgpzd2fJbr sfGzS9u0qBclnRBkcQmLqapLZ3mW3IX0B8KuaL/dQsxP9CrUnd6R3oF7/mC3ysr81I/s HXsilKVUXoVHh+B7aOlZl+hXdYAwPKYYPIZtGAPCOgkCwJSFC2ElqEBKCFb0DljKmLHQ ev1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=JX7XHqw81Lhfv5ja4+1SO655PV2g2Tpy90m0C3RB+Fw=; b=M5NNO8NZ1HIg7h23fAHSgPiIZ07xCkJW4S0uy3PqCZ9liofM1qDXOba+eiKtHilQYF VTnp/ybC+XjtmVoQBAL8sDSue/xzsbwoimLy0XzoFOXRRdzOKca646/JwTADl3lWYcWS UmQwrD6WiDluk5fJKtjIpnUTTruCx0RHdqiPKEK+vbBbWdY0+x9quIN+dcmNYLTR6gQY KtxYSY8y5BZHfueeREZhr55oQ5L0NfRkqEoj784hr/esHm348BIwLZayQExGkRZcjSLn gInAD2wildiPvhOGvDj7RFu7knxln/9dBDIE2S3Z21idcSSwQl+GkvuOVHS1PFqEwPUy Z/rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=DtZ7WiE4; spf=pass (google.com: domain of gcc-patches-return-464872-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464872-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id o3si4272352pld.317.2017.10.23.10.39.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:39:30 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464872-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 header.s=default header.b=DtZ7WiE4; spf=pass (google.com: domain of gcc-patches-return-464872-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464872-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.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:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=vmjp+Bn/P5ChORlbhfDf1G63TppZt AEHAV14kB1XCrDZc+IzweuXBBcfYiEvF5gFJ/XLtbynlPlRJ0VKNSl1/Q/9cOHZE TtaFihZagGFqtkkTEUhWnYyc9HQKHafDnY9X99p+Np5+VSp+AKKIhBbxYk7f+sYu RztozQDSLHkO/E= 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=GRgsV/dhcdCuAfmU8gOLFuvWJ/8=; b=DtZ 7WiE4p6ApguDnQDrOz+nnEiF5Pu7eoZoESpVore4v4cnTW5KzVxyY2i0q24GYfz+ WmfGNuo/aDDy2X5ON33LwKBuwGjyB7Iv580U/F2lq16xvLRCm55plVizcTSYYXBU CYUWuCdcq9811ohoDKMgAJJykcy1AxiyOBdXIRRI= Received: (qmail 114859 invoked by alias); 23 Oct 2017 17:39:14 -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 114842 invoked by uid 89); 23 Oct 2017 17:39:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:39:13 +0000 Received: by mail-wm0-f48.google.com with SMTP id 196so9351015wma.1 for ; Mon, 23 Oct 2017 10:39:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=JX7XHqw81Lhfv5ja4+1SO655PV2g2Tpy90m0C3RB+Fw=; b=aI8rKta3FTjPiqlkXzqQMVKPQUbu4deH0QK19wokrB82cHG7S+1vR8ReG5LYgpxajg YlkeL3hpie4eyiR+2VKTLKMxBt+mOFVvyP96Au9Qw9O5COmaY/fqSECbi+PRUgi9EEax ptRGuZMI5euCb+RL3m8YyvxJQEl3uBbDySJEiMMLoWfaMdXts2FjnaFYGuWEfHPJsWZl erEdrV5lO9fko0JD+t1Mxn7qztQ2xd3ZodGU7V7yzRrh4XaH+sgrabLPB5zHlsytq7xW QfX6mN+6yksPjtOzOMamaW5Ly1Z9wLGhAgT8hgmgpGrK+sH/Y3Kai2Nt1Gepb04ZBwdt WqCQ== X-Gm-Message-State: AMCzsaX+vgCFm/qDUDADiwnTpT3S4GINCqKs4n4PVHCqBirGjFR1SFWV pGmtoPYsnz0DbPpfThOjkbAM+5NM6o4= X-Google-Smtp-Source: ABhQp+S8g4EQatN8+jw6Mh2z6cN+rHtWQO/YykATMXGoGvrK3y4go0ph9R+DGy/uUo6L4Z5t7M5ogQ== X-Received: by 10.28.71.67 with SMTP id u64mr3323436wma.48.1508780350778; Mon, 23 Oct 2017 10:39:10 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id c4sm4103391wre.57.2017.10.23.10.39.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:39:10 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [096/nnn] poly_int: reloading complex subregs References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:39:09 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87a80hepc2.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch splits out a condition that is common to both push_reload and reload_inner_reg_of_subreg. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * reload.c (complex_word_subreg_p): New function. (reload_inner_reg_of_subreg, push_reload): Use it. Index: gcc/reload.c =================================================================== --- gcc/reload.c 2017-10-23 17:18:51.485721234 +0100 +++ gcc/reload.c 2017-10-23 17:25:43.543674491 +0100 @@ -811,6 +811,23 @@ find_reusable_reload (rtx *p_in, rtx out return n_reloads; } +/* Return true if: + + (a) (subreg:OUTER_MODE REG ...) represents a word or subword subreg + of a multiword value; and + + (b) the number of *words* in REG does not match the number of *registers* + in REG. */ + +static bool +complex_word_subreg_p (machine_mode outer_mode, rtx reg) +{ + machine_mode inner_mode = GET_MODE (reg); + return (GET_MODE_SIZE (outer_mode) <= UNITS_PER_WORD + && GET_MODE_SIZE (inner_mode) > UNITS_PER_WORD + && GET_MODE_SIZE (inner_mode) / UNITS_PER_WORD != REG_NREGS (reg)); +} + /* Return true if X is a SUBREG that will need reloading of its SUBREG_REG expression. MODE is the mode that X will be used in. OUTPUT is true if the function is invoked for the output part of an enclosing reload. */ @@ -842,11 +859,7 @@ reload_inner_reg_of_subreg (rtx x, machi INNER is larger than a word and the number of registers in INNER is not the same as the number of words in INNER, then INNER will need reloading (with an in-out reload). */ - return (output - && GET_MODE_SIZE (mode) <= UNITS_PER_WORD - && GET_MODE_SIZE (GET_MODE (inner)) > UNITS_PER_WORD - && ((GET_MODE_SIZE (GET_MODE (inner)) / UNITS_PER_WORD) - != REG_NREGS (inner))); + return output && complex_word_subreg_p (mode, inner); } /* Return nonzero if IN can be reloaded into REGNO with mode MODE without @@ -1064,12 +1077,7 @@ push_reload (rtx in, rtx out, rtx *inloc /* The case where out is nonzero is handled differently in the following statement. */ && (out == 0 || subreg_lowpart_p (in)) - && ((GET_MODE_SIZE (inmode) <= UNITS_PER_WORD - && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (in))) - > UNITS_PER_WORD) - && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (in))) - / UNITS_PER_WORD) - != REG_NREGS (SUBREG_REG (in)))) + && (complex_word_subreg_p (inmode, SUBREG_REG (in)) || !targetm.hard_regno_mode_ok (subreg_regno (in), inmode))) || (secondary_reload_class (1, rclass, inmode, in) != NO_REGS && (secondary_reload_class (1, rclass, GET_MODE (SUBREG_REG (in)),