CVS Xserver breaks on non-SSE capable i386 machines

Patrick McFarland pmcfarland at downeast.net
Mon Jul 25 10:41:39 PDT 2005


On Monday 25 July 2005 05:54 am, Lars Knoll wrote:
> On Sunday 24 July 2005 20:56, Patrick McFarland wrote:
> > Except -mmmx/-msse tells gcc to enable/generate mmx and sse instructions
> > (for the longest time, all this did was #define something, in gcc4, from
> > what I understand, gcc can do stuff like vectorizing simple loops and
> > such). Unless the object in question is loaded runtime based on what the
> > CPU supports (ie, in X's plugin architecture), -mmmx/-msse cannot be
> > used.
>
> Well, seems like the gcc docs are wrong then. It clearly states:
>
>        -mmmx
>        -mno-mmx
>        -msse
>        -mno-sse
>        -msse2
>        -mno-sse2
>        -msse3
>        -mno-sse3
>        -m3dnow
>        -mno-3dnow
>            These switches enable or disable the use of built-in functions
> that allow direct access to the MMX, SSE,
>            SSE2, SSE3 and 3Dnow extensions of the instruction set.
>
> It should not generate MMX/SSE specific code, at least according to the
> docs.

I've always interpreted it differently, that -mfoo enables SIMD code 
generation. (Maybe we could get a well known GCC dev to tell us what GCC 
actually is/was doing?)

> Having said that the switches seeem to at least enable the use of CMOV
> instructions which breaks on old Pentium MMX processors.

Because CMOV should be used when its available. If you don't want CMOV, then 
don't -msse.

> > HOWEVER, none of this stops you from using runtime detection and using
> > function pointers to point at different versions of the code depending on
> > what the CPU supports; that doesn't require -mmmx/-msse. This runtime
> > method is also the recommended method of providing mmx and sse enabled
> > code, it allows you to build and run on any computer, no matter if it
> > supports mmx or sse or neither.
>
> That's exactly what we're doing. Problem is that the runtime detection
> routine is compiled with -msse and at least gcc4 then generates CMOV
> instructions in the code making old Pentium processors unhappy.

You're using the gcc intrinsics, instead of just raw assembly embedded in a C 
file, it seems. If you code stuff right, you should never ever ever ever need 
-mfoo to make the code work.

Theres an alternative, however... build the object twice, each with different 
cflags, one with -mmmx, the other with -mmmx -msse. (Yes, it can be done)

-- 
Patrick "Diablo-D3" McFarland || pmcfarland at downeast.net
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd 
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." -- Kristian Wilson, Nintendo, Inc, 1989
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20050725/a25f95b0/attachment.pgp>


More information about the xorg mailing list