Just wondering about MMX

nismotigerwvu

Golden Member
May 13, 2004
1,568
33
91
This one might be more relevant to the "oldtimers" or programmers, but I was just wondering how widespread the use of MMX instructions became/is? I know they were limited to integer applications and actually usurped registers from X87(making it difficult to use MMX along side any FP work), but have these instructions managed to wiggle into the default codepath (to any meaningful degree) in any widely used compiler or have they more faded off into history?
 

ShintaiDK

Lifer
Apr 22, 2012
20,378
146
106
They have been superseeded by SSE. So I dont think they are really used anymore.

In 64bit mode, MMX, x87 etc is gone. SSE2 replaced those.
 

nismotigerwvu

Golden Member
May 13, 2004
1,568
33
91
I kind of figured that they were all but gone in X64 (why would AMD have placed any emphasis on them anyways), but I was more curious as to how widely they were incorporated at their peak more or less.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,703
4,661
75
I don't think compiler makers got caught up to vectorization very much until MMX was already out of the picture. I see that by 2003 both Intel and AMD had SSE2 in their processors. Meanwhile, GCC wasn't even working on vectorization until 2004, by which point they focused on sse/sse2. It looks like they still don't do MMX vectorization automatically.

Of course, GCC is a Free compiler. I'm sure Intel's compiler had some sort of MMX support at some point. I'm not sure about Microsoft, but I gather they weren't doing much either.

And by the way, x87 isn't gone in X64. I've used it. Sometimes you just need 80-bit floating point numbers. :p
 

jhu

Lifer
Oct 10, 1999
11,918
9
81
And by the way, x87 isn't gone in X64. I've used it. Sometimes you just need 80-bit floating point numbers. :p

I think he meant that almost nobody uses them rather than those entities not existing in 64-bit mode.
 

nismotigerwvu

Golden Member
May 13, 2004
1,568
33
91
I don't think compiler makers got caught up to vectorization very much until MMX was already out of the picture. I see that by 2003 both Intel and AMD had SSE2 in their processors. Meanwhile, GCC wasn't even working on vectorization until 2004, by which point they focused on sse/sse2. It looks like they still don't do MMX vectorization automatically.

Of course, GCC is a Free compiler. I'm sure Intel's compiler had some sort of MMX support at some point. I'm not sure about Microsoft, but I gather they weren't doing much either.

And by the way, x87 isn't gone in X64. I've used it. Sometimes you just need 80-bit floating point numbers. :p

Ahh, this is exactly what I was looking for, thanks.
 

ShintaiDK

Lifer
Apr 22, 2012
20,378
146
106
oua4qb.png


You could also simplify it with that MMX, 3Dnow and x87 aint supported in long mode arcording to AMDs AMD64 specs.
 
Last edited:

cytg111

Lifer
Mar 17, 2008
26,275
15,686
136
How much die realestate could be saved by dropping those legacy apis?
Could it be worth it to produce a 64-bit-only version ?
 

bronxzv

Senior member
Jun 13, 2011
460
0
71

mmm, this is a *2003* slide about supposed Windows ABI limitations at the time, isn't it?

for more recent data look at up to date material like:
http://support.amd.com/us/Processor_TechDocs/24592_APM_v1.pdf
see 6.1.3 page 280 for example :

"
x87 floating-point instructions can be executed in any of the architecture’s operating modes. Existing
x87 binary programs run in legacy and compatibility modes without modification. The support
provided by the AMD64 architecture for such binaries is identical to that provided by legacy x86​
architectures.
"
 

ShintaiDK

Lifer
Apr 22, 2012
20,378
146
106
You can use x87 in Linux for example, but not in Windows. In Windows MMX, 3DNow! and x87 is unavaliable from long mode.
 

Lonyo

Lifer
Aug 10, 2002
21,938
6
81
How much die realestate could be saved by dropping those legacy apis?
Could it be worth it to produce a 64-bit-only version ?

