delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/08/04:49:22

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Optimization of math.h functions
Date: Wed, 03 Sep 1997 11:34:47 +0200
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 41
Message-ID: <340D2F37.72792B60@LSTM.Ruhr-UNI-Bochum.De>
References: <199709030259 DOT TAA10342 AT adit DOT ap DOT net>
NNTP-Posting-Host: c64.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
CC: eldredge AT ap DOT net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Nate Eldredge wrote:
> 
> Does anybody know why the math functions aren't implemented as inline
> functions in the header file, but rather as regular functions? Since most of
> them are just one or two instructions, it seems that making them available
> as inline asm functions (like Allegro's _putpixel) would be much more
> efficient. For starters, it would avoid storing local floating-point
> variables from registers onto the stack, then reloading them within the
> function.
> 
> At the very least, those to which it applies should have GCC's "const"
> attribute applied to them to let the compiler optimize better.
> 
> If there's a disadvantage to this, somebody please let me know. Otherwise, I
> think it should be done.

About which functions are you thinking?
Most of them also do a ``normalizing'' step, because AFAIK
you cannot feed an arbitrary number to the NPU and execute
an fsin (e.g.) on it. Also, they do some kind of error
checking. I have to admit I never quite figured out for sure
which versions are usually called, though. 

And what do you mean with the ``const'' attribute? All const 
arguments are passed by value, so I cannot see where this
helps the optimizer? Or did I get something wrong?

-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


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