public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Steve Ellcey <sellcey@mips.com>
To: Chris Metcalf <cmetcalf@tilera.com>
Cc: <libc-ports@sourceware.org>
Subject: Re: [patch, mips, memmove] Remove memmove's use of memcpy on MIPS
Date: Fri, 25 Jan 2013 19:29:00 -0000	[thread overview]
Message-ID: <1359142109.11963.138.camel@ubuntu-sellcey> (raw)
In-Reply-To: <5102D50C.6030300@tilera.com>

On Fri, 2013-01-25 at 13:55 -0500, Chris Metcalf wrote:

> 
> See ports/sysdeps/tile/tilegx/memcpy.c for how the tile architecture handles this issue.
> The memcpy code advances until the destination pointer is cache-aligned, then loops cacheline
> at a time, first reading 64 bytes, then doing the prepare-to-store (aka "wh64"), then writing
> all 64 bytes.  This ensures that no matter what overlap the source has with the destination,
> we have captured any data that might be overwritten by the "wh64" instruction.  Since our memory
> architecture is non-blocking we can issue all eight reads without waiting for them to complete.
> 
> Would doing something like this for MIPS allow your memcpy to be safe for forward memmove?

I like this implementation, unfortunately I don't have a
CHIP_L2_LINE_SIZE macro to check the cache line size and my cache line
size could be anywhere from 16 to 128 bytes.  I currently optimize for
32 bytes but make sure it works correctly for anything less then 128
bytes.  I like the use of 'safe' prefetches when you can't use 'wh64'. I
may experiment and see if I can create a C version of memcpy like you
have that works as well or better then my existing asm version, but the
use of the MIPS partial word loads (lwl/lwr, ldl/ldr) in my assembly
version may make it difficult, or at least make it require more inline
assembly.

I think I still need to check in my current patch for now to fix ToT
memmove while I look into making a better memcpy.

Steve Ellcey
sellcey@mips.com


  reply	other threads:[~2013-01-25 19:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-25 18:17 Steve Ellcey 
2013-01-25 18:55 ` Chris Metcalf
2013-01-25 19:29   ` Steve Ellcey [this message]
2013-01-25 20:16 ` Joseph S. Myers
2013-01-25 21:29   ` Steve Ellcey
2013-01-25 23:15     ` Joseph S. Myers
2013-01-26  2:09     ` Maxim Kuvyrkov

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=1359142109.11963.138.camel@ubuntu-sellcey \
    --to=sellcey@mips.com \
    --cc=cmetcalf@tilera.com \
    --cc=libc-ports@sourceware.org \
    /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).