public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Performance fix for libmpx memmove wrapper
@ 2015-12-24 11:21 Aleksandra Tsvetkova
  2015-12-24 11:24 ` Aleksandra Tsvetkova
  0 siblings, 1 reply; 4+ messages in thread
From: Aleksandra Tsvetkova @ 2015-12-24 11:21 UTC (permalink / raw)
  To: gcc-patches

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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Performance fix for libmpx memmove wrapper
  2015-12-24 11:21 [PATCH] Performance fix for libmpx memmove wrapper Aleksandra Tsvetkova
@ 2015-12-24 11:24 ` Aleksandra Tsvetkova
  2015-12-29 12:52   ` Ilya Enkovich
  0 siblings, 1 reply; 4+ messages in thread
From: Aleksandra Tsvetkova @ 2015-12-24 11:24 UTC (permalink / raw)
  To: gcc-patches

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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Performance fix for libmpx memmove wrapper
  2015-12-24 11:24 ` Aleksandra Tsvetkova
@ 2015-12-29 12:52   ` Ilya Enkovich
  2016-01-11  8:21     ` Thomas Schwinge
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Enkovich @ 2015-12-29 12:52 UTC (permalink / raw)
  To: Aleksandra Tsvetkova; +Cc: gcc-patches

This patch is OK.  I applied it to trunk.

Thanks,
Ilya

2015-12-24 14:24 GMT+03:00 Aleksandra Tsvetkova <astsvetk@gmail.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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Performance fix for libmpx memmove wrapper
  2015-12-29 12:52   ` Ilya Enkovich
@ 2016-01-11  8:21     ` Thomas Schwinge
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Schwinge @ 2016-01-11  8:21 UTC (permalink / raw)
  To: Ilya Enkovich, Aleksandra Tsvetkova; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2132 bytes --]

Hi!

On Tue, 29 Dec 2015 15:51:56 +0300, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> This patch is OK.  I applied it to trunk.
> 
> Thanks,
> Ilya
> 
> 2015-12-24 14:24 GMT+03:00 Aleksandra Tsvetkova <astsvetk@gmail.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;
> >> +  }

I'm seeing the following compiler diagnostic:

    [...]/source-gcc/libmpx/mpxwrap/mpx_wrappers.c: In function '__mpx_wrapper_memmove':
    [...]/source-gcc/libmpx/mpxwrap/mpx_wrappers.c:492:8: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
         *d = *s;
            ^


Grüße
 Thomas


> >> +
> >>    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;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-11  8:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-24 11:21 [PATCH] Performance fix for libmpx memmove wrapper Aleksandra Tsvetkova
2015-12-24 11:24 ` Aleksandra Tsvetkova
2015-12-29 12:52   ` Ilya Enkovich
2016-01-11  8:21     ` Thomas Schwinge

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).