From patchwork Fri Jul 10 15:46:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 51043 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6496B2290A for ; Fri, 10 Jul 2015 15:46:59 +0000 (UTC) Received: by wifm2 with SMTP id m2sf5886666wif.1 for ; Fri, 10 Jul 2015 08:46:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-original-sender :x-original-authentication-results; bh=pf6JVS5F0jb7Z6M4gZh+2hZKHlWXhg9sKD3Rrq+qxKw=; b=kHd4lxl5CrdYeYNhe0XMebWC6vxZjoALlpKxyF5uFhABtQwtEZbdNO7ol51ncouF63 lwmLPzJITjfWoy7jTwVKwD39DJuHxjRkP6TdoA2HAYJbKdhC91qNjQKmSz+pmFlYq5Vq HbAGA6YTPRjzYdIwveuqRpWEL505A2hngBMej1444liaz7oBxia6UmOy+NpK27c0UE2h bRJziqm7hBbM8ghXmdzkiXMTJ2DO6QK4oaJRi9Sp3yjBNCPRWdOkgByJn0f2ZdWAf1sC ui69+6F2Yd+xRm9lgxy8FrybK1maRS3jn4EWdxtwrpAH/LV4h6plrHRsqHEO5cMhGVqx aZWg== X-Gm-Message-State: ALoCoQkKihud0cj/POlWWnG4EgRjm2yvBL4mIdLOECMgAGWfpA6jFpQOtLiVipu4B5gBJdlvduPL X-Received: by 10.180.186.36 with SMTP id fh4mr2128151wic.7.1436543218724; Fri, 10 Jul 2015 08:46:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.4 with SMTP id x4ls1249046lag.100.gmail; Fri, 10 Jul 2015 08:46:58 -0700 (PDT) X-Received: by 10.152.20.228 with SMTP id q4mr20958129lae.12.1436543218554; Fri, 10 Jul 2015 08:46:58 -0700 (PDT) Received: from mail-la0-x233.google.com (mail-la0-x233.google.com. [2a00:1450:4010:c03::233]) by mx.google.com with ESMTPS id zd10si7947078lbb.169.2015.07.10.08.46.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jul 2015 08:46:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) client-ip=2a00:1450:4010:c03::233; Received: by lagx9 with SMTP id x9so267659693lag.1 for ; Fri, 10 Jul 2015 08:46:58 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr20010920lac.41.1436543218458; Fri, 10 Jul 2015 08:46:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp71805lbb; Fri, 10 Jul 2015 08:46:56 -0700 (PDT) X-Received: by 10.67.5.2 with SMTP id ci2mr42537565pad.97.1436543216245; Fri, 10 Jul 2015 08:46:56 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id qm10si15125852pdb.138.2015.07.10.08.46.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jul 2015 08:46:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-402641-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 69066 invoked by alias); 10 Jul 2015 15:46:43 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 67835 invoked by uid 89); 10 Jul 2015 15:46:42 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f46.google.com Received: from mail-qg0-f46.google.com (HELO mail-qg0-f46.google.com) (209.85.192.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 10 Jul 2015 15:46:41 +0000 Received: by qget71 with SMTP id t71so131008108qge.2 for ; Fri, 10 Jul 2015 08:46:39 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.55.15.103 with SMTP id z100mr34550010qkg.7.1436543199052; Fri, 10 Jul 2015 08:46:39 -0700 (PDT) Received: by 10.140.95.3 with HTTP; Fri, 10 Jul 2015 08:46:38 -0700 (PDT) In-Reply-To: References: <559BEB2D.7040800@redhat.com> Date: Fri, 10 Jul 2015 08:46:38 -0700 Message-ID: Subject: Re: [PATCH, ARM] stop changing signedness in PROMOTE_MODE From: Jim Wilson To: Richard Biener Cc: Jeff Law , "gcc-patches@gcc.gnu.org" X-Original-Sender: jim.wilson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 On Tue, Jul 7, 2015 at 2:35 PM, Richard Biener wrote: > On July 7, 2015 6:29:21 PM GMT+02:00, Jim Wilson wrote: >>signed sub-word locals. Thus to detect the need for a conversion, you >>have to have the decls, and we don't have them here. There is also > > It probably is. The decks for the parameter based SSA names are available, for the PHI destination there might be no decl. I tried looking again, and found the decls. I'm able to get correct code for my testcase with the attached patch to force the conversion. It is rather inelegant, but I think I can cache the values I need to make this simpler and cleaner. I still don't have decls from insert_part_to_rtx_on_edge and insert_rtx_to_part_on_edge, but it looks like those are for breaking cycles, and hence might not need conversions. Jim Index: tree-outof-ssa.c =================================================================== --- tree-outof-ssa.c (revision 225477) +++ tree-outof-ssa.c (working copy) @@ -230,11 +230,32 @@ set_location_for_edge (edge e) SRC/DEST might be BLKmode memory locations SIZEEXP is a tree from which we deduce the size to copy in that case. */ -static inline rtx_insn * -emit_partition_copy (rtx dest, rtx src, int unsignedsrcp, tree sizeexp) +rtx_insn * +emit_partition_copy (rtx dest, rtx src, int unsignedsrcp, tree sizeexp, + tree var2 ATTRIBUTE_UNUSED) { start_sequence (); + /* If var2 is set, then sizeexp is the src decl and var2 is the dest decl. */ + if (var2) + { + tree src_var = (TREE_CODE (sizeexp) == SSA_NAME + ? SSA_NAME_VAR (sizeexp) : sizeexp); + tree dest_var = (TREE_CODE (var2) == SSA_NAME + ? SSA_NAME_VAR (var2) : var2); + int src_unsignedp = TYPE_UNSIGNED (TREE_TYPE (src_var)); + int dest_unsignedp = TYPE_UNSIGNED (TREE_TYPE (dest_var)); + machine_mode src_mode = promote_decl_mode (src_var, &src_unsignedp); + machine_mode dest_mode = promote_decl_mode (dest_var, &dest_unsignedp); + if (src_unsignedp != dest_unsignedp + && src_mode != DECL_MODE (src_var) + && dest_mode != DECL_MODE (dest_var)) + { + src = gen_lowpart_common (DECL_MODE (src_var), src); + unsignedsrcp = dest_unsignedp; + } + } + if (GET_MODE (src) != VOIDmode && GET_MODE (src) != GET_MODE (dest)) src = convert_to_mode (GET_MODE (dest), src, unsignedsrcp); if (GET_MODE (src) == BLKmode) @@ -256,7 +277,7 @@ emit_partition_copy (rtx dest, rtx src, static void insert_partition_copy_on_edge (edge e, int dest, int src, source_location locus) { - tree var; + tree var, var2; if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, @@ -276,10 +297,11 @@ insert_partition_copy_on_edge (edge e, i set_curr_insn_location (locus); var = partition_to_var (SA.map, src); + var2 = partition_to_var (SA.map, dest); rtx_insn *seq = emit_partition_copy (copy_rtx (SA.partition_to_pseudo[dest]), copy_rtx (SA.partition_to_pseudo[src]), TYPE_UNSIGNED (TREE_TYPE (var)), - var); + var, var2); insert_insn_on_edge (seq, e); } @@ -373,7 +395,8 @@ insert_rtx_to_part_on_edge (edge e, int involved), so it doesn't matter. */ rtx_insn *seq = emit_partition_copy (copy_rtx (SA.partition_to_pseudo[dest]), src, unsignedsrcp, - partition_to_var (SA.map, dest)); + partition_to_var (SA.map, dest), 0); + insert_insn_on_edge (seq, e); } @@ -406,7 +429,7 @@ insert_part_to_rtx_on_edge (edge e, rtx rtx_insn *seq = emit_partition_copy (dest, copy_rtx (SA.partition_to_pseudo[src]), TYPE_UNSIGNED (TREE_TYPE (var)), - var); + var, 0); insert_insn_on_edge (seq, e); }