[英]Reason for the “ impossible constraint in ‘asm” error in below code
I think documentation answers this question. 我认为文档可以回答这个问题。 You probably have x86 code that you are building for x86-64.
您可能具有要为x86-64构建的x86代码。 A is valid for x86, but not for x86-64.
A对x86有效,但对x86-64无效。 GCC documentation explains how to replace A by a for x86-64:
GCC文档说明了如何用x86-64替换A:
"This is not correct on x86-64 as it would allocate tick in either ax or dx. You have to use the following variant instead:" “这在x86-64上是不正确的,因为它将在ax或dx中分配刻度。您必须使用以下变体:”
unsigned long long rdtsc (void)
{
unsigned int tickl, tickh;
__asm__ __volatile__("rdtsc":"=a"(tickl),"=d"(tickh));
return ((unsigned long long)tickh << 32)|tickl;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.