x86 128 位原子操作
如何在 x86 中实现 128 位原子操作?
Intel 的系统编程指南,第 1 部分,8.1 锁定原子操作指定了有保证的 16 位、32 位和 64 位原子操作。那么,可以通过执行 2 个带有 LOCK 前缀的 64 位操作来实现 128 位原子操作吗?就像...
LOCK mov 64bits->addr
LOCK mov 64bits->addr+64bits
显然 SSE 有 128 位 XMM 寄存器。您可以使用这些寄存器进行 128 位比较和交换吗?
How would you achieve 128-bit atomic operations in x86?
Intel's System Programming Guide, Part 1, 8.1 Locked Atomic Operations specifies guaranteed 16-, 32-, and 64-bit atomic operations. So, can you achieve 128-bit atomic operations by doing 2 64-bit ops with the LOCK prefix? Something like...
LOCK mov 64bits->addr
LOCK mov 64bits->addr+64bits
Aparently SSE has 128-bit XMM registers. Can you just do 128-bit compare-and-swap using these registers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
LOCK
前缀不能与MOV
指令结合使用。这样做会生成无效操作码异常。所以
LOCK CMPXCHG16B
是这里唯一的方法。The
LOCK
Prefix can not be used in combination withMOV
instruction.Doing so will generate an Invalid Opcode Exception. So
LOCK CMPXCHG16B
is the only way here.