[hashcash] Re: cpu detection, disabling mmx code on non mmx cpu (Re: Re: status of hashcash version 1?)

  • From: Jonathan Morton <chromi@xxxxxxxxxxxxxxxxxxxxx>
  • To: hashcash@xxxxxxxxxxxxx
  • Date: Tue, 3 Aug 2004 20:57:27 +0100

To be sure I understood correctly: the MMX detection and "switching
out of circuit" of the MMX instruction using assembler code you wrote
are both done by you right?

Ie the compiler by itself a) does not produce MMX code, and b) does
not help you dumping out with SIGILL on non MMX capable CPUs if you do
write MMX code.

But for your libfastmint you have done this work (eg the assembler
code in minter_mmx_compact_1_test) so one could just go ahead and
compile with MMX enabled and the code adapts to the presence or
absence of MMX on the processor (modulo the level of testing given
time frame before release).

Yes, that's correct. The detection code relies on the CPUID instruction being present (which is why it'll probably break nastily on old CPUs like the 386), but it can in turn be short-circuited out by compiling without MMX support.


--------------------------------------------------------------
from:     Jonathan "Chromatix" Morton
mail:     chromi@xxxxxxxxxxxxxxxxxxxxx
website:  http://www.chromatix.uklinux.net/
tagline:  The key to knowledge is not to rely on people to teach you it.


Other related posts: