[RC5] AXP client slow on RC5

bmeyer at cs.monash.edu.au bmeyer at cs.monash.edu.au
Sat Jun 2 06:49:48 EDT 2001

>My question is rather simple: Is it normal for a DPW500au (Digital Alpha 
>Workstation at 500Mhz) to  Benchmark for RC5 core #0 (axp bmeyer) 
>0.00:00:16.60 [806,546.70 keys/sec] ?

That sounds about right.

>I supposed a 64 bit CPU would be better suited to crunch 64bit RC5 

You'd think, wouldn't you? I thought so too, once upon a time.

However, when you look at the actual algorithm, you'll find that all
the arithmetic is done on 32 bit numbers. That puts the Alpha at an
actual *dis*advantage --- there is a frequent need to either clear the
top 32 bits after some calculation, or to explicitly mask a shift count
down to 5 bits, as the Alpha otherwise looks at 6. 32 bit processors 
have need for neither.

Is the clients code optimised for Linux-Alpha or just ported to 
>Linux-Alpha? What other reasons might cause this 'lack of performance'?

The client is optimized to hell and back :) It consists of about 10k
of perfectly pairing instructions, uses all available registers, and 
uses every dirty trick in the book to be just a little bit faster yet :)

Apart from the 32/64 bit problems, there is the lack of a rotate instruction.
Where the x86 and PPC do

    rotate_left reg1, reg2

the AXP client has to do

    mov        reg2, tmp
    and          31, tmp
    and  0xffffffff, reg1   (zero out upper 32 bits in reg1)
    shift_left reg1, reg2
    up_to_l    reg1, reg2   (moves upper 32 bits of reg1 into lower 32 of reg2)
    or         reg2, reg1

Obviously, this will take much more time. Through optimization, one can
sometimes save a few of those steps, but in the end, there are still several
AXP instructions for one x86/PPC instruction.

>Might this be OS-dependant? (I could get my alpha to run WinNT, but it 
>wouldn't be fun that way ;-)

As far as I know, you also wouldn't get nearly as well-optimized a core :)

To make a long story short --- the Alpha sucks for RC5. If you have the
choice, run something else on it.


P.S.: Can someone come up with a use of the rotate instruction outside
      of cryptography?
To unsubscribe, send 'unsubscribe rc5' to majordomo at lists.distributed.net
rc5-digest subscribers replace rc5 with rc5-digest

More information about the rc5 mailing list