[Pixman] [PATCH] SIMD: Try without any CFLAGS before forcing -mcpu=

Siarhei Siamashka siarhei.siamashka at gmail.com
Wed Mar 10 06:54:38 PST 2010


On Tuesday 09 March 2010, lool at dooz.org wrote:
> From: Loïc Minier <loic.minier at ubuntu.com>
>
> http://bugs.launchpad.net/bugs/535183

I would prefer a bit more descriptive comment (with the details copied from
that launchpad page). Also 'SIMD' is too generic term, summary would be better
to start with something like 'ARM:' prefix.

> ---
>  configure.ac |   20 +++++++++++++++-----
>  1 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index dcfbfa9..fed97b1 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -363,18 +363,28 @@ AM_CONDITIONAL(USE_VMX, test $have_vmx_intrinsics =
> yes)
>
>  dnl
> ===========================================================================
> dnl Check for ARM SIMD instructions
> -ARM_SIMD_CFLAGS="-mcpu=arm1136j-s"
> +ARM_SIMD_CFLAGS=""
>
>  have_arm_simd=no
>  AC_MSG_CHECKING(whether to use ARM SIMD assembler)
> -xserver_save_CFLAGS=$CFLAGS
> -CFLAGS="$ARM_SIMD_CFLAGS $CFLAGS"
> +# check with default CFLAGS in case the toolchain turns on a sufficiently
> recent -mcpu= AC_COMPILE_IFELSE([
>  int main () {
>      asm("uqadd8 r1, r1, r2");
>      return 0;
> -}], have_arm_simd=yes)
> -CFLAGS=$xserver_save_CFLAGS
> +}], have_arm_simd=yes,
> +    # check again with an explicit -mcpu= in case the toolchain defaults
> to an +    # older one; note that uqadd8 isn't available in Thumb mode on
> arm1136j-s +    # so we force ARM mode
> +    ARM_SIMD_CFLAGS="-mcpu=arm1136j-s -marm"
> +    xserver_save_CFLAGS=$CFLAGS
> +    CFLAGS="$ARM_SIMD_CFLAGS $CFLAGS"
> +    AC_COMPILE_IFELSE([
> +    int main () {
> +        asm("uqadd8 r1, r1, r2");
> +        return 0;
> +    }], have_arm_simd=yes)
> +    CFLAGS=$xserver_save_CFLAGS)
>
>  AC_ARG_ENABLE(arm-simd,
>     [AC_HELP_STRING([--disable-arm-simd],

Patch looks mostly OK to me and improves arm simd support a bit. It still
fails with CFLAGS="-O2 -mthumb" (and toolchain configured to compile for armv4
by default):

configure:12806: checking whether to use ARM SIMD assembler
configure:12822: 
gcc -c -O2 -mthumb -Wall -fno-strict-aliasing -fvisibility=hidden  conftest.c 
>&5
/tmp/ccsOMtsw.s: Assembler messages:
/tmp/ccsOMtsw.s:23: Error: selected processor does not support `uqadd8 
r1,r1,r2'
configure:12829: $? = 1
configure: failed program was:
| 
| int main () {
|     asm("uqadd8 r1, r1, r2");
|     return 0;
| }
configure:12858: 
gcc -c -mcpu=arm1136j-s -marm -O2 -mthumb -Wall -fno-strict-aliasing -fvisibility=hidden  
conftest.c >&5
/tmp/cc4t9ytW.s: Assembler messages:
/tmp/cc4t9ytW.s:23: Error: selected processor does not support `uqadd8 
r1,r1,r2'
configure:12865: $? = 1
configure: failed program was:
| 
|     int main () {
|         asm("uqadd8 r1, r1, r2");
|         return 0;
|     }
configure:12906: result: no


But that was also happening earlier, so it is not a regression.


In my opinion the best solution overall would be to move all the assembly
optimizations into separate .S files also for legacy ARM processors and
get rid of these compiler option hacks. I think that bringing support for
legacy ARM processors into a better shape is quite realistic even for 0.18.0
stable release, which is due to be released this month. But it can only happen
if enough people are interested in this, and more importantly, are ready to
actively participate in testing.

So the options are either to apply this patch or try to do something better.

-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list