From patchwork Mon Oct 23 17:42:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 829534 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464881-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="YAHpJLg/"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLNzQ4Qd8z9t6Y for ; Tue, 24 Oct 2017 04:43:14 +1100 (AEDT) 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=LMw0OR7qg/CEeGqllN642zqP05mau AOsqFAhZJlQ4RREn93vT3cr1k+E+zH/ipMG5QORFdeLMdP0fT4uCg0ytxmYhAbK9 SErDpa2zRgBcrsShGTH7ICAB21OyV3zfdIjDAqiQznY3jYahE7yvWR4VPmqnYcUv pzJvnTplh09NjM= 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=/NfZfyUdM5eFvavKYn8LWRGL06k=; b=YAH pJLg/YA0GzuB3tkkeFRtp1K1psjgm/6jLZcqGuejBk7uAjGo+FJz2o3D4qqIAuD8 +sl5gW4e27y3InJNMBf25nE/22vLKYiIHWky48SXoT24VeaOrAbvf4n+9lhtBlas SSBfTsqYLaKtnF1sedVaa0hf8/iayW0Vug2tBM7I= Received: (qmail 1003 invoked by alias); 23 Oct 2017 17:43:01 -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 944 invoked by uid 89); 23 Oct 2017 17:43:00 -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-f44.google.com Received: from mail-wm0-f44.google.com (HELO mail-wm0-f44.google.com) (74.125.82.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:42:59 +0000 Received: by mail-wm0-f44.google.com with SMTP id u138so11391408wmu.4 for ; Mon, 23 Oct 2017 10:42:58 -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=3jtXUrVTno5qrrEaR7KDjKrS43RwfRwl9ttZ11n6g80=; b=B/RBBLNDT/Vd1CuedAKKr1KTn+DJ9t+l5B1FHY6o/6UIFCRjg9TNiULciG3Y4KScsf GxRRESOvQaor/ouwFSjP+g17ZRGLCA5lo2XVykzkmEbzVoVTbgEYqoWHo0VfkbmPXqoP vcoN/+I7XBEKEb2cqywm6JidMUwXlYwQH8itLnEDgkjLzLjlioymx/xFyTF4nF6jzRpE IsdyEDtNA+dUaxXXcqLpji5InmQM0ctqAYOapb5Vzbhal8ACwSxAW9OcTl43m7GCH5cW S8ZBXi+9X+xtFZ8x7c3N4GxLr2dsyvaTf/XMdwDjOGfRx+cL3z9KmFPO3Fo1s7oZ5Q0P Gruw== X-Gm-Message-State: AMCzsaUebkETiay9E9ChmG9c2LtTWeaVRpAqX3tSgmIE82INCDBTVIM7 La82wnOXTJOj+XCQXp7o4sU4uYRS1uI= X-Google-Smtp-Source: ABhQp+RMWltoBFuul0XwlaBZYQE3LuEZ4hyExhYTxCDgbyNMuKAZwE8bTqGPj/68VjrP4XmeEljP6A== X-Received: by 10.28.23.129 with SMTP id 123mr3493290wmx.54.1508780577012; Mon, 23 Oct 2017 10:42:57 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id k13sm4769754wrd.95.2017.10.23.10.42.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:42:56 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [105/nnn] poly_int: expand_assignment References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:42:55 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <877evldalc.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes the CONCAT handing in expand_assignment cope with polynomial mode sizes. The mode of the CONCAT must be complex, so we can base the tests on the sizes of the real and imaginary components. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * expr.c (expand_assignment): Cope with polynomial mode sizes when assigning to a CONCAT. Index: gcc/expr.c =================================================================== --- gcc/expr.c 2017-10-23 17:25:54.178292230 +0100 +++ gcc/expr.c 2017-10-23 17:25:56.086223649 +0100 @@ -5109,32 +5109,36 @@ expand_assignment (tree to, tree from, b /* Handle expand_expr of a complex value returning a CONCAT. */ else if (GET_CODE (to_rtx) == CONCAT) { - unsigned short mode_bitsize = GET_MODE_BITSIZE (GET_MODE (to_rtx)); + machine_mode to_mode = GET_MODE (to_rtx); + gcc_checking_assert (COMPLEX_MODE_P (to_mode)); + poly_int64 mode_bitsize = GET_MODE_BITSIZE (to_mode); + unsigned short inner_bitsize = GET_MODE_UNIT_BITSIZE (to_mode); if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from))) && known_zero (bitpos) && must_eq (bitsize, mode_bitsize)) result = store_expr (from, to_rtx, false, nontemporal, reversep); - else if (must_eq (bitsize, mode_bitsize / 2) + else if (must_eq (bitsize, inner_bitsize) && (known_zero (bitpos) - || must_eq (bitpos, mode_bitsize / 2))) + || must_eq (bitpos, inner_bitsize))) result = store_expr (from, XEXP (to_rtx, maybe_nonzero (bitpos)), false, nontemporal, reversep); - else if (must_le (bitpos + bitsize, mode_bitsize / 2)) + else if (must_le (bitpos + bitsize, inner_bitsize)) result = store_field (XEXP (to_rtx, 0), bitsize, bitpos, bitregion_start, bitregion_end, mode1, from, get_alias_set (to), nontemporal, reversep); - else if (must_ge (bitpos, mode_bitsize / 2)) + else if (must_ge (bitpos, inner_bitsize)) result = store_field (XEXP (to_rtx, 1), bitsize, - bitpos - mode_bitsize / 2, + bitpos - inner_bitsize, bitregion_start, bitregion_end, mode1, from, get_alias_set (to), nontemporal, reversep); - else if (known_zero (bitpos) && must_eq (bitsize, mode_bitsize)) + else if (known_zero (bitpos) + && must_eq (bitsize, mode_bitsize)) { rtx from_rtx; result = expand_normal (from); - from_rtx = simplify_gen_subreg (GET_MODE (to_rtx), result, + from_rtx = simplify_gen_subreg (to_mode, result, TYPE_MODE (TREE_TYPE (from)), 0); emit_move_insn (XEXP (to_rtx, 0), read_complex_part (from_rtx, false));