Multiple versions of routines tuned for different devices

David Gilbert david.gilbert@linaro.org
Tue Nov 29 16:49:00 GMT 2011


On 15 November 2011 14:52, Matthew Gretton-Dann
<matthew.gretton-dann@arm.com> wrote:
> On 11/11/11 18:55, David Gilbert wrote:
>>
>> Hi,
>>    What's the right way to include multiple versions of string/memory
>> routines, where the appropriate
>> choice can't be determined from compiler defines?
>>
>>   Greta's memcpy for A15 ARMs is good, however I have a routine that
>> is faster on the older/current
>> A9 cores;  I don't believe there is a way to get gcc to tell the code
>> what -mtune is passed to it.
>
>
> Can we write some configure magic to look at how gcc is being invoked and
> use that to create a pre-define?
>
> So in configure scan "$(CC) $(CFLAGS)" for a -mtune option and use the value
> of that to create an appropriate predefine.

I don't like the idea of scanning the flags - there are always weird ways people
manage to construct these (legally).

I prefer the idea of tweaking gcc to define it.

I kind of like Konrad's idea of modifying the spec file; however I suspect it
requires it being done in the .c code to deal with things like -mtune=native.

I think I'll ask on the gcc lists.

Dave



More information about the Newlib mailing list