public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
* __udivsi3: coldfire vs non-coldfire implementation
@ 2012-04-24 14:14 Luis Alves
  2012-04-24 15:39 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Alves @ 2012-04-24 14:14 UTC (permalink / raw)
  To: linux-m68k

Hi all,

What's the reason for having two different algorithms for this function?
The coldfire version seems faster since it doesn't perform any div/mul
opcodes. Or am I wrong?

(arch/m68k/lib/udivsi3.S)

Regards,
Luis Alves

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __udivsi3: coldfire vs non-coldfire implementation
  2012-04-24 14:14 __udivsi3: coldfire vs non-coldfire implementation Luis Alves
@ 2012-04-24 15:39 ` Andreas Schwab
  2012-04-24 16:29   ` Luis Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2012-04-24 15:39 UTC (permalink / raw)
  To: Luis Alves; +Cc: linux-m68k

Luis Alves <ljalvs@gmail.com> writes:

> What's the reason for having two different algorithms for this function?
> The coldfire version seems faster since it doesn't perform any div/mul
> opcodes. Or am I wrong?

The coldfire version would require a minimum of 1800 cycles on a 68000.
The 68000 version is dominated by either two divu (max 140 cycles each)
or an lsr loop of max 900 cycles plus divu and two mulu (max 70 cycles
each) plus some 100 cycles for the rest.  That should make it better for
all inputs.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __udivsi3: coldfire vs non-coldfire implementation
  2012-04-24 15:39 ` Andreas Schwab
@ 2012-04-24 16:29   ` Luis Alves
  0 siblings, 0 replies; 3+ messages in thread
From: Luis Alves @ 2012-04-24 16:29 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: linux-m68k

I wasn't aware of the differences in the divide and multiply
instructions (and that some coldfire's don't even have the division
opcodes).

Thanks for the cycle count, it makes sense.

Luis Alves


On Tue, Apr 24, 2012 at 4:39 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Luis Alves <ljalvs@gmail.com> writes:
>
>> What's the reason for having two different algorithms for this function?
>> The coldfire version seems faster since it doesn't perform any div/mul
>> opcodes. Or am I wrong?
>
> The coldfire version would require a minimum of 1800 cycles on a 68000.
> The 68000 version is dominated by either two divu (max 140 cycles each)
> or an lsr loop of max 900 cycles plus divu and two mulu (max 70 cycles
> each) plus some 100 cycles for the rest.  That should make it better for
> all inputs.
>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-24 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-24 14:14 __udivsi3: coldfire vs non-coldfire implementation Luis Alves
2012-04-24 15:39 ` Andreas Schwab
2012-04-24 16:29   ` Luis Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox