How to Detect the Pentium® M Processor


Determine whether the target system is based on the Pentium® M processor. Before enabling optimizations that are specific to the Pentium M processor, an application should ensure that the machine it is running on is based on a Pentium M processor.


Use the CPUID instruction. To see if the processor supports CPUID, check the ID flag (bit 21) in the EFLAGS register. If the software can set and clear this flag, the processor supports the CPUID instruction.

When the CPUID instruction (opcode 0F A2) is executed, processor identification information is placed into the EAX, EBX, ECX and EDX registers, depending on the input parameters stored initially in the EAX register. If the EAX register contains 00H, then CPUID will return 02H for all 32-bit Intel® processors, Pentium® II or later.

Assuming that the first execution of CPUID has revealed the 02H value, a subsequent execution with the value 01H in the EAX register will return a brand index in the low byte of the EBX register. A returned value of 16H indicates that the system is using the Pentium M processor.

More detail about CPUID and its other functions - such as detecting cache sizes, maximum clock speed of the processor, and whether it is a genuine Intel® processor - is available in the Intel® 64 and IA-32 Architectures Software Developer's Manual, Volume 2A: Instruction Set Reference, A-M.


"Shifting into Mobile Gear"


For more complete information about compiler optimizations, see our Optimization Notice.