Re: nasm over gas?

From: Fruhwirth Clemens
Date: Thu Sep 04 2003 - 10:44:51 EST


On Thu, Sep 04, 2003 at 10:57:12PM +0800, Michael Frank wrote:
> On Thursday 04 September 2003 21:44, Yann Droneaud wrote:
> >
> > Using nasm for only one small piece of code would be a regression, imho.
>
> Concur, not worthwhile to start using a fairly unsupported tool in the kernel.
>
> As to using assembler, It is better to get rid of it but in special cases.
> Todays compilers are the better coders in 98+% of applications, and if you
> follow some of the discussions here on the list, you will be amazed what
> people do with a C compiler - all portable and much more maintainable.

The gcc optimized code for sure much better than I do, but gcc's
optimization captabilities is for sure a joke compared to the guy how wrote
2fish_86.asm (just have a look at the source). The assembler implementation
is twice as fast as the C implemention we have in the kernel. Same is true
for AES (although just 50% faster instead of 100%:
http://clemens.endorphin.org/patches/aes-i586-asm-2.5.58.diff . That's gas
btw. )

> I guess your code should be 80-90% C and 10-20% assmbler. This will make it
> up to 10 times a portable.

The Twofish code is C but has hooks to use an asm backend in special cases
(keysetup, en/decrypt). But a plain C version of twofish is already present
in the kernel.

> As to using nasm, note for gas and gcc 3.2+:
>
> + GAS does intel syntax too using the directive
> .intel_syntax

That's certainly nice to hear. At least some cut/pasting can be done :)

Regards, Clemens

Attachment: pgp00001.pgp
Description: PGP signature