You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2008/04/02 18:35:27 UTC

svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h

Author: faridz
Date: Wed Apr  2 09:35:26 2008
New Revision: 643964

URL: http://svn.apache.org/viewvc?rev=643964&view=rev
Log:
2008-04-02  Farid Zaripov  <fa...@epam.com>

	STDCXX-799
	* include/rw/_traits.h: Don't use gcc string builtins on icc.

Modified:
    stdcxx/trunk/include/rw/_traits.h

Modified: stdcxx/trunk/include/rw/_traits.h
URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_traits.h?rev=643964&r1=643963&r2=643964&view=diff
==============================================================================
--- stdcxx/trunk/include/rw/_traits.h (original)
+++ stdcxx/trunk/include/rw/_traits.h Wed Apr  2 09:35:26 2008
@@ -85,7 +85,7 @@
 #  define _RWSTD_WCSLEN    _RW::__rw_wcslen
 #else   // if !defined (_RWSTDDEBUG) && !defined (_RWSTD_EDG_ECCP)
 
-#  if 4 <= __GNUG__
+#  if 4 <= __GNUG__ && !defined (__INTEL_COMPILER)
      // use gcc 4.x intrinsic functions
 #    define _RWSTD_MEMCPY    __builtin_memcpy
 #    define _RWSTD_MEMCMP    __builtin_memcmp



Re: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>> -----Original Message-----
>> From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor
>> Sent: Wednesday, April 02, 2008 8:38 PM
>> To: dev@stdcxx.apache.org
>> Subject: Re: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h
>>
>> Farid Zaripov wrote:
>>>   From ICC help:
>> I've read the Intel C++ manuals. They don't mention 
>> __builtin_memcpy either but the compiler seems to understand 
>> it just fine. In fact, the latest compiler understands all 
>> the gcc intrinsics with the exception of __builtin_memmove. 
>> So perhaps disabling just that one builtin would be enough.
> 
>   Ok, but why we need to use __builtin_xxx() functions instead of
> corresponding std::xxx()
> functions while both set of these functions are intrinsics on icc? :)

That's a good question. Intel C++ 10 generates different code
for each, so we should probably do some benchmarking before we
switch from one to the other.

For this program:

   #include <string.h>

   void foo (char *s, size_t n) { memset (s, 0, n); }
   void bar (char *s, size_t n) { __builtin_memset (s, 0, n); }

Intel C++ 10.1 generates this code at -O2:

foo:
         pushl     8(%esp)
         pushl     $0
         pushl     12(%esp)
         call      _intel_fast_memset
         addl      $12, %esp
         ret
bar:
         pushl     %edi
         pushl     %esi
         xorl      %eax, %eax
         movl      12(%esp), %edi
         movl      16(%esp), %ecx
         andl      $65535, %eax
         movb      %al, %ah
         movl      %ecx, %esi
         movl      %eax, %edx
         shll      $16, %eax
         shrl      $2, %ecx
         orl       %edx, %eax
         rep
         stosl
         movl      %esi, %ecx
         andl      $3, %ecx
         rep
         stosb
         popl      %esi
         popl      %edi
         ret

Martin

RE: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h

Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor
> Sent: Wednesday, April 02, 2008 8:38 PM
> To: dev@stdcxx.apache.org
> Subject: Re: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h
> 
> Farid Zaripov wrote:
> >   From ICC help:
> 
> I've read the Intel C++ manuals. They don't mention 
> __builtin_memcpy either but the compiler seems to understand 
> it just fine. In fact, the latest compiler understands all 
> the gcc intrinsics with the exception of __builtin_memmove. 
> So perhaps disabling just that one builtin would be enough.

  Ok, but why we need to use __builtin_xxx() functions instead of
corresponding std::xxx()
functions while both set of these functions are intrinsics on icc? :)

Farid.

Re: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>> -----Original Message-----
>> From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor
>> Sent: Wednesday, April 02, 2008 7:54 PM
>> To: dev@stdcxx.apache.org
>> Subject: Re: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h
>>
>> Thanks for looking into this for me Farid. So Intel C++ on 
>> Linux doesn't support these intrinsics at all? I can't find 
>> them in the Intel C++ Intrinsics Reference but I thought they 
>> were trying to make the compiler 100% compatible with gcc, 
>> including all of its extensions.
> 
>   From ICC help:

I've read the Intel C++ manuals. They don't mention __builtin_memcpy
either but the compiler seems to understand it just fine. In fact,
the latest compiler understands all the gcc intrinsics with the
exception of __builtin_memmove. So perhaps disabling just that
one builtin would be enough.

Martin

