您的位置:首页 > 其它

AT&T &r作用

2012-04-21 16:24 155 查看
:"=&r"(val)

:"r"(1),"r"(lock):

"&" : Means that this operand is an earlyclobber operand, which is modified before the instruction is finished using the input operands. Therefore, this operand may not lie in a register that is used as an input operand or as part of any memory address.

可以理解为:'&'表示该输出操作('&'只用于修饰输出)完成于其他输入操作完成之前。因此需要确保对应寄存器中的值不能被其他的输入操作篡改。(怎样确保呢?输入输出使用不同的寄存器就行了。实际上'&'约束就是这个意思。)
http://hi.baidu.com/_kouu/blog/item/d4430a81516d16de9123d9f9.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: