On Tue, Jun 30, 2015 at 4:33 AM, Zinovy Nis <zinovy....@gmail.com> wrote:
> Hi.
>
>
> I'm building libgcc for a "iamcu" target (Pentium-like but with
> soft-fp emulation, the only x86 with SoftFP I know) with
> --enable-target-optspace.

Support for  i?86*-*-elfiamcu target has been checked in as of
revision 225199.

>
> It works properly but I noticed that code the size for many arithmetic
> functions is much more larger than for soft-fp emulation provided by
> LLVM's compiler_rt library.
>
> For example addsf3 (addition of 2 floats) is 0.5K in compiler_rt and 1K in 
> gcc!
>
>
> I double-checked compiler options and they are correct: -Os.
>
>
> Is it because of
>
>    a) compiler_rt doesn't perform some checks (FP exception for example) or
>
>    b) compiler_rt is incorrect in some corner cases or
>
>    c) inefficient implementation in libgcc?
>
>
> Did anyone face with this problem?
>
> How to reproduce:
>
> First you need to build gcc for iamcu:
>
>   INSTALL=<your install dir>
>
>  TARGET=i586-intel-elfiamcu
>
>   ./configure --host=x86_64-unknown-linux-gnu --enable-target-optspace
> --target=${TARGET} --prefix=${INSTALL} --with-demangler-in-ld
> --enable-languages=c MAKEINFO=missing --disable-multilib
> --disable-libitm --disable-libatomic --disable-libssp
> --disable-libquadmath --with-newlib && make -j $(nproc) && make
> install
>
>
> libgcc
>
>   Let's get size of two float addition operation:
>
>   nm -S -t dec --defined-only
> $(INSTALL)/lib/gcc/i586-intel-elfiamcu/4.9.3/libgcc.a | grep _addsf3
>
> I get:
>
>   00000000 00001039 T __addsf3
>
>   So the size is ~1K
>
> compiler_rt
>
>   svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
>
>   cd compiler_rt/lib/builtins
>
>   Compile: $(INSTALL)/bin/i586-intel-elfiamcu-gcc -Os  addsf3.c -c
>
>   Check function size:  nm -S -t dec addsf3.o
>
> I get:
>
>   00000000 00000522 T __addsf3
>
>   So the size is ~0.5K.
>
> Why so large difference in libgcc and compiler_rt for the same functionality?
>

The size difference comes from soft-fp implementation, not from compiler
codegen.  Does soft-fp have higher accuracy and more features?


-- 
H.J.

Reply via email to