From patchwork Thu Jul 13 08:58:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107643 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1940444qge; Thu, 13 Jul 2017 02:00:38 -0700 (PDT) X-Received: by 10.84.231.204 with SMTP id g12mr8943089pln.233.1499936438398; Thu, 13 Jul 2017 02:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499936438; cv=none; d=google.com; s=arc-20160816; b=PVM+9rvhgBYvMzVdAeIK3yovPOAY++41YBfJUC1uOeCoiQDQtCHzWgQDhqK3wWPfz6 RhBykQbWCqD1q2nuHafwVfHFfw1hRDmUqDrxPUltAPYbNo4RMC0byZ98rJvVo4ph1ZjN 2/ORRmq1LYZiiAkZQef2y8+19iciPgPcAXlHo0dD4p5otIRKhQwDTkuCngrM/1yVB4yG 5yfqDdpvKFiQ8QpxO2f28uONTMuHAGoEB4CAnr4s5wS4Uh79+DbnNK8/uGBela5a2/Md hfKHwCcaM9O4CKOnw/BMrUE8msytypdnTFLLItN9wdycHNJrOAtyLKpz7QAuzw+lzgZX 1A/w== 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=A9H1ZZtYrT33NZgBhLbbfXcrAGqqkE0cHGdrOvvto1s=; b=KaZhyoIkKu7h9GzKxPrzRoxTXIQcLW+eN75QhAhT9r7VT9YJND+mHSiuVLbIiVvrYF M3aX+gwdJtBfZZuG0E0eYJprf5w1zzC2k2wpQvjO1uI8npkObMZ/eja5XIYsH9j2dpFL J0fSnkx9mihzAOl1qLSYN8rruLszyw+tSND32s0F5nF/njb/W1GcO39jbdhSt5UURhYF 44KO4y4TZz1l+FYCWLBMtbFQzpqr499rCMNzsiXTDSXIr0hu4AKUuG3eG8hfP/0UwQGN kJid/hqal/UfFcQ07V3Un0eIviBnAnpuSr/nGUgow0x1HTZ8jf6MyEfj1LDgPsA78s2j MmNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=qBTHljA/; spf=pass (google.com: domain of gcc-patches-return-458048-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458048-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 n9si3866485pge.35.2017.07.13.02.00.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 02:00:38 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458048-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.b=qBTHljA/; spf=pass (google.com: domain of gcc-patches-return-458048-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458048-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=ZdxUjfECsxcV2+vLyMpTzCZK/dA6W hxiRvjBJgW8vEtKzOzEJC4uWRPG74t8A1UF+WCrKuNvj96kJSwawdN+kv4QQGYtJ R0GEDoViyLmo5GaydP/nD5Jxgzv2OEqE72m9jOWWdiOIE9VUfnAp7ZtLgQVFqSxc ICvyvKqI6WJJo4= 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=IpTSsbRMTJrcJ14dZUCU7P1aHek=; b=qBT HljA/YFV4E+P9lcFUmU/s4q/P0rgp9j+XfyzDjZRPFtzClz2K+o3DXL03UleVXev vgUuHWmZcf/qIbthKvHCg/zP5jnDpUrgY8OKl3g35+iMsFATyqpprzwSyW6/XZa3 xXAi9HyDVUYSRCiy5Xe+hfIo3KuYuJpKd89QT3ho= Received: (qmail 21062 invoked by alias); 13 Jul 2017 08:58:59 -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 20246 invoked by uid 89); 13 Jul 2017 08:58:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 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=claims X-HELO: mail-wr0-f171.google.com Received: from mail-wr0-f171.google.com (HELO mail-wr0-f171.google.com) (209.85.128.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 08:58:56 +0000 Received: by mail-wr0-f171.google.com with SMTP id k67so49477139wrc.2 for ; Thu, 13 Jul 2017 01:58:55 -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=A9H1ZZtYrT33NZgBhLbbfXcrAGqqkE0cHGdrOvvto1s=; b=OYb79J6p0xEgoEUdVHrTTesUtbsJY9GoCa+5jmFHFRYCstdkHsYZGDu3XAJZOEMU7X sNDkhLjwJ+xVCKVN2yrTQEU0G5LJ9fK96tNFNI5cLbLKgRdaD7GCQcDynbrrlxAGy+na y2SQfjmlnAqb8appJBQDoUgn2vgYX887D1ek2h9ZMxTMPUv7IJN+PJCS14/URXz0IQGg gAPtis384+ChkNpMC0efWdJt+0IexswbURlibVrAEHdPoEEttNXRuIahnPBcfls/Bz6C JDJF6s1CeQb1D1qsCqR+8/2Y7XmphHeT+7eaMmCqTAEkts2jOBmDqg6OPEqAbW9kGmLI kAaw== X-Gm-Message-State: AIVw112h3VhaqMKsoMIssfVQKVRoQwdBq9TIrTbq8UoQCOkwCNE8R9zH +cyXfhiW6J3i4NEPfCM4Dw== X-Received: by 10.223.153.106 with SMTP id x97mr889496wrb.32.1499936333695; Thu, 13 Jul 2017 01:58:53 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id 82sm6191667wmt.17.2017.07.13.01.58.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 01:58:52 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [57/77] Use scalar_int_mode in expand_expr_addr_expr References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 09:58:51 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <87bmooemr8.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch rewrites the condition: if (tmode != address_mode && tmode != pointer_mode) tmode = address_mode; to the equivalent: tmode == pointer_mode ? pointer_mode : address_mode The latter has the advantage that the result is naturally a scalar_int_mode; a later mechanical patch makes it one. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * expr.c (expand_expr_addr_expr): Add a new_tmode local variable that is always either address_mode or pointer_mode. Index: gcc/expr.c =================================================================== --- gcc/expr.c 2017-07-13 09:18:48.752992795 +0100 +++ gcc/expr.c 2017-07-13 09:18:49.132963429 +0100 @@ -7902,20 +7902,21 @@ expand_expr_addr_expr (tree exp, rtx tar /* We can get called with some Weird Things if the user does silliness like "(short) &a". In that case, convert_memory_address won't do the right thing, so ignore the given target mode. */ - if (tmode != address_mode && tmode != pointer_mode) - tmode = address_mode; + machine_mode new_tmode = (tmode == pointer_mode + ? pointer_mode + : address_mode); result = expand_expr_addr_expr_1 (TREE_OPERAND (exp, 0), target, - tmode, modifier, as); + new_tmode, modifier, as); /* Despite expand_expr claims concerning ignoring TMODE when not strictly convenient, stuff breaks if we don't honor it. Note that combined with the above, we only do this for pointer modes. */ rmode = GET_MODE (result); if (rmode == VOIDmode) - rmode = tmode; - if (rmode != tmode) - result = convert_memory_address_addr_space (tmode, result, as); + rmode = new_tmode; + if (rmode != new_tmode) + result = convert_memory_address_addr_space (new_tmode, result, as); return result; }