CVS Xserver breaks on non-SSE capable i386 machines

Lars Knoll lars at trolltech.com
Sun Jul 24 04:25:34 PDT 2005


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.

Cheers,
Lars

>
> diff -u -r1.9 -r1.10
> --- /cvs/xorg/xc/programs/Xserver/fb/Imakefile	2005/01/19 21:56:07	1.9
> +++ /cvs/xorg/xc/programs/Xserver/fb/Imakefile	2005/07/12 10:02:10	1.10
> @@ -4,17 +4,11 @@
>  XCOMM Id: Imakefile,v 1.1 1999/11/02 03:54:44 keithp Exp $
>
>  #if defined(HasGcc34) && HasGcc34
> -MMXOPTIONS= -mmmx -Winline --param inline-unit-growth=10000 \
> +MMXOPTIONS= -mmmx -msse -Winline --param inline-unit-growth=10000 \
>  	--param large-function-growth=10000 -DUSE_MMX
> -SSEOPTIONS= $(MMXOPTIONS) -msse -DUSE_SSE
> -
> -#if defined(i386Architecture)
> -SpecialCObjectRule(fbmmx,fbmmx.c,$(MMXOPTIONS))
> -#elif defined(AMD64Architecture)
> -SpecialCObjectRule(fbmmx,fbmmx.c,$(SSEOPTIONS))
> -#endif
>
>  #if defined(i386Architecture) || defined(AMD64Architecture)
> +SpecialCObjectRule(fbmmx,fbmmx.c,$(MMXOPTIONS))
>  SpecialCObjectRule(fbpict,fbpict.c,$(MMXOPTIONS))
>  SpecialCObjectRule(fbfill,fbfill.c,$(MMXOPTIONS))
>  SpecialCObjectRule(fbcopy,fbcopy.c,$(MMXOPTIONS))
>
> ---------------------------------------------------------------------
>
> Unless I miss something, this change inconditionally adds "-msse" on
> all i386 machines with gcc 3.4+.
>
>
> The problems are:
>
> 1. "-msse" argument to gcc causes it to generate code using "cmov"
> instruction. Pentium MMX and earlier, and certain VIA C3 CPUs, lack
> cmov instruction, causing Xserver to die with SIGILL.
>
> Fix: Removing "-msse" for those files (fbmmx.c, fbpict.c, fbfill.c,
> fbcopy.c) should fix this problem.
>
>
>
> 2. fbmmx.c does:
> #include <xmmintrin.h> /* for _mm_shuffle_pi16 and _MM_SHUFFLE */
>
> xmmintrin.h (a gcc header file) can't be included unless "-msse" or
> equivalent is passed to gcc:
>
> #ifndef __SSE__
> # error "SSE instruction set not enabled"
>
> fbmmx.c uses _mm_shuffle_pi16 which is pshufw (SSE and not just MMX)
> instruction. fbmmx.c and friends use it when MMX is available (#defined
> USE_MMX and fbHaveMMX()) but it can't work on Pentium MMX and other
> non-SSE capable CPUs.
>
> Fix: xmmintrin.h and "-msse" must not be used, pshufw (if available)
> must be called using other means (asm?) and a replacement routine must
> be written in case no SSE CPU is detected.
>
> Comments?
>
> I can try to fix it if the above is correct.



More information about the xorg mailing list