How prevalent are old x64 processors lacking the cmpxchg16b instruction?

8

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?

Christopher Barber

Posted 2010-09-09T19:45:06.600

Reputation: 181

12Your most important customer certainly have one of those in one of their critical production server thats used only for important tasks run on Christmas Eve, but nowhere else, and absolutely not in the test environment... – None – 2010-09-09T20:06:41.300

7I don't think question this should have been migrated to superuser. It just ensures that fewer people who know the answer will ever see this question. – Christopher Barber – 2010-09-21T19:09:52.447

Answers

6

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.

Yuhong Bao

Posted 2010-09-09T19:45:06.600

Reputation: 425

4

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.

PhiS

Posted 2010-09-09T19:45:06.600

Reputation:

Yes, I know how to check the cpuid result. The issue is what to do if it is not supported. I would rather not waste time working around a missing instruction if I am never going to see that case in practice. – Christopher Barber – 2010-09-09T20:37:11.833

@Christopher Barber - CPUID has been supported since late 486 processors, which also implies that every 64-bit capable x86 processor will support CPUID. – None – 2010-09-10T06:49:15.677

2@PhiS: I'm pretty sure Christopher was talking about the lack of support for the cmpxchg16b. What to do if that is missing – Bahbar – 2010-09-10T08:01:16.230

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.

Fizz

Posted 2010-09-09T19:45:06.600

Reputation: 298