Very unlikely. Considering how many transistors made up an entire CPU back when MMX was introduced, and how many are in a processor now, it's probably fractions of square mm in savings.
 

ShintaiDK

Lifer
Apr 22, 2012
20,378
146
106
not obvious for me, help me please!

Example:
http://technet.microsoft.com/en-us/query/ee418798
http://msdn.microsoft.com/en-us/library/windows/desktop/ee418798%28v=vs.85%29.aspx#ID4EAAAC

The x87, MMX, and 3DNow! instruction sets are deprecated in 64-bit modes. The instructions sets are still present for backward compatibility for 32-bit mode; however, to avoid compatibility issues in the future, their use in current and future projects is discouraged.
 
Last edited:

bronxzv

Senior member
Jun 13, 2011
460
0
71

they are only mentioned as deprecated for the assembler, btw your quote is very misleading out of context (on purpose?), 99.99%+ of the x87 code is probably user-mode compiler generated code and thus for most practical purposes x87 code is fully supported on 64-bit Windows in other words your "You can use x87 in Linux for example, but not in Windows." statement is plain wrong

btw I know it *first hand* since I routinely use x87 code in my 64-bit code on Windows 7 (for example for transcendentals)
 
Last edited:

ShintaiDK

Lifer
Apr 22, 2012
20,378
146
106
they are only mentioned as deprecated for the assembler, btw your quote is very misleading out of context (on purpose?), 99.99%+ of the x87 code is probably user-mode compiler generated code and thus for most practical purpose x87 code is fully supported on 64-bit Windows in other words your "You can use x87 in Linux for example, but not in Windows." statement is plain wrong

In 32bit apps? Yes, 64bit apps? No.

You should read the entire statement.
 

bronxzv

Senior member
Jun 13, 2011
460
0
71
sorry, to be more clear these two *entire* statements of yours are plain wrong:

"You could also simplify it with that MMX, 3Dnow and x87 aint supported in long mode arcording to AMDs AMD64 specs."

"You can use x87 in Linux for example, but not in Windows. In Windows MMX, 3DNow! and x87 is unavaliable from long mode."
 
Last edited:

cytg111

Lifer
Mar 17, 2008
26,275
15,686
136
support.amd.com/us/Processor_TechDocs/26569_APM_v5.pdf

says on page 215

"...The x87 floating-point
instructions are used in legacy floating-point applications..."

and then

"...The x87 instructions can be used in legacy mode or long mode. Their use in long mode is available if
the following CPUID function bit is set to 1:Long Mode, indicated by bit 29 of CPUID function 8000_0001h. ..."

For what it is worth.
 

bronxzv

Senior member
Jun 13, 2011
460
0
71
"...The x87 instructions can be used in legacy mode or long mode. Their use in long mode is available if
the following CPUID function bit is set to 1:Long Mode, indicated by bit 29 of CPUID function 8000_0001h. ..."

good catch, though it's not very clear since they don't say if it's bit #29 of EAX,EBX,ECX or EDX

http://support.amd.com/us/Embedded_TechDocs/25481.pdf

this looks like an AMD only flag, maybe due to the missing support for x87 in long mode on early chips, this will explain the obsolete slide posted by someone above
 

ShintaiDK

Lifer
Apr 22, 2012
20,378
146
106
Its not obsolete, its been that since day 1. You seem to confuse what different OSes support. Windows do not support MMX/3Dnow!/x87 in long mode.

Legacy MMX/x87 Registers

In 64-bit versions of Windows, the operating system preserves the MMX/x87 registers across thread (and process) switches. However, there is no explicit calling convention for the MMX/x87 registers. Code that is produced by the 64-bit compiler for x64 processors does not use these registers and does not preserve them across function calls.
The use of the MMX/x87 registers is strictly prohibited in 64-bit kernel-mode code. Typically, this restriction affects only assembly-language programmers. The 64-bit compiler for x64 processors automatically converts floating-point operations to SSE instructions.
 
Last edited: