Dead Hackers Society
Other BBSes »
 
 

Sommarhack 2024

Silly Venture 2024 SE
Demoscene  Coding  CT60  Buy/sell

Atari demoscene BBS
 
Re: 32 bit muls
Posted by: dml May,23.2014-22:29 

Hi,

Depending on what you need, it could be done with a single mul and a big table to look up normalizing shifts for the inputs. Normalizing means left-justifying values so the MSB occupies the top bit.

Setup is fiddly to optimize on 68k but can be done with some effort. You can also trade table size down at the cost of more cycles (up to a point - wasting too much time on the normalize will be as expensive as doing more multiplies).

You can do some other optimizations with it e.g. normalize only one input, if you know the other is within a very specific range.

If you can't tolerate any precision loss at all, then you need to stick with summing several multiplies - like the samples posted here. For many cases though, it only matters that the most significant N bits are used. This fact often gets missed.


It also helps to dump the sign bits as early as possible and restore them as late as possible if you're doing several operations in series. Dealing with signs is expensive. The simplest method is xor the inputs and restore from the xor'd sign but even that is expensive on 68k if you're doing it every time. Note that this overhead for signs exists for nearly any kind of compound fixedpoint op where the values are 'bigger' than the native mul or div.







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
32 bit muls PeyloW May,15.2014-22:51
  Re: 32 bit muls ggn May,17.2014-07:58
    Re: 32 bit muls ggn May,17.2014-08:00
    Re: 32 bit muls PeyloW May,17.2014-15:05
      Re: 32 bit muls PeyloW May,18.2014-17:55
  Re: 32 bit muls bob_er/mec May,17.2014-09:57
    Re: 32 bit muls Alien / ST-CNX May,21.2014-21:14
    Re: 32 bit muls PeyloW May,22.2014-10:52
      Re: 32 bit muls PeyloW May,23.2014-10:10
        Re: 32 bit muls dml May,23.2014-22:29


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson