This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos 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]

RE: 64 bit divides


> From: William Wagner
> 
> We are writing a small application whose size is around 16k. 
> Looking at 
> the map file/disassembler I see that approx 2k of the image 
> is taken up 
> by the functions __divdi3 and __udivdi3 (which come from the libgcc 
> library).
> 
> I thought it seemed stupid that such a small and simple application 
> should do any 64 bit divisions so I've looked into where they 
> are used.
> 
> The first most obvious thing is that only the unsigned divide is ever 
> used, __aeabi_uldivmod calls __gnu_uldivmod_helper which calls 
> __udivdi3. __divdi3 and its helper __gnu_ldivmod_helper are 
> never used 
> and yet are not stripped out of the elf. Any easy way to fix that?

I would expect that the signed divide would be much smaller, since it would
merely wrap the unsigned divide with some sign twiddling, so stripping it
might not help much.

If the only place this divide is used is in some non-critical code, another
approach would be to write your own version that uses a dumb
shift-and-subtract, so that the library version doesn't get linked in at
all. It should be possible to do it in a few dozen bytes of code, or maybe a
hundred if you write it in C.

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com 


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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