Computer Chess Club Archives


Search

Terms

Messages

Subject: EMMS: to Dr. Nalimov and other assembly programmers

Author: Dezhi Zhao

Date: 05:50:52 11/08/99

Go up one level in this thread


On November 08, 1999 at 06:28:03, Gunnar Andersson wrote:

>My impression is that many (most?) of the amateur programs use bitboards, and
>several seem to contain Assembler code for basic operations.
>
>Question to programmers: Do you use MMX operations?
>
>To me they seem pretty useful because
>(i)  there are 8 registers of 64 bits each, much better than the old
>     x386 set of registers
>(ii) e.g. shifting a 64-bit register takes only one clock cycle whereas this
>     operation would take 5 (I think) operations when simulated using two
>     32-bit registers
>
>OTOH two 32-bit operations can be performed concurrently in the u- and v- pipes,
>so there's probably no gain if e.g. only ANDs and ORs are performed in a small
>number of 64-bit variables.
>
>I guess it would be even better to use the two integer 32-bit pipes for one
>64-bit operation and the MMX/FP pipe for another 64-bit operation, and in
>loopfree code this might be realizable.
>
>For programs that keep stuff in floating-point variables this might be a bad
>idea - you will have to remember to insert the EMMS instruction before any
>floating-point operation, and this operation takes some time (about 10 clock
>cycles I think, but I haven't looked this up).
>
>/ Gunnar

Hi

I planed to use MMX instructions. However MMX is perhaps not very documented
well by Intel. I searched Intel site and only got a MMX instruction list.

I inlined MMX instructions in a test program. However, the EMMS instruction
really bothered me. The VC6.0 compiler kept warning me that there should
be an EMMS _before_ the end of the function that contains MMX.

As you said, EMMS is a slow instruction. It should be avoided whenever possible.
For short functions an EMMS would eat up all the gain from MMX instructions.
Just like other chess programmers, I use virtually no floating-point stuff
in engine thread. So my question is:
Could I do without EMMS instructions? Or could I leave EMMS in only a few
places, say just before engine thread exit point?

I worried if this simplication is safe for a multi-thread/process program
and the operation system. I am not sure it is safe for the user interaface
thread that is derived from MFC and may use folat instructions.

Any suggestions?

Dezhi Zhao




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.