On Sat, Aug 15, 2009 at 12:48:31AM +0800, Shane Wang wrote:
>
> +/* x86_64 or amd64 */
> +#if (__GNUC__ && (__x86_64__ || __amd64__))
> +
> +#define ADD128(rh, rl, ih, il)                                               
> \
> +     asm ("addq %3, %1 \n\t"                                         \
> +     "adcq %2, %0"                                                   \
> +     : "+r"(rh), "+r"(rl)                                            \
> +     : "r"(ih), "r"(il) : "cc")
> +
> +#define MUL64(rh, rl, i1, i2)                                                
> \
> +    asm ("mulq %3" : "=a"(rl), "=d"(rh) : "a"(i1), "r"(i2) : "cc")
> +
> +#define PMUL64 MUL64

You should not put assembly code in generic header/C files.

In this case, you may not even need them as gcc is capable of
optimising

int bar(u64, u64);
int foo(u64 a, u64 b, u64 c, u64 d)
{
        u64 e;

        b += d;
        e = a + c;
        if (e < a)
                b++;
        return bar(e, b);
}

to

foo:
.LFB2:
        addq    %rdx, %rdi
        adcq    %rcx, %rsi
        jmp     bar

If you really need the assembly, then you should add them as
arch-specific implementations of VMAC, just like AES-x86-64.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to