Mon, 16 Mar 2009 11:36:50 -0700, Walter Bright wrote: > Don wrote: >> Oh. I didn't see it was only 6 bytes. And the compiler even KNOWS it's >> six bytes -- it's in the asm. Blimey. It should just be doing that as a >> direct sequence of loads and stores, for anything up to at least 8 bytes. > > The compiler will replace it with a simple mov if it is 1, 2, 4 or 8 bytes.
It didn't, actually. I've just filed a patch which should fix this issue: http://d.puremagic.com/issues/show_bug.cgi?id=2750 For instance, the benchmark in the original post were compiling to L31: mov ECX,EDX mov EAX,6 lea ESI,010h[ESP] mov ECX,EAX mov EDI,EDX rep movsb add EDX,6 add EBX,6 cmp EBX,011E1A300h jb L31 With my patch it's just L3A: lea ESI,0Ch[ESP] mov EDI,EAX movsd movsb movsb add EAX,6 add ECX,6 cmp ECX,011E1A300h jb L3A as it probably was meant to be.