This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Handling of libgcc symbols in SH shared libraries


> E.g. for muldf3, you can do a 64 bit multiply by adding four partial
> products together in a straightforward manner.  Or you can do a 62 bit
> multiply with three partial products exploiting the equation
> (a0-a1) * (b1-b0) == a0b1+a1b0-a0b0-a1b1 .  Or even 56 bits are enough,
> using (a0+a1) * (b0+b1) = a0b0+a1b1+a0b1+a1b0:

P.S.: A 63 bit multiply with four partial products is faster:

mov.l LOCAL(x00100000),r3
mov b0,r0
dmulu.l a1,b1
mov.l LOCAL(x7fe00000),r1
add r3,r0
mov.l a0,@-r15
add r3,a0
tst r1,a0
or r3,a0
bt LOCAL(inf_nan_denorm_or_zero_a)
mov.l LOCAL(x001fffff),r2
tst r1,r0
or r3,r0
bt LOCAL(inf_nan_denorm_or_zero_b) ! T clear on fall-through
and r2,r0
sts macl,r3
sts mach,r1
dmulu.l a1,r0
and r2,a0
mov.l r8,@-r15
mov #0,a1

sts macl,r2
sts mach,r8
dmulu.l a0,b1
addc r1,r2

addc a1,r8 ! clears T

sts macl,r1
sts mach,b1
dmulu.l a0,r0
addc r1,r2

addc b1,r8 ! clears T

sts macl,r1
sts mach,r0
addc r8,r1
mov r2,r8
addc a1,r0
cmp/hi a1,r3
rotcl r8

xtrct r1,r2

xtrct r0,r1

/* r1 / r2 contain 56 (+1..2) bit fraction, extra sticky bits in
  bits 0..17 of r8 */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]