CVS Xserver breaks on non-SSE capable i386 machines

Lars Knoll lars at trolltech.com
Mon Jul 25 02:54:15 PDT 2005


On Sunday 24 July 2005 20:56, Patrick McFarland wrote:
> On Sunday 24 July 2005 07:25 am, Lars Knoll wrote:
> > On Sunday 24 July 2005 01:47, Krzysztof Halasa wrote:
> > > Hi,
> > >
> > > It looks like the following change broke Xserver on non-SSE i386
> > > machines (Pentium MMX and earlier, and VIA C3 which lacks cmov
> > > instruction):
> >
> > Hmmm... the SSE/MMX code paths should not  get used on such machines. And
> > -mmmx/-msse should not enable CMOV in the compilation. I'll have a look
> > at it on monday.
>
> 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.

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

> 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.

Lars



More information about the xorg mailing list