"& Amp;" usage questions in inline assembly-general Linux technology-Linux technology and application information. The following is a detailed description. In the preparing-asm_3 document, there is such an example as mentioned:
"
_ Asm _ ("popl % 0 \ n \ t"
"Movl % 1, % esi \ n \ t"
"Movl % 2, % edi \ n \ t"
: "= & A" (_ out)
: "A" (_ in1), "c" (_ in2 ));
In this example, because _ out already specifies the register % eax and uses the Symbol & modifier, it is invalid to specify the register % eax for _ in1.
"
However, you can see in the source code:
Static inline int strcmp (const char * cs, const char * ct)
{
Int d0, d1;
Register int _ res;
_ Asm _ volatile __(
"1: \ tlodsb \ n \ t"
"Scasb \ n \ t"
"Jne 2f \ n \ t"
"Testb % al, % al \ n \ t"
"Jne 1b \ n \ t"
"Xorl % eax, % eax \ n \ t"
"Jmp 3f \ n"
"2: \ tsbbl % eax, % eax \ n \ t"
"Orb $1, % al \ n"
"3 :"
: "= A" (_ res), "= & S" (d0), "= & D" (d1)
: "1" (cs), "2" (ct ));
Return _ res;
}
Input constraints: "1", that is, the specified "= & S" (d0 ),
This is not a theory:
However, if you have already specified & modifier for an Output operation expression and a fixed register, you cannot specify this register for any Input operation expression. Otherwise, a compilation error occurs.
Conflict?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service