delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/21/02:49:26

Date: Tue, 21 Jan 1997 09:31:47 -0600 (CST)
From: Adrian Oboroc <ash AT cinf DOT usm DOT md>
To: leathm AT gbrmpa DOT gov DOT au
cc: djgpp AT delorie DOT com
Subject: x86/x87 opcodes
Message-ID: <Pine.LNX.3.93.970121093049.6000J-100000@cinf.usm.md>
MIME-Version: 1.0

Leathal <leathm AT gbrmpa DOT gov DOT au> wrote:

> > while using the profiler on some code i had written i noticed that changing a
> > floating point multiply to an unsigned multiply of 2 longs turned out to be
> > slower. in fact floating point multiply appears to be faster than ordinary
> > integer multiply for any case. is this actually true? and if so is there any
> > reason i shouldn't just change every multiply in my code to make sure it's
> > floating point?
>
> Yes, floating point is faster because imul and idiv use the floating
> point unit to do the operations - thus an integer mul/divide has the
> overhead of converting the int -> float, div/mul, then float -> int.
> Whereas the floating point calculations just do the div/mul...
>
> Leathal.

I'm sorry to say it, Leathal, but (at least for Intel x86) MUL/DIV works
with unsigned integers, and IMUL/IDIV - with signed integers.
Probably you wanted to say FMUL/FDIV - the FPU's opcodes

                CU, AsH / DEVOTiON


- Raw text -


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