In regards to bug 157084, I can answer how much performance the MEMSET
macro gains you:

[EMAIL PROTECTED]:test-memset$ cat test-memset.c
#include <string.h>

int set(char *x) {
        memset(x, 0, 10);
}

int main() {
        char buf[10];
        set(buf);
}

[EMAIL PROTECTED]:test-memset$ gcc -O2 -c test-memset.c
[EMAIL PROTECTED]:test-memset$ objdump -d test-memset.o

test-memset.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <set>:
   0:   48 c7 07 00 00 00 00    movq   $0x0,(%rdi)
   7:   66 c7 47 08 00 00       movw   $0x0,0x8(%rdi)
   d:   c3                      retq
   e:   66                      data16
   f:   90                      nop

0000000000000010 <main>:
  10:   48 83 ec 18             sub    $0x18,%rsp
  14:   48 89 e7                mov    %rsp,%rdi
  17:   e8 00 00 00 00          callq  1c <main+0xc>
  1c:   48 83 c4 18             add    $0x18,%rsp
  20:   c3                      retq


That's right. GCC knows what memset does, and doesn't even generate a
function call. It generates optimal assembly based upon the amount of
memory being set.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to