Generated code not matching expectations with Extended ASM
问题 I have a CpuFeatures class. The requirements for the class are simple: (1) preserve EBX or RBX , and (2) record the values returned from CPUID in EAX/EBX/ECX/EDX . I'm not sure the code being generated is the code I intended. The CpuFeatures class code uses GCC Extended ASM. Here's the relevant code: struct CPUIDinfo { word32 EAX; word32 EBX; word32 ECX; word32 EDX; }; bool CpuId(word32 func, word32 subfunc, CPUIDinfo& info) { uintptr_t scratch; __asm__ __volatile__ ( ".att_syntax \n" #if