AT&T &r作用

:"=&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

转载于:https://www.cnblogs.com/moonflow/archive/2012/04/21/2461634.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值