> 
> String and Block Copy Intrinsics
> The following table lists and describes string and block copy intrinsics
> that you can use across all Intel architectures. 
> 
> The string and block copy intrinsics are not implemented as intrinsics
> on IA-64 architecture.
> 
> Intrinsic Description 
> char *_strset(char *, _int32) Sets all characters in a string to a fixed
> value. 
> int memcmp(const void *cs, const void *ct, size_t n) Compares two
> regions of memory. Return <0 if cs<ct, 0 if cs=ct, or >0 if cs>ct. 
> void *memcpy(void *s, const void *ct, size_t n) Copies from memory.
> Returns s. 
> void *memset(void * s, int c, size_t n) Sets memory to a fixed value.
> Returns s. 
> char *strcat(char * s, const char * ct) Appends to a string. Returns s. 
> int strcmp(const char *, const char *) Compares two strings. Return <0
> if cs<ct, 0 if cs=ct, or >0 if cs>ct. 
> char *strcpy(char * s, const char * ct) Copies a string. Returns s. 
> size_t strlen(const char * cs) Returns the length of string cs. 
> int strncmp(char *, char *, int) Compare two strings, but only specified
> number of characters. 
> int strncpy(char *, char *, int) Copies a string, but only specified
> number of characters. 
> 
> Farid.
> 


RE: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h

Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor
> Sent: Wednesday, April 02, 2008 7:54 PM
> To: dev@stdcxx.apache.org
> Subject: Re: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h
> 
> Thanks for looking into this for me Farid. So Intel C++ on 
> Linux doesn't support these intrinsics at all? I can't find 
> them in the Intel C++ Intrinsics Reference but I thought they 
> were trying to make the compiler 100% compatible with gcc, 
> including all of its extensions.

  From ICC help:

String and Block Copy Intrinsics
The following table lists and describes string and block copy intrinsics
that you can use across all Intel architectures. 

The string and block copy intrinsics are not implemented as intrinsics
on IA-64 architecture.

Intrinsic Description 
char *_strset(char *, _int32) Sets all characters in a string to a fixed
value. 
int memcmp(const void *cs, const void *ct, size_t n) Compares two
regions of memory. Return <0 if cs<ct, 0 if cs=ct, or >0 if cs>ct. 
void *memcpy(void *s, const void *ct, size_t n) Copies from memory.
Returns s. 
void *memset(void * s, int c, size_t n) Sets memory to a fixed value.
Returns s. 
char *strcat(char * s, const char * ct) Appends to a string. Returns s. 
int strcmp(const char *, const char *) Compares two strings. Return <0
if cs<ct, 0 if cs=ct, or >0 if cs>ct. 
char *strcpy(char * s, const char * ct) Copies a string. Returns s. 
size_t strlen(const char * cs) Returns the length of string cs. 
int strncmp(char *, char *, int) Compare two strings, but only specified
number of characters. 
int strncpy(char *, char *, int) Copies a string, but only specified
number of characters. 

Farid.

Re: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h

Posted by Martin Sebor <se...@roguewave.com>.
Thanks for looking into this for me Farid. So Intel C++ on Linux
doesn't support these intrinsics at all? I can't find them in the
Intel C++ Intrinsics Reference but I thought they were trying to
make the compiler 100% compatible with gcc, including all of its
extensions.

Martin

faridz@apache.org wrote:
> Author: faridz
> Date: Wed Apr  2 09:35:26 2008
> New Revision: 643964
> 
> URL: http://svn.apache.org/viewvc?rev=643964&view=rev
> Log:
> 2008-04-02  Farid Zaripov  <fa...@epam.com>
> 
> 	STDCXX-799
> 	* include/rw/_traits.h: Don't use gcc string builtins on icc.
> 
> Modified:
>     stdcxx/trunk/include/rw/_traits.h
> 
> Modified: stdcxx/trunk/include/rw/_traits.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_traits.h?rev=643964&r1=643963&r2=643964&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/rw/_traits.h (original)
> +++ stdcxx/trunk/include/rw/_traits.h Wed Apr  2 09:35:26 2008
> @@ -85,7 +85,7 @@
>  #  define _RWSTD_WCSLEN    _RW::__rw_wcslen
>  #else   // if !defined (_RWSTDDEBUG) && !defined (_RWSTD_EDG_ECCP)
>  
> -#  if 4 <= __GNUG__
> +#  if 4 <= __GNUG__ && !defined (__INTEL_COMPILER)
>       // use gcc 4.x intrinsic functions
>  #    define _RWSTD_MEMCPY    __builtin_memcpy
>  #    define _RWSTD_MEMCMP    __builtin_memcmp
> 
> 
>