[Liboil] liboil issue with float point cross compile?

Nathan Fain cyphunk at gmail.com
Mon Dec 5 14:10:53 PST 2005

Nathan Fain wrote:
> Stephane Fillod wrote:
>> 405GP PowerPC has no FPU, not even light. Compilers generally use soft emulation.
>> BTW, the problem will be the same for some PowerPC's from Freescale which don't
>> have a traditional FPU, e.g. SPE, ..
>> To fix this problem, a check along what is done in m4/as-intrinsics.m4
>> should be done on powerpc-* systems to check if "lfd"/etc. assembly
>> instructions are available. Then with some autoconf magic and a define
>> like HAVE_PPC_FPU_INSTRUCTIONS, conditionaly compile conv.c.
>> Another solution is to find an option for soft-float gcc to make it
>> accept hard FPU instructions. Then, with a new OIL_IMPL_FLAG_PPC_FPU,
>> enable or disable implementation using powerprc fpu instructions.
>> Any other ideas?
> I didn't see anything related to powerpc in the m4/as-intrinsics.m4
> other than the Altivec tests:
>    AC_TRY_COMPILE([#include <altivec.h>],
>       [__vector a; a = vec_or(a,a)],
>       [flag_ok=yes],
>       [flag_ok=no])
> Or were you suggesting I manually add a test in as-intrinsics.m4 for
> lfd,lfs and skip (fail?) if not? 
> Wait, I suppose this was a suggestion for David and not me as I see now
> that the current CVS repository shows the HAVE_GCC_ASM_POWERPC_FPU
> option (... I was wondering why nothing turned up on google ;)).
> First, note that the ./configure test for HAVE_GCC_ASM_POWERPC_FPU
> evaluates to "yes":
> "checking if compiler supports FPU instructions on PowerPC... yes"
> Second, I tried to compile the CVS version and I run into a different
> problem before getting to the conv.c issue:
>  powerpc-linux-gcc -DHAVE_CONFIG_H -I. -I. -I../.. -Wall -Werror
> -Wa,-mregnames -D_BSD_SOURCE -D_GNU_SOURCE -I../.. -O2 -g -O2 -MT
> lib_c_la-swab.lo -MD -MP -MF .deps/lib_c_la-swab.Tpo -c swab.c  -fPIC
> -DPIC -o .libs/lib_c_la-swab.o
> swab.c: In function `swab_u32_asm':
> swab.c:177: error: unknown register name `eax' in `asm'
> make[3]: *** [lib_c_la-swab.lo] Error 1
> make[3]: Leaving directory `/build/liboil-cvs/liboil/liboil/c'
> Does it think I'm on an x86 platform?  The ./configure evaluates "true"
> for Altivec and false for the other intrinsic tests. 
> I do not know if it matters but the powerpc-linux-gcc was compiled with
> the --with-float=soft option.

Okay, I looked at the checks that David placed in the CVS conv.c and
made the same checks in the stable version where I originally had the
problem, affectively removing the problem functions, and all is well
now.  Compile completes.  I suppose if the package that required liboil
works okay then I didn't break anything by removing those functions.

More information about the Liboil mailing list