pclmulqdq

· · 个人记录

typedef unsigned long long ull;

ull mult(ull x,ull y)
{
    __m128i a_vec, b_vec;
    __asm__ ("movq %1, %0" : "=x" (a_vec) : "r" (x));
    __asm__ ("movq %1, %0" : "=x" (b_vec) : "r" (y));
    __asm__ ("pclmulqdq $0x00, %1, %0" : "+x" (a_vec) : "x" (b_vec));
    x=a_vec[0];y=a_vec[1];
    return (y<<1)^(y<<2)^x^(9223372036854775811ull&-(x>>63));
}