www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/03/00:12:35

From: Jeff Weeks <info AT codex DOT nu>
Newsgroups: comp.os.msdos.djgpp
Subject: FPU memcpy slower on PII?
Date: Thu, 02 Apr 1998 06:06:32 -0500
Organization: Code X Software
Lines: 54
Message-ID: <35237138.B30AF17@codex.nu>
NNTP-Posting-Host: snel.execulink.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I just recently talked to Michal Mertl and was lucky enough to get a
copy of his FPU memcpy code.

It's quite excellent, but oddly enough, it's actually slower than the
regular memcpy on my P2/233!  Any ideas why (I'll post code later on)? 
As for my P233, its always faster, but not as noticeable on smaller
copies (to be expected).

I figure this is some odd PII optomization quirk that I've missed.

Anyway, here's the code:


void memcpyfpu(void *destination,void *source, unsigned long length)
{
  __asm__ __volatile__ (
  "push    %%edx
        andl     $0xfffffff8,%%edx
        xorl     %%ecx,%%ecx
_LoopPoint:
        fildq    (%%eax,%%ecx)
        fistpq   (%%ebx,%%ecx)
        addl     $8,%%ecx
        cmpl     %%edx,%%ecx
        jb      _LoopPoint
        popl     %%edx
        xorl     %%ecx,%%edx
        je      _AllDone
        addl     %%ecx,%%eax
        addl     %%ecx,%%ebx
        movl     %%edx,%%ecx
_SmallLoop:
        movb     (%%eax,%%ecx),%%dl
        movb     %%dl,(%%ebx,%%ecx)
        decl     %%ecx
        jnz     _SmallLoop
_AllDone:"
   :
   : "a" (source), "b" (destination), "d" (length)
   : "%ecx","cc","memory");
}

Thanks,
Jeff

PS: Please respond via email if possible.

--------------------------------------------
            - Code X Software -
       Programming to a Higher Power
  
        email: mailto:info AT codex DOT nu
        web:   http://www.codex.nu/
--------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019