avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [bug #12739] Gcc assumes that target libc provides ff


From: Paul Schlie
Subject: Re: [avr-libc-dev] [bug #12739] Gcc assumes that target libc provides ffs function
Date: Tue, 19 Apr 2005 17:10:03 -0400
User-agent: Microsoft-Entourage/11.1.0.040913

> From: Björn Haase <address@hidden>
> Am Dienstag, 19. April 2005 21:41 schrieb E. Weddington:
>> Joerg Wunsch wrote:
>>> As Eric Weddington wrote:
>>>> For reference, the ffs function can be found in newlib.
>>>> <http://sources.redhat.com/newlib/libc.html#SEC187>
>>> 
>>> Which probably took it straight from the BSD lib. ;-)
>>> 
>>> As the function is so simple, and the BSD copyright matches our
>>> copyright (clause 3 may officially be omitted), we can easily import
>>> it.
>> 
>> As a side note, I find it odd that the GCC test suite would require such
>> a non-ANSI standard function to be in the libc. But yeah, it's easy
>> enough to add.
>> 
>> Eric
> I think the background is that for some targets there is a special instruction
> for this purpose. Gcc has special support for a RTL instruction pattern that
> is then matched to a built-in function. The test cases seem to be useful for
> testing this feature.

Adding ffs to avr-libc is useless: ffs and friends are built-in functions
used sporadically internal to GCC, which are supposed to be defined if
required by libgcc2 (which is an absolute mess because it presumes the world
is composed of 32/64 bit machines, and presently requires avr to pretend it
has 4 units per word aka a 32-bit machine, therefore it's never defined for
avr's 16-bit int:

#define __ffsSI2    __NW(ffs,2)
#define __clzSI2    __NW(clz,2)
#define __ctzSI2    __NW(ctz,2)
#define __popcountSI2    __NW(popcount,2)
#define __paritySI2    __NW(parity,2)
#define __ffsDI2    __NDW(ffs,2)
#define __clzDI2    __NDW(clz,2)
#define __ctzDI2    __NDW(ctz,2)
#define __popcountDI2    __NDW(popcount,2)
#define __parityDI2    __NDW(parity,2)

Where from the best I an tell is only presently used directly by:

  unwind-ia64.c:271:    return __builtin_ffs (ret) - 1;

So of no practical consequence to avr.








reply via email to

[Prev in Thread] Current Thread [Next in Thread]