From patchwork Mon Oct 23 17:35:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116833 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4899150qgn; Mon, 23 Oct 2017 10:35:46 -0700 (PDT) X-Received: by 10.98.93.148 with SMTP id n20mr13638958pfj.247.1508780146902; Mon, 23 Oct 2017 10:35:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508780146; cv=none; d=google.com; s=arc-20160816; b=Qtwa6JBUbOd9S200RSQFAZm25amfIGr220nP/zg8TcFNMus/Jp5yq5WJnUS8XYmCkH HbAGDNyefCgpGFLqRZFBr8dmgQ30NvgeFJEuI48AOyTcshREqTuNqzRBLdQEPzy0U2Nn jNIjQwSLfIWcHU+2Eyx8YwOLGW0fzKWdshlr2KQoV5e++tPROsXV6sK2i+L1pXC/EpHk vXAfAZRU6aljx6OQ44MBOx+BPEsUpNN51EtMxQGPl7rBPLY35xifj1WKd4XQRK7VjcaJ ofvDWghtxWdhH4NXA8ltoSIof6V6+dX/vVrqgDhhYiTaXO1C4qQ7pPe2bNOsgIRnJQHs KIIw== 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=fVtXXw3q+l0nC3AcGIHSzRKw4gfHCXnMzqHN71s011k=; b=zidTlP7lz6mK/wyVr15xOkMsdH1wXzW6t0mNrhsc732PI/YqgHr1ByDA9vdIujVHDT YuyBV5AknN+ltpYkeSfvW7FeugIFTzUWOtdrQ1cvl9g4iOFcMNfqeMdtF1v96ctq1bMw AX9/xGwEI8tIj8Sc6RHDh12Eznw9mMIMIn+Ey7mI1BP+r7NiVBG8ipk4fWS6PtbORcGA 7MyPKV9f+0q+w+Dl6k5hblbdZE1Nevize0x9lRRg503cdOlOmVwTbJk6YtV88f+30D20 8ZUhVWWTpnGYgf7SNRCTCFgw4jDBfyNV7nu5nrvJzbKRoecXqoUmhcjvRU9PZP0ec9Bv mO3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ndScT7Xk; spf=pass (google.com: domain of gcc-patches-return-464864-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464864-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 e7si5149818pgt.626.2017.10.23.10.35.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:35:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464864-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=ndScT7Xk; spf=pass (google.com: domain of gcc-patches-return-464864-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464864-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=SDMJjuMtpxhEkEsv07JZvfGT6mGsY arXtbLaJHchraLpFZpuroJxxs7goGlOOo6CsSxD3VxK9gRO2FtUFhhxhgiFVSghH rJ2eOJ78yAjLwr/Enf1v3+QkT2yuSXcBidPmgCP19EbazY2GLVR9R3jrtWI1Hp44 Wa3tQupFQquygs= 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=J7MZX+sSLFAuwAq+e+5BNquEGgg=; b=ndS cT7Xk2ogY64gFT7LUh19W3atIjTo3WjaWQf4GrJeOd+RSMjgVMOOGkMM46QIYo0j 09Yhe1JhDHsqcdiYtyxVYcuaQwfqt5wrFuQf7Jajm3TCvBn2vwzVpMN08iqewbSy 0huJbE/HCZgGkqOlbad/AgMxmFiShOTav8hdPWJg= Received: (qmail 65909 invoked by alias); 23 Oct 2017 17:35:32 -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 65891 invoked by uid 89); 23 Oct 2017 17:35:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f49.google.com Received: from mail-wm0-f49.google.com (HELO mail-wm0-f49.google.com) (74.125.82.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:35:30 +0000 Received: by mail-wm0-f49.google.com with SMTP id q132so11307473wmd.2 for ; Mon, 23 Oct 2017 10:35:30 -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=fVtXXw3q+l0nC3AcGIHSzRKw4gfHCXnMzqHN71s011k=; b=YyrCnDZaw2ycX8m/2omyD9B5qBQTrAgV36OecfjSsuFxflKUhPH861uMhB6Iv/7vQs NiWtHcrHrsot2rxuj79WkKUk0dkZpQ6AhBF9G1/hpw7/8x5/CwHD6qSsj00KRm6UerFe RFn8FGcz+3HdvW2VPJf9ca972MntJq6URLehr09QT5alsNdsg9c1dT6zHcMSORGpAhgh qnVTTrl6QrI3paLCOvYfr3EzvQksrY3CwpUZKGVkUT7Wt6LxVDqeSa+TNYrpsKkbA5wE 5KU7p2Z2hV6NlpLpaDVFPjGC4luxakTotO7qCyGuxROnXfo+VupPTmr8a/sWRyVspHI8 dV5A== X-Gm-Message-State: AMCzsaU/zuL/lb7F5P54+B6fvHodZ0thDRGMnz/HDgrq7U99UXwU/I/Q Gwk8eYwLvrBF1BE+SPNN9z1s7Ml4wVE= X-Google-Smtp-Source: ABhQp+SoEB2E5CR6XXX/sefAeBmgHnQoRzFPrU4tz7/rf3yT8oDKegszoOL9RyUH19oZvOYZtGToaA== X-Received: by 10.28.71.67 with SMTP id u64mr3316488wma.48.1508780128682; Mon, 23 Oct 2017 10:35:28 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id m126sm4130938wmf.31.2017.10.23.10.35.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:35:27 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [088/nnn] poly_int: expand_expr_real_2 References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:35:27 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <878tg1g42o.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes expand_expr_real_2 cope with polynomial mode sizes when handling conversions involving a union type. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * expr.c (expand_expr_real_2): When handling conversions involving unions, apply tree_to_poly_uint64 to the TYPE_SIZE rather than multiplying int_size_in_bytes by BITS_PER_UNIT. Treat GET_MODE_BISIZE as a poly_uint64 too. Index: gcc/expr.c =================================================================== --- gcc/expr.c 2017-10-23 17:25:30.704136008 +0100 +++ gcc/expr.c 2017-10-23 17:25:34.105013764 +0100 @@ -8354,11 +8354,14 @@ #define REDUCE_BIT_FIELD(expr) (reduce_b && !TYPE_REVERSE_STORAGE_ORDER (type)); /* Store this field into a union of the proper type. */ + poly_uint64 op0_size + = tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (treeop0))); + poly_uint64 union_size = GET_MODE_BITSIZE (mode); store_field (target, - MIN ((int_size_in_bytes (TREE_TYPE - (treeop0)) - * BITS_PER_UNIT), - (HOST_WIDE_INT) GET_MODE_BITSIZE (mode)), + /* The conversion must be constructed so that + we know at compile time how many bits + to preserve. */ + ordered_min (op0_size, union_size), 0, 0, 0, TYPE_MODE (valtype), treeop0, 0, false, false); }