Gentoo Archives: gentoo-user

From: Stroller <stroller@××××××××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] USE="mmx mmxext sse sse2 ssse3 3dnow 3dnowext"
Date: Thu, 28 May 2009 19:14:08
Message-Id: 9837B633-4DCD-47E2-9A88-442A0FE750BC@stellar.eclipse.co.uk
In Reply to: Re: [gentoo-user] USE="mmx mmxext sse sse2 ssse3 3dnow 3dnowext" by Daniel Iliev
1 On 28 May 2009, at 11:17, Daniel Iliev wrote:
2 > ...
3 > Not the same thing. "-march=" instructs gcc to produce a binary
4 > designed to run only on the given CPU architecture, while
5 > USE flags instruct the build system to include or not support for a
6 > given feature ...
7
8 Actually, I _think_ in mplayer the difference is that the USE flags
9 enable the use of hand-written assembler code which takes advantage of
10 the MMX or whatever.
11
12 I'm not 100% sure about this at all, but what's the difference in the
13 architectures of the Pentium 2 & the Pentium 3, if not for the support
14 for SSE? (and / or whatever)
15
16 Sure they are designed differently, but surely the instruction sets of
17 all 32-bit processors from the earliest Pentiums even to Core Duos
18 (not Core2s) are all basically x86. Some have these extended
19 instruction sets (EIS, I think you called them earlier in the thread)
20 and those are the additions from one generation to the next. So if you
21 choose -march=pentium3 it will not run on a Pentium 2 because Pentium
22 2s do not have SSSE, and it's the *compiler* that added the code that
23 utilises SSE.
24
25 I believe that mplayer is one of those exceptional packages which uses
26 some assembler optimisations. These don't make any sense for most
27 programs, because it takes too much time to write & much maintenance
28 is loads of hassle, and assembler will make little difference. Most
29 programs are one minute opening a new window, and the next minute are
30 waiting for the mail server to reply and are doing lots of different
31 tasks which are not worth hand optimising. But once mplayer has
32 started decoding a video, then it's doing the same thing time & time
33 again, decoding each frame of the picture - it does exactly the same
34 thing 25 times per second for an hour or two at a time, so that may be
35 worth optimising for if the compiler is found to be less clever than
36 someone like John Carmack.
37
38 I'm not absolutely sure that the USE flags enable hand-written
39 assembler code, but what I do know is that:
40 1) ASM stands for assembler. See http://en.wikipedia.org/wiki/Asm
41 2) Google "mplayer asm" returns a bunch of hits.
42 3) MMX was marketed as "MultiMedia eXtension"
43 4) mplayer is a multimedia player.
44 5) MMX doesn't have floating point support, but SSE adds that and has
45 dedicated functions for multiplying floating point numbers [1], which
46 is just the sort of thing that one are useful in decoding mpegs &
47 playing back video.
48
49 Stroller.
50
51
52
53
54 [1] http://en.wikipedia.org/wiki/Streaming_SIMD_Extensions

Replies

Subject Author
Re: [gentoo-user] USE="mmx mmxext sse sse2 ssse3 3dnow 3dnowext" Ward Poelmans <wpoely86@×××××.com>