Detecting extensions of the host processor

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Detecting extensions of the host processor

Henning Thielemann-4
I like to detect at runtime whether the processor my program runs on has
certain extensions (SSE2, SSE3 or so) in order to execute optimized
code. On Linux I can process the contents of /proc/cpuinfo but this will
not work on Windows. Is there a portable way in Haskell?

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Detecting extensions of the host processor

Evgeny Tarasov-2
If you use intel processor, you should call 'cpuid' assembler
instruction to obtain this info.

Look at this document for the instruction semantics:
http://www.intel.com/Assets/PDF/manual/253666.pdf

There is a wrapper for cpuid in haskell:
http://hackage.haskell.org/package/cpuid


Henning Thielemann wrote:

> I like to detect at runtime whether the processor my program runs on
> has certain extensions (SSE2, SSE3 or so) in order to execute
> optimized code. On Linux I can process the contents of /proc/cpuinfo
> but this will not work on Windows. Is there a portable way in Haskell?
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe