Trying to multiply 400 by 2 with inline assembly, using the fact imul
implicity multiplies by eax
. However, i'm getting "undefined reference" compile errors to $1
and $2
int c;
int a = 400;
int b = 2;
__asm__(
".intel_syntax;""mov eax, $1;""mov ebx, $2;""imul %0, ebx;"".att_syntax;"
: "=r"(c)
: "r" (a), "r" (b)
: "eax");
std::cout << c << std::endl;