From patchwork Tue Aug 20 19:50:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 268643 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id BCB002C00F7 for ; Wed, 21 Aug 2013 05:51:49 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; q=dns; s=default; b=WRJdNkjz4lu2fqATAg hIMZHOCGrEMjvGVDOf2vllsV9cLGgXZbwW9wxwkEnU/APX1XHbOV3vBpOsEdVvd7 PHyPkWLkQjdsVSt0RgqJnoSJk+eB2+SnTaH5qRYoq/nhqwWWVZMv1P7LC/OfvFeS s06Gm4eQfiJYI/jE8bVP1DwQI= 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 :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; s=default; bh=3RLhWIGn/VDOgO7PTDFJxeTK FOo=; b=exTqrbHyRF8FIIdBH8ElIfGNtdFW+Ub9gXvLGUx+LDf1sgyTZhbXw43d 7ZpmupTkqWNxza/mo2YEM9MptSFluSJLsCL8ESHB0O+o1g8HkaJm0taS0g7XWIQ0 vWpqWaqk7i5yMLD/dEyQ6Mx/LEEi5/fl1NZZcuJzKUlEl0EWkrI= Received: (qmail 29771 invoked by alias); 20 Aug 2013 19:51:37 -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 29746 invoked by uid 89); 20 Aug 2013 19:51:37 -0000 X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.2 Received: from mail-ob0-f174.google.com (HELO mail-ob0-f174.google.com) (209.85.214.174) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 20 Aug 2013 19:51:07 +0000 Received: by mail-ob0-f174.google.com with SMTP id wd6so1442896obb.33 for ; Tue, 20 Aug 2013 12:51:05 -0700 (PDT) X-Received: by 10.60.16.104 with SMTP id f8mr3640535oed.71.1377028265672; Tue, 20 Aug 2013 12:51:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.95.73 with HTTP; Tue, 20 Aug 2013 12:50:25 -0700 (PDT) In-Reply-To: <20130819064742.GP4024@bubble.grove.modra.org> References: <20130611002611.GS6878@bubble.grove.modra.org> <20130819064742.GP4024@bubble.grove.modra.org> From: Steven Bosscher Date: Tue, 20 Aug 2013 21:50:25 +0200 Message-ID: Subject: Re: [PATCH] lower-subreg and IBM long double To: GCC Patches On Mon, Aug 19, 2013 at 8:47 AM, Alan Modra wrote: > gcc/ ... > * doc/tm.texi.in (TARGET_INIT_LOWER_SUBREG): Document. ChangeLog update needed here, the new hook is documented in target.def. > +static void > +rs6000_init_lower_subreg (void *data) > +{ Functions should start with a leading comment. > Index: gcc/target.def > =================================================================== > --- gcc/target.def (revision 201834) > +++ gcc/target.def (working copy) > @@ -5110,6 +5110,14 @@ comparison code or operands.", > void, (int *code, rtx *op0, rtx *op1, bool op0_preserve_value), > default_canonicalize_comparison) > > +/* Allow modification of subreg choices. */ > +DEFHOOK > +(init_lower_subreg, > + "This hook allows modification of the choices the lower_subreg pass \ > +will make for particular subreg modes. @var{data} is a pointer to a \ > +@code{struct target_lower_subreg}.", > + void, (void *data), NULL) > + Bah, another void* pointer... I would have preferred a hook that takes a machine_mode and let it be called in the first loop of compute_costs, something like the code below. Your solution gives the target a lot more power to control the split decisions (adjust individual costs, review overall choice of modes to split, etc.) but I don't think any target really needs that. Do you think the target should have more control over splitting than just on per machine_mode basis? Ciao! Steven PUT_MODE (rtxes->source, mode); mode_move_cost = set_rtx_cost (rtxes->set, speed_p); @@ -218,7 +229,9 @@ compute_costs (bool speed_p, struct cost_rtxes *rt GET_MODE_NAME (mode), mode_move_cost, word_move_cost, factor); - if (FORCE_LOWERING || mode_move_cost >= word_move_cost * factor) + if (FORCE_LOWERING + || ((mode_move_cost >= word_move_cost * factor) + && split_profitable_mode)) { choices[speed_p].move_modes_to_split[i] = true; choices[speed_p].something_to_do = true; Index: lower-subreg.c =================================================================== --- lower-subreg.c (revision 201887) +++ lower-subreg.c (working copy) @@ -208,7 +208,18 @@ compute_costs (bool speed_p, struct cost_rtxes *rt if (factor > 1) { int mode_move_cost; - + bool split_profitable_mode = true; + + if (targetm.split_profitable_mode + && ! targetm.split_profitable_mode ((mode))) + { + split_profitable_mode = false; + if (LOG_COSTS) + fprintf (stderr, + "%s move: target signals splitting is not profitable%s\n", + GET_MODE_NAME (mode), FORCE_LOWERING ? " (forcing)" : ""); + } + PUT_MODE (rtxes->target, mode);