This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Performance fix for libmpx memmove wrapper
- From: Aleksandra Tsvetkova <astsvetk at gmail dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 24 Dec 2015 14:24:07 +0300
- Subject: Re: [PATCH] Performance fix for libmpx memmove wrapper
- Authentication-results: sourceware.org; auth=none
- References: <CAGq4YfxfZQ0xZW_uWhgN=M653q5F6-yrxKcOmYcTMdJ0xtGQvg at mail dot gmail dot com>
Description:
2015-12-11 Tsvetkova Alexandra <aleksandra.tsvetkova@intel.com>
* libmpxwrap/mpx_wrappers.c (__mpx_wrapper_memmove): separate
case for size of pointer.
On Thu, Dec 24, 2015 at 2:21 PM, Aleksandra Tsvetkova
<astsvetk@gmail.com> wrote:
> This patch was tested on spec2000, spec2006 and make check. It fixes
> regression on vortex.
>
>
> 2015-12-11 Tsvetkova Alexandra <aleksandra.tsvetkova@intel.com>
>
> * libmpxwrap/mpx_wrappers.c (mpx_pointer): New type.
>
>
> diff --git a/libmpx/mpxwrap/mpx_wrappers.c b/libmpx/mpxwrap/mpx_wrappers.c
> old mode 100644
> new mode 100755
> index ffa7e7e..679e546
> --- a/libmpx/mpxwrap/mpx_wrappers.c
> +++ b/libmpx/mpxwrap/mpx_wrappers.c
> @@ -483,10 +483,20 @@ __mpx_wrapper_memmove (void *dst, const void
> *src, size_t n)
> __bnd_chk_ptr_bounds (dst, n);
> __bnd_chk_ptr_bounds (src, n);
>
> + /* This is an speedup for size of pointer. */
> + if (n == sizeof (void *))
> + {
> + const void **s = (const void**)src;
> + void **d = (void**)dst;
> + *d = *s;
> + return dst;
> + }
> +
> memmove (dst, src, n);
> +
> /* Not necessary to copy bounds if size is less then size of pointer
> or SRC==DST. */
> - if ((n >= sizeof (void *)) && (src != dst))
> + if ((n > sizeof (void *)) && (src != dst))
> move_bounds (dst, src, n);
>
> return dst;