|
Atari demoscene BBS
Re: 32 bit muls |
Posted by: PeyloW
|
May,17.2014-15:05
|
Thanks for the links.
The 32b*32b->32b I have now is this d0*d1->d0, with d2 clobbered:
mul_32:
move.l d0,d2 ; 4
move.w d1,-(sp); 8
swap d0 ; 4
mulu d1,d0 ; 40/80 x0*y1
swap d1 ; 4
mulu d2,d1 ; 40/80 x1*y0
add.w d1,d0 ; 4
swap d0 ; 4
clr.w d0 ; 4
mulu (sp)+,d2 ; 44/84 x1*y1
add.l d2,d0 ; 8
rts ; 164/284
This one is quite easy since the result is 32bit, and I do not need to worry about any carry bit. The reason I do the 32b*32b->64b to memory is to get the carry bits, and it is super easy to get to the middle 32 bits. Maybe this can be done with addx, but I can not think of how :(.
This is what I got now at least (d0*d1->(a0):4(a0)), with d2 clobbered:
mul_32_64b:
clr.l (a0) ; 20
move.l d0,d2 ; 4
mulu d1,d0 ; 40/80 x1*y1
move.l d0,4(a0) ; 16
move.l d2,d0 ; 4
swap d0 ; 4
mulu d1,d0 ; 40/80 y1*x0
add.l d0,2(a0) ; 24
swap d1 ; 4
move.w d2,d0 ; 4
mulu d1,d0 ; 40/80 y0*x1
add.l d0,2(a0) ; 24
bcc .nc ; 8/12
addq.w #1,4(a0) ; 16
.nc:
swap d2 ; 4
mulu d1,d2 ; 40/80 x0*y0
add.l d2,(a0) ; 20
rts ; 300/472
|
[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
|
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.
|