XCode/MMX: no automatic EMMS instruction
XCode/MMX: no automatic EMMS instruction
- Subject: XCode/MMX: no automatic EMMS instruction
- From: Mark Coniglio <email@hidden>
- Date: Wed, 16 Aug 2006 11:37:26 -0400
Sorry if this has been discussed -- I tried searching the archives
for this, but the search function isn't working today.
--------
I discovered today that XCode/GCC doesn't automatically produce the
emms instruction at the end of an MMX routine. The emms instruction
is required to restore proper floating point operation after using
MMX instructions.
See http://www.tommesani.com/MMXPrimer.html and
http://www.tacc.utexas.edu/services/userguides/intel/c_ug/linux336.htm
CodeWarrior automatically produces an emms at the end of the routine,
so all my MMX routines for Windows worked fine when compiled under CW.
But, upon compiling the Universal Binary under XCode, things broke in
very unpredictable ways. I witnessed several weird bugs, some of
which had to do with floating point, and some of which appeared as
wacky behavior in QuickTime calls.
It's an easy fix -- just add the emms call at the end of your
assembly routine, e.g.
pop eax
pop ebx
#if TARGET_OS_MAC
emms
#endif
Note that I wrapped the emms with an #if/#endif since it costs 50
cycles to execute it -- and I don't want it twice when I compile for
Windows.
Best,
Mark
--
=====================================================================
Mark Coniglio, Artistic Co-Director | email@hidden
Troika Ranch Dance Theater | http://www.troikaranch.org
=====================================================================
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden