Re: Enormous speed difference between C and ASM implementations of crypto algorithm



henno <hennobrandsma@xxxxxxxxxxxxxxxxx> writes:
Tom St Denis wrote:
On Mar 7, 6:40 am, Nomen Nescio <nob...@xxxxxxxxx> wrote:
http://www.das-labor.org/wiki/AVR-Crypto-Lib/en

I was stunned to see that the ASM (assembler) implementation of AES is
more than ten times (!) as fast as the C implementation. I'd have
thought that compiler technology had narrowed the difference to maybe
10-20%. The compiler is probably GCC-AVR, which isn't as advanced as
say, the Microsoft compilers, but the difference is remarkable.

Say what? GCC on x86 *is* more advanced than MSVC by a long shot.
Most lilkely though GCC for AVR isn't 100%. Just like GCC for ARM is
not as good as ARM's own compiler.

It's not uncommon to see assembler based AES 2-3 times faster than C.
It shouldn't be 10x though...

It could be if you used the new AES instructions in x64 chipset introduced in
the i5 and i7 proecessors.

For about a week until someone patches the compiler to include
a new intrinsic and use the new instruction.

Phil
--
I find the easiest thing to do is to k/f myself and just troll away
-- David Melville on r.a.s.f1
.



Relevant Pages

  • Re: Auto-preservation of non-volatile registers by inline assembler
    ... GCC would produce when grepping for ebx. ... if you meant that mostly the compiler will pick ebx before any other ... to bypass the restrictions of your inline assembler. ...
    (comp.lang.asm.x86)
  • Re: Need help doing a jmp rather than a call
    ... I am using GCC. ... be custom to the C compiler being used. ... Here is the errant assembler code (the ...
    (comp.lang.asm.x86)
  • Re: LPC900/80C51 Compiler Toolchain
    ... The short answer is 'No' - you can't use any GCC version beyond 2.9. ... Gcc 2.9x for the ARM was very poor, ... compile them to assembler source first. ... With modern compilers, there is seldom good reason for hand-optimising your assembly unless you are taking advantage of specific features that your compiler is unaware of. ...
    (comp.arch.embedded)
  • Re: Auto-preservation of non-volatile registers by inline assembler
    ... GCC would produce when grepping for ebx. ... if you meant that mostly the compiler will pick ebx before any other ... Compile the altered function with an assembler (out- ...
    (comp.lang.asm.x86)
  • Re: Definition of BUG on x86
    ... assembler instruction which is generated by the compiler. ... GCC will honour it AFAICS), but if GCC _thinks_ that the ...
    (Linux-Kernel)