Re: newbie: MUL product



On Thu, 29 Mar 2007 17:04:48 +0200, Herbert Kleebauer <klee@xxxxxxxxx>
wrote:

Brian wrote:


but I'm not sure if there is a simpler way, or a way to get to the
32-bit product with just one instruction.

Sure, don't use a 16 but a 32 bit multiplication.

00000100: 66 a1 010a move.l val1,r0
00000104: 66 f7 26 010e mulu.l val2,r0,r1|r0
00000109: c3 rts.w

0000010a: 00002000 val1: dc.l $2000
0000010e: 00000100 val2: dc.l $0100

Herbert, thanks for your reply. I haven't memorized opcodes yet, but
I suppose I can work it out.

What if my multiplier and multiplicand are both 32-bit to begin with,
and I'm in a 32 bit environment.

Are my options in that case as follows:

Define a QWORD (64-bit) "product" variable
move offset of product variable to register
copy edx (high dword) to offset of product variable
copy eax (low dword) to (offset + 4)

Then, assuming that is a good way to store my 64 bit product, that
raises another question with which I'm ignorant at this point:
I think I will have little endian issues at this point. My intel
processor uses little endian storage, so I think that means I want to
store the LOW Dword at the offset first, then the high dword (opposite
to what I wrote in the above paragraph). Correct?
--
thanks,
Brian
To the best of my knowledge, I have:
1) asked a question specifically related to this newsgroup
2) not used my email to request answers be sent there
3) not top-posted
4) not used bad grammar that would make me appear more stupider
.



Relevant Pages

  • Re: 2.6.22-rc: regression: no irda0 interface (2.6.21 was OK), smsc does not find chip
    ... Store ) ... If (LEqual (Local0, 0x00)) ... Offset, ... Store (Local1, \_SB.PCI0.FNC0.IRQA) ...
    (Linux-Kernel)
  • Re: LPC900/80C51 Compiler Toolchain
    ... store them rather than push. ... the frame pointer, the advantages (debugging is possible and code ... storing data at (SP + offset) takes exactly the same time ...
    (comp.arch.embedded)
  • Re: If And Match With a MAX and Offset
    ... Sheet2 and find the same store number in column D (Store Numbers can ... exist multiple times, hence the MAX), then look in Sheet2 column H and ... the data I need returned to Sheet1 column E. ... returning data but not what is offset by 0 rows and 9 columns. ...
    (microsoft.public.excel.misc)
  • Re: If And Match With a MAX and Offset
    ... Sheet2 and find the same store number in column D (Store Numbers can ... exist multiple times, hence the MAX), then look in Sheet2 column H and ... the data I need returned to Sheet1 column E. ... returning data but not what is offset by 0 rows and 9 columns. ...
    (microsoft.public.excel.misc)