Re: Signed multiplication

From: Nate Lawson <nate_at_root.org>
Date: Fri, 06 Nov 2009 16:19:48 -0800
Message-ID: <4AF4BD24.1010406@root.org>
Ullrich von Bassewitz wrote:
> On Thu, Nov 05, 2009 at 11:12:06PM +0100, Rhialto wrote:
>> I don't think so, at least I've never seen one. Even on CPUs that have
>> MUltiply intructions in signed and unsigned variants, where you can do
>> several narrow MULs to make a wider  one, I don't think I've ever seen
>> anything other than unsigned multiplications used.
> 
> Thanks. I still think that there must be a way to do it, but ok. It's
> unfortunate that working with signed number on the 6502 does always have a
> penalty.

Even with a signed multiply (e.g., x86 imul), there is a penalty for the
sign bit in terms of a few extra logic gates. The function they
implement is:

  result[31:16] <= arg1[15] ^ arg2[15];

You're basically just doing the same thing in software. There is no
shortcut for this.

-- 
Nate


       Message was sent through the cbm-hackers mailing list
Received on 2009-11-07 01:00:03

Archive generated by hypermail 2.2.0.