Re: Any libraries for vector mask and vector population count?



no compiler support

I'm not sure exactly what you mean by that:

$ cat a.c
int foo(int i) { return __builtin_popcount (i); }
$ gcc -S a.c -msse4
$ cat a.s
.text
..globl _foo
_foo:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl 8(%ebp), %eax
popcntl %eax, %eax
leave
ret
.subsections_via_symbols

There clearly is a popcntl opcode used. If you don't specify -msse4, you get a
call to a function in the GCC support library (libgcc).


$ gcc -v
Using built-in specs.
Target: i386-apple-darwin8.10.1
Configured with: /tmp/gfortran-20080221/ibin/../gcc/configure --prefix=/usr/local/gfortran --enable-languages=c,fortran --with-gmp=/tmp/gfortran-20080221/gfortran_libs --enable-bootstrap
Thread model: posix
gcc version 4.4.0 20080221 (experimental) [trunk revision 132519] (GCC)

--
FX
.



Relevant Pages

  • Re: call stacks order of parameters
    ... movl %esp, %ebp ... pushl -4 ...
    (comp.lang.asm.x86)
  • gcc bug?
    ... pushl %ebp ... movl %esp, %ebp ...
    (comp.os.msdos.djgpp)
  • Re: Few Good Interview Questions
    ... Compiled and tested with gcc version 3.3.2 ... andl $-16, %esp ... pushl -4 ... movl $here, %eax ...
    (comp.unix.solaris)
  • Re: 7 segment display
    ... movl %esp, %ebp ... xorl %ebx, %ebx ... movl -4, %ebx ...
    (alt.lang.asm)
  • Re: Linux / NASM equivalent of Iczelions Win32 assembly tuts
    ... Well, gcc has impressed me favorably on occasion, so I guess it's okay if it disappoints you sometimes. ... andl $-16, %esp ... movl stdout, %eax ... However, for all of this - a call to libc for each character - libc is buffering output "behind our back", and actually calls "write" fewer times than my asm code ("your" header on some versions, but for ...
    (alt.lang.asm)