How prevalent are old x64 processors lacking the cmpxchg16b instruction?
The cmpxchg16b instruction for doing atomic 128 bit memory exchanges is not supported on old versions of the x64 processor but it seems like this has been supported by newer versions of the processor for several years now. How likely am I to encounter a 64-bit machine with an old processor that lacks this instruction?
Solution 1:
You are looking at early AMD 64-bit processors, before Rev F (which is when they moved to DDR2 memory). There is some early stepping D Intel Noconas too that did not support it, I think, but these are rarer.
Solution 2:
I have no data regarding the prevalence of certain types of CPUs, so I can't directly answer your question. However, you can find out whether the CPU supports CMPXCHG16B
by checking whether CPUID.01h.ECX.bit13
is 1
(available) or 0
(not available).
Also note that Intel's manuals suggest that for this instruction to be carried out atomically, you need to combine it with the LOCK
prefix.
Solution 3:
Support in the CPU may not actually be enough as some Core 2 users found out on the launch of Windows 8.1, particularly those having an Intel DP35DP motherboard. I'm not yet sure what in the motherboard could prevent CMPXCHG16B from working. Probably the feature detection bits can be disabled by BIOS. To summarize what Yuhong Bao's blog says on this, there was a processor errata in early Core 2 chips (E0/R0 steppings of the 45nm Core 2) that caused their features to be misreported via CPUID. It was possible to work around this via BIOS/microcode update, as far as I can tell.