The functions of the std.intrinsic module (that I presume are often asm
instructions) look nice, but time ago I have seen that normal D code is fasten
than some of them:
You can see it from this code that use bt and btr:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsievebits&lang=dlang&id=2http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsievebits&lang=dlang&id=1
The code that uses IsSet and Clear (functions originally coming from Pascal
code) is faster:
bool IsSet(uint i) {
int offset = i / bpc;
uint mask = 1 << (i % bpc);
return (flags[offset] & mask) <> 0;
}
void Clear(uint i) {
int offset = i / bpc;
uint mask = 1 << (i % bpc);
if((flags[offset] & mask) <> 0)
flags[offset] = flags[offset] ^ mask;
}
So I can suggest to replace those functions of Phobos with functions in normal
D code (such things are very useful to manage array of bits, that I use).
Bye,
bearophile

This should be posted on D.learn, but i think it also has some relevant
to intrinsic here :|
Currently D doesn't provide vector data type __attribute__((vector(xyz))
and intrinsics that operate on those vector types.
I'm forced to go back to asm{}.
And for asm, there is a bug in dmd.1.030
movmskpd ECX, XMM7;
is compiled to:
movmskpd EDI, XMM7;
Anyone else can confirm the same issue?
Thanks.