[Mesa-dev] [PATCH] i965: Compile the driver with -march=core2.

Roland Scheidegger sroland at vmware.com
Fri Jan 25 15:13:23 PST 2013


I'm quite sure there are g965 boards around which indeed support Pentium
4 (and P4-based Celerons) (but yes I guess cmov and at least sse2 are
safe - not that the p4 had a usable cmov implementation as it was
incredibly slow IIRC but it should at least work).

Roland


Am 25.01.2013 04:33, schrieb Eric Anholt:
> While most of our development and testing is on x86-64, some of our
> major consumers of the driver are on i386 still.  This meant they aren't
> taking advantage of SSE for floating point math or cmov instructions,
> unless the user went out of their way to choose a -march flag
> (unlikely).  Given that the driver can only get probed on i965 and newer
> chipsets, which only support core2 and above CPUs, this is safe.
> 
> Improves (32-bit) GLbenchmark 2.1 offscreen performance by .76 +/- 0.35%
> (n=19)
> ---
>  configure.ac                          |   17 +++++++++++++++++
>  src/mesa/drivers/dri/i965/Makefile.am |    3 ++-
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index e769eda..0af3176 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -492,6 +492,23 @@ if test "x$enable_asm" = xyes; then
>  fi
>  AC_SUBST([MESA_ASM_FILES])
>  
> +# If the user hasn't set an explicit -march flag, then autodetect a few for
> +# use by the i965 driver.
> +if echo $CFLAGS | grep -v march > /dev/null; then
> +    case "$host_cpu" in
> +        i?86 | x86_64)
> +            save_CFLAGS="$CFLAGS"
> +            AC_MSG_CHECKING([whether $CC supports -march=core2])
> +            CFLAGS="$save_CFLAGS -march=core2"
> +            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[]])],
> +                              [AC_MSG_RESULT([yes]); MARCH_CORE2="-march=core2"],
> +                              [AC_MSG_RESULT([no]); MARCH_CORE2=""])
> +            CFLAGS="$save_CFLAGS"
> +            ;;
> +    esac
> +fi
> +AC_SUBST([MARCH_CORE2])
> +
>  dnl Check to see if dlopen is in default libraries (like Solaris, which
>  dnl has it in libc), or if libdl is needed to get it.
>  AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
> diff --git a/src/mesa/drivers/dri/i965/Makefile.am b/src/mesa/drivers/dri/i965/Makefile.am
> index dc140df..d5d0631 100644
> --- a/src/mesa/drivers/dri/i965/Makefile.am
> +++ b/src/mesa/drivers/dri/i965/Makefile.am
> @@ -38,7 +38,8 @@ AM_CFLAGS = \
>  	$(DEFINES) \
>  	$(API_DEFINES) \
>  	$(VISIBILITY_CFLAGS) \
> -	$(INTEL_CFLAGS)
> +	$(INTEL_CFLAGS) \
> +	$(MARCH_CORE2)
>  
>  AM_CXXFLAGS = $(AM_CFLAGS)
>  
> 


More information about the mesa-dev mailing list