Martin Sebor
Wed, 02 Apr 2008 11:15:35 -0700
Farid Zaripov wrote:
-----Original Message----- From: Martin Sebor [EMAIL PROTECTED] 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: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.From ICC help: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