delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/02/17/10:13:21

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
Date: Tue, 17 Feb 2004 09:14:30 -0600
From: Eric Rudd <rudd AT cyberoptics DOT com>
Subject: Re: C99 Functions Under Development and Checkout
In-reply-to: <uwu6m2qtl.fsf@elta.co.il>
To: djgpp-workers AT delorie DOT com
Message-id: <40322FD6.1000705@cyberoptics.com>
Organization: CyberOptics
MIME-version: 1.0
X-Accept-Language: en,pdf
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20030925
References: <148 DOT 2235d751 DOT 2d6287e3 AT aol DOT com> <uwu6m2qtl DOT fsf AT elta DOT co DOT il>
X-MailScanner-Information: Please contact the ISP for more information
X-MailScanner: Found to be clean
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Eli Zaretskii wrote:

>I think the reason for having `fma' in the library is because some
>architectures have machine instructions to do that in one go.  I was
>hoping someone could come up with an idea of implementing that in
>DJGPP, perhaps with MMX instructions or something like that.  But if
>we cannot do that efficiently, let's have the C implementation.
>
If you want fma() to be efficient, it mustn't be implemented in an 
actual procedure, since the overhead of calling the procedure is greater 
than the time spent in doing the multiply-add.  One way of getting 
around that would be to implement it as a macro, but I doubt that many 
programmers will use fma() for reasons of efficiency; if one really 
wants to do fast multiply-adds, it is better to use a routine that 
operates on a whole vector of them.  There are standard routines in 
Fortran for doing so:

   http://www.netlib.org/blas

and they can be translated into C or assembler.  The saxpy() and daxpy() 
routines are the vector equivalent of fma().

As far as special instructions go, the MMX instructions work on 
integers, so are not suitable for this.  The streaming SIMD instructions 
can do this kind of thing, but I don't think we ought to count on all 
platforms having this capability.  As a matter of fact, I don't think 
that gas even supports streaming SIMD (yet).

-Eric Rudd

- Raw text -


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