Copyright | (c) 2017 Anselm Jonas Scholl |
---|---|
License | BSD3 |
Maintainer | anselm.scholl@tu-harburg.de |
Stability | experimental |
Portability | x86 |
Safe Haskell | Safe |
Language | Haskell2010 |
This module gives access to the CPUID instruction on x86 based systems. The module will still build on other systems but will not provide any useful functionality instead.
- data CpuidArg = CpuidArg {}
- data CpuidResult = CpuidResult {}
- cpuidSupported :: Bool
- cpuid :: CpuidArg -> IO CpuidResult
- cpuidMaybe :: Maybe (CpuidArg -> IO CpuidResult)
- cpuidHighestFunctionParameter :: IO Word32
- type XGetBVArg = Word32
- data XGetBVResult = XGetBVResult {}
- xgetbvSupport :: IO Bool
- xgetbv :: XGetBVArg -> IO XGetBVResult
- xgetbvMaybe :: IO (Maybe (XGetBVArg -> IO XGetBVResult))
- supportsSSE2 :: IO Bool
- supportsAVX2 :: IO Bool
- supportsAVX512f :: IO Bool
CPUID support
Argument for the CPUID instruction.
cpuidSupported :: Bool Source #
True if the platform supports the CPUID instruction (that is, if this code runs on x86 or AMD64).
cpuid :: CpuidArg -> IO CpuidResult Source #
Call the CPUID instruction. If the instruction is not supported, throw an error.
cpuidMaybe :: Maybe (CpuidArg -> IO CpuidResult) Source #
cpuidHighestFunctionParameter :: IO Word32 Source #
Get the highest supported function parameter (EAX) for the CPUID instruction. Returns 0 if CPUID is unsupported.
XGETBV support
xgetbvSupport :: IO Bool Source #
Returns true if the platform supports the XGETBV instruction (that is, if the code runs on x86 or AMD64) AND the processor (or operating system) support it (that is, the OSXSAVE bit is set)
xgetbv :: XGetBVArg -> IO XGetBVResult Source #
Call the XGETBV instruction. If the instruction is not supported, throw an error.
You also have to check for support of the instruction by the operating system
and the processor first (use xgetbvSupport
).
xgetbvMaybe :: IO (Maybe (XGetBVArg -> IO XGetBVResult)) Source #
Utilities
supportsSSE2 :: IO Bool Source #
Check whether the processor indicated support for SSE2. Note that this does not mean the OS will save the XMM upon context switches.
supportsAVX2 :: IO Bool Source #
Check whether OS and CPU support the AVX2 instruction set.
supportsAVX512f :: IO Bool Source #
Check whether OS and CPU support the AVX512f instruction set.