#define vec_mult _vec_mult INLINE int _vec_mult(int x, int y) { int result; asm ( "movl %1 , %0 ; " "imull %2 ; " /* do the multiply */ "movl %%edx , %%eax ; " : "=&a" (result) /* the result has to go in eax */ : "mr" (x), /* x and y can be regs or mem */ "mr" (y) : "%edx", "%cc" /* clobbers edx and flags */ ); return result; } #endif
INLINE int _vec_mult(int x, int y) { int res_hi, res_lo; __asm__ __volatile__ ("smull\t%1,%0,%2,%3" : "=r"(res_hi), "=r"(res_lo) : "r"(x), "r"(y) ); return res_hi; }