public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nigel Stephens <nigel@mips.com>
To: Sandra Loosemore <sandra@codesourcery.com>
Cc: Andrew Pinski <pinskia@gmail.com>,
	  GCC Patches <gcc-patches@gcc.gnu.org>,
	 Guy Morrogh <guym@mips.com>, David Ung <davidu@mips.com>,
	  Thiemo Seufer <ths@mips.com>,
	 Richard Sandiford <richard@codesourcery.com>
Subject: Re: PATCH: fine-tuning for can_store_by_pieces
Date: Wed, 15 Aug 2007 19:53:00 -0000	[thread overview]
Message-ID: <46C358FA.2030506@mips.com> (raw)
In-Reply-To: <46C34624.4070505@codesourcery.com>



Sandra Loosemore wrote:
> Andrew Pinski wrote:
>> On 8/15/07, Sandra Loosemore <sandra@codesourcery.com> wrote:
>>> On MIPS we can get better code by having can_store_by_pieces 
>>> differentiate
>>> between the cases where it's used for memset operations, and those 
>>> where it's
>>> used to copy a string constant.  This patch introduces new SET_RATIO 
>>> and
>>> SET_BY_PIECES_P macros, with appropriate defaults to preserve the 
>>> existing
>>> behavior.  I checked other targets and made the ones that override 
>>> the default
>>> STORE_BY_PIECES_P clone the same definition for SET_BY_PIECES_P.
>>
>> Are you sure that the cause of the real issue here is not really PR
>> 31150?  
>
> I don't think so.  Nigel originally developed this patch against gcc 
> 3.4; I just verified that it still does something useful for current 
> mainline.
>
>> I don't think copying string constants and memcpy/memset
>> should be different in terms of heuristics.
>>
>> It seems if you gave a testcase where this is profitable, it would be
>> better to judge this patch (and maybe a testcase for the testsuite
>> also).
>
> I'll see if I can come up with something specific, or perhaps Nigel 
> has a test case.

No I don't have a specific test case: it's not a failure case, but an 
optimisation.

Note that store_by_pieces is used for two different purposes: to copy 
string constants to memory (e.g.  __builtin_strcpy) or initialise local 
arrays, and also to set a memory buffer to a single constant value 
(__builtin_memset). IMHO the benefit computation of using a movstr 
versus expanding it inline does need to be different for each case, 
since on a 32-bit MIPS processor the strcpy gets expanded into a 
repeated sequence of three instructions (lui; ori; sw) where each 
immediate value is the next 4-byte chunk of the string; whereas in the 
second case the immediate value is computed only once, followed then by 
a sequence of "sw" instructions.

Nigel

  reply	other threads:[~2007-08-15 19:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-15 17:15 Sandra Loosemore
2007-08-15 17:22 ` Andrew Pinski
2007-08-15 18:32   ` Sandra Loosemore
2007-08-15 19:53     ` Nigel Stephens [this message]
2007-08-15 19:58   ` Sandra Loosemore
2007-08-17  4:50   ` Mark Mitchell
2007-08-17 13:24     ` Sandra Loosemore
2007-08-17 18:55       ` Mark Mitchell
2007-08-16  8:34 ` Richard Sandiford
2007-08-16 19:41   ` Sandra Loosemore
2007-08-19  0:03   ` Sandra Loosemore
2007-08-20  8:22     ` Richard Sandiford
2007-08-20 23:38       ` Sandra Loosemore
2007-08-21  8:21         ` Richard Sandiford
2007-08-21 10:34           ` Nigel Stephens
2007-08-21 11:53             ` Richard Sandiford
2007-08-21 12:14               ` Nigel Stephens
2007-08-21 12:35                 ` Richard Sandiford
2007-08-21 13:54           ` Sandra Loosemore
2007-08-21 14:22             ` Richard Sandiford
2007-08-21 20:39               ` Sandra Loosemore
2007-08-21 20:56                 ` Richard Sandiford
2007-08-23 14:35                   ` Sandra Loosemore
2007-08-23 14:44                     ` Richard Sandiford
2007-08-25  5:35                       ` [committed] " Sandra Loosemore
2007-08-25  9:18                         ` Jakub Jelinek
2007-08-25  9:58                           ` Jakub Jelinek
2007-08-25 14:30                           ` gcc.c-torture/execute/20030221-1.c regressed with "fine-tuning for can_store_by_pieces" Hans-Peter Nilsson
2007-08-25 14:40                           ` [committed] Re: PATCH: fine-tuning for can_store_by_pieces Sandra Loosemore
2007-08-24 22:06                     ` Mark Mitchell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46C358FA.2030506@mips.com \
    --to=nigel@mips.com \
    --cc=davidu@mips.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=guym@mips.com \
    --cc=pinskia@gmail.com \
    --cc=richard@codesourcery.com \
    --cc=sandra@codesourcery.com \
    --cc=ths@mips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).