This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Code size issues on FP-emulation on libgcc compared to LLVM's compiler_rt


I'm building libgcc for a "iamcu" target (Pentium-like but with
soft-fp emulation, the only x86 with SoftFP I know) with

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>


  ./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


  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


  svn co 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?


-- Zinovy Nis.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]