Re: Is PSHUFW instruction MMX or SSE or SSE2? Is NASM manual correct?
- From: "Rod Pemberton" <do_not_have@xxxxxxxxxxxxx>
- Date: Tue, 25 Dec 2007 11:40:05 -0500
"Robert Redelmeier" <redelm@xxxxxxxxxxxxxxx> wrote in message
news:3K8cj.690$pA7.602@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//\\\\o//\\\\annabee <w@xxxxxxxx> wrote in part:
Most code written by asm newb will blow away anything a c
newb could write. (save maybe for a trivial empty loop)
No, that was my point!
The C newb will write a byte-by-byte copy and libc will save him
from missed buffering. The asm newb will do the same thing, and
the OS will do less buffering. But syscalls (Ring3-Ring0-Ring3)
transitions have much higher price than call/ret libcalls.
The empty loops is a given -- the asm newb wil use LOOP!
I think both will figure out that the smaller and less logic inside the copy
loop the faster cp will be. I think both will figure out fairly quickly
they can use larger data sizes to speed up cp. I think both will figure out
fairly quickly that the more data they can buffer before switching from read
to write, or vice-versa, the faster cp will be. But, it can take an asm
newb years to find out about fast x86 rep on string instructions, especially
if the newb wasn't from the 16-bit crowd or learned 32-bit assembly from
gcc -S. It can take a C newb years to learn he can increase buffer sizes
with setbuf() or setvbuf() and even longer to learn he can disable buffers
with setbuf() or setvbuf() and use inline assembly to move data. It can
take them both many years to learn what the OS development crowd knows: that
most drives can do track to track copies natively, or with a few simple
commands, and without much cpu time and or memory or I/O... So, cp could
only limited by the size of the drive's track buffer and it's read-write
throughput. Um..., just why are we comparing hypothetical C and asm newb's
again? Isnt it a fruitcake-less pursuit? ;)
Rod Pemberton
.
- References:
- Re: Is PSHUFW instruction MMX or SSE or SSE2? Is NASM manual correct?
- From: //\\\\o//\\\\annabee
- Re: Is PSHUFW instruction MMX or SSE or SSE2? Is NASM manual correct?
- From: Robert Redelmeier
- Re: Is PSHUFW instruction MMX or SSE or SSE2? Is NASM manual correct?
- Prev by Date: Re: Is PSHUFW instruction MMX or SSE or SSE2? Is NASM manual correct?
- Next by Date: Re: Is PSHUFW instruction MMX or SSE or SSE2? Is NASM manual correct?
- Previous by thread: Re: Is PSHUFW instruction MMX or SSE or SSE2? Is NASM manual correct?
- Next by thread: Re: Is PSHUFW instruction MMX or SSE or SSE2? Is NASM manual correct?
- Index(es):