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: 787608 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3x7VCP2Bxrz9ryv for ; Thu, 13 Jul 2017 19:00:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="FT2mwsTg"; dkim-atps=neutral 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=vDXxYZsKzBlqE69hDdmThqPuxkT7d lq6vGPDt+qOBSW+R1m8su2XjLLHQZrK234jYalwxQhrdYSRbRpAF7vgn2UTqHz+8 cHCv6L+gCcjkOFgMnCvuv76bWT6/gPXP4Mmvb9LgrtrCV6Fy8I8VWtM3edioMUTS AI0782q5+s2FsE= 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=FT2 mwsTggg6o997/3zr0d+4Z69rmM71eJbmktArQNe49ZPSNV/Pgp3xVcG6sJvBoOxE qufjupmvPiLAhR12hcn5lZqeoKOgwj5UUCV7kP5e4Wrk1qUwh1W+uUU8oIF8zkW0 VlaEyfnQh520yu3dAGmmWFMZsclCPBVojegohcZ0= 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; }