4 out of 5 rated this helpful - Rate this topic

IsProcessorFeaturePresent function

Applies to: desktop apps | Metro style apps

Determines whether the specified processor feature is supported by the current computer.

Syntax

BOOL WINAPI IsProcessorFeaturePresent(
  __in  DWORD ProcessorFeature
);

Parameters

ProcessorFeature [in]

The processor feature to be tested. This parameter can be one of the following values.

ValueMeaning
PF_3DNOW_INSTRUCTIONS_AVAILABLE
7

The 3D-Now instruction set is available.

PF_CHANNELS_ENABLED
16

The processor channels are enabled.

PF_COMPARE_EXCHANGE_DOUBLE
2

The atomic compare and exchange operation (cmpxchg) is available.

PF_COMPARE_EXCHANGE128
14

The atomic compare and exchange 128-bit operation (cmpxchg16b) is available.

Windows Server 2003 and Windows XP/2000:  This feature is not supported.
PF_COMPARE64_EXCHANGE128
15

The atomic compare 64 and exchange 128-bit operation (cmp8xchg16) is available.

Windows Server 2003 and Windows XP/2000:  This feature is not supported.
PF_FLOATING_POINT_EMULATED
1

Floating-point operations are emulated using a software emulator.

This function returns a nonzero value if floating-point operations are emulated; otherwise, it returns zero.

PF_FLOATING_POINT_PRECISION_ERRATA
0

On a Pentium, a floating-point precision error can occur in rare circumstances.

PF_MMX_INSTRUCTIONS_AVAILABLE
3

The MMX instruction set is available.

PF_NX_ENABLED
12

Data execution prevention is enabled.

Windows XP/2000:  This feature is not supported until Windows XP with SP2 and Windows Server 2003 with SP1.
PF_PAE_ENABLED
9

The processor is PAE-enabled. For more information, see Physical Address Extension.

All x64 processors always return a nonzero value for this feature.

PF_RDTSC_INSTRUCTION_AVAILABLE
8

The RDTSC instruction is available.

PF_SECOND_LEVEL_ADDRESS_TRANSLATION
20

Second Level Address Translation is supported by the hardware.

PF_SSE3_INSTRUCTIONS_AVAILABLE
13

The SSE3 instruction set is available.

Windows Server 2003 and Windows XP/2000:  This feature is not supported.
PF_VIRT_FIRMWARE_ENABLED
21

Virtualization is enabled in the firmware.

PF_XMMI_INSTRUCTIONS_AVAILABLE
6

The SSE instruction set is available.

PF_XMMI64_INSTRUCTIONS_AVAILABLE
10

The SSE2 instruction set is available.

Windows 2000:  This feature is not supported.
PF_XSAVE_ENABLED
17

The processor implements the XSAVE and XRSTOR instructions.

Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000:  This feature is not supported until Windows 7 and Windows Server 2008 R2.

 

Return value

If the feature is supported, the return value is a nonzero value.

If the feature is not supported, the return value is zero.

If the HAL does not support detection of the feature, whether or not the hardware supports the feature, the return value is also zero.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winbase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

System Information Functions

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
AVX Processor Instructions Supported & Enabled?
Are there any plans to extend this function to return whether or not avx processor instructions are enabled on a system? It would be nice if there was a parameter to do this perhaps called PF_AVX_ENABLED. If there are no plans to extend this function in this manner, is there any other programmatic way to determine if avx processor instructions are supported on an operating system (other than trying and catching an exception or looking for particular operating system versions)?
64-bit code and feature availability
3D-Now and MMX instruction sets will be reported as unavailable (0 return) in 64-bit code, but on the same system may be reported as available in 32-bit code.  This is most likely related to deprecation of feature sets in 64-bit code/procesors:
MSDN: "64-bit programming for Game Developers" (http://msdn.microsoft.com/en-us/library/windows/desktop/ee418798%28v=vs.85%29.aspx#ID4EAAAC):
"The x87, MMX, and 3DNow! instruction sets are deprecated in 64-bit modes. The instructions sets are still present for backward compatibility for 32-bit mode; however, to avoid compatibility issues in the future, their use in current and future projects is discouraged."
AMD: 3DNow! Instructions are Being Deprecated (http://blogs.amd.com/developer/2010/08/18/3dnow-deprecated/):
"3DNow! instructions are being deprecated and will not be supported in certain upcoming AMD processors. In those processors, the 3DNow! Instructions feature flag bit will not be set."
(AMD also recommends developers move to 64-bit supported SSE instruction sets if possible, as their current processors support them)
C# sample

// Alexander Klimoff

// http://netsources.narod.ru


using System.Runtime.InteropServices;


[DllImport("kernel32.dll")]
static extern bool IsProcessorFeaturePresent(uint ProcessorFeature);
private const int PF_MMX_INSTRUCTIONS_AVAILABLE = 3;

// Check MMX instructions

MessageBox.Show(IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE).ToString());