stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: svn commit: r643964 - /stdcxx/trunk/include/rw/_traits.h
Date Wed, 02 Apr 2008 18:15:00 GMT
Farid Zaripov wrote:
>> -----Original Message-----
>> From: Martin Sebor [] On Behalf Of Martin Sebor
>> Sent: Wednesday, April 02, 2008 8:38 PM
>> To:
>> 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:

         pushl     8(%esp)
         pushl     $0
         pushl     12(%esp)
         call      _intel_fast_memset
         addl      $12, %esp
         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
         movl      %esi, %ecx
         andl      $3, %ecx
         popl      %esi
         popl      %edi


View raw message