[cairo] [PATCH] Fixes for ARM features runtime autodetection support

Siarhei Siamashka siarhei.siamashka at gmail.com
Tue Jun 23 16:09:02 PDT 2009


Hi,

That's a continuation of
http://lists.cairographics.org/archives/cairo/2009-May/017234.html

Current git head even got worse in this respect after commit
b6a3868ced67eb363273bfbee0d850c4d06cca34 (Better CFLAGS handling
for recent ARM platforms.)

Let's suppose that we want to build pixman for some old ARM core (lowest
common denominator approach used in some binary distributions) by defining
CFLAGS or using gcc spec file:

CFLAGS="-mcpu=arm920t -O2" ./configure
...
checking whether to use ARM SIMD assembler... no
checking whether to use ARM NEON... no
checking whether to use GNU-style inline assembler... yes
...

=============================

configure:12256: checking whether to use ARM SIMD assembler
configure:12273: 
gcc -c -mcpu=arm920t -O2 -Wall -fvisibility=hidden -march=armv6  conftest.c 
>&5
conftest.c:1: warning: switch -mcpu=arm920t conflicts with -march= switch
/tmp/cc0SLlR0.s: Assembler messages:
/tmp/cc0SLlR0.s:24: Error: selected processor does not support `uqadd8 
r1,r1,r2'
configure:12280: $? = 1
configure: failed program was:
|
| int main () {
|     asm("uqadd8 r1, r1, r2");
|     return 0;
| }
configure:12318: result: no
configure:12340: checking whether to use ARM NEON
configure:12358: gcc -c -mcpu=arm920t -O2 -Wall -fvisibility=hidden -mfpu=neon  
conftest.c >&5
In file included from conftest.c:2:
/usr/lib/gcc/armv4tl-softfloat-linux-gnueabi/4.3.2/include/arm_neon.h:35:2: 
error: #error You must enable NEON instructions 
(e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
conftest.c: In function 'main':
conftest.c:4: error: 'uint8x8_t' undeclared (first use in this function)
conftest.c:4: error: (Each undeclared identifier is reported only once
conftest.c:4: error: for each function it appears in.)
conftest.c:4: error: expected ';' before 'neon_test'
configure:12365: $? = 1
configure: failed program was:
|
| #include <arm_neon.h>
| int main () {
|     uint8x8_t neon_test=vmov_n_u8(0);
|     return 0;
| }
configure:12414: result: no

=============================

Runtime autodetection feature is effectively useless for ARM the way it is
currently implemented in pixman. NEON and ARMv6 SIMD optimizations would be
only used if somebody compiles the whole pixman with gcc options targeting
some modern ARM core.

For ARM SIMD using current gcc versions, -march option can't override -mcpu
(as can be seen in configure log). And NEON requires -mfloat-abi option to be
used.

Two patches to fix these problems are attached. The solution is a bit ugly,
but I don't see any better alternative at the moment if runtime autodetection
has to work right (support old cpu cores with the same binary and still have
cpu-specific optimizations for newer cores activated at runtime).

-- 
Best regards,
Siarhei Siamashka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-mcpu-instead-of-march-for-ARM-SIMD-runtime-aut.patch
Type: text/x-diff
Size: 1005 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20090624/5a218d07/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Added-mfloat-abi-option-for-ARM-NEON-runtime-autode.patch
Type: text/x-diff
Size: 1536 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20090624/5a218d07/attachment-0001.patch 


More information about the cairo mailing list