I get warnings of the type
codewarning: implicit declaration of function 'fmaxf'[/code]
when compiling sources with ppu-gcc as the math.h header does not define them. The math.h used by spu-gcc, however, does. Was this function somehow forgotten?
This topic has been locked.
1 reply Latest Post - 2010-12-14T16:59:49Z by Ulrich.Weigand
Pinned topic No fminf when using ppu-gcc
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2010-12-14T16:59:49Z at 2010-12-14T16:59:49Z by Ulrich.Weigand
Ulrich.Weigand 060000NF8Y35 PostsACCEPTED ANSWER
Re: No fminf when using ppu-gcc2010-12-14T16:59:49Z in response to PedroGonnetFunctions fmin(f) and fmax(f) are provided only with C99, they are not yet in older C standards. This is handled somewhat differently by the two C library implementations on PPU and SPU.
On the PPU side, we have the main system library (glibc), which precisely reflects the C standard currently used to compile. That is, if you the compiler you're using supports C99, fmin(f) and fmax(f) will be available, but if the compiler you're using supports an older C standard, they will not be available.
Note that by default, GCC provides C89 plus some GNU extensions. To enable C99 language support, you need to build your application with -std=c99 (or -std=gnu99) -- then the fmin(f) and fmax(f) routines will also be provided by glibc.
On the SPU side, however, we're not using glibc but newlib. This library does not attempt to reflect the C standard used by the compiler, but will always make available the full set of functions it supports -- which is (a subset of) C99. This means fmin(f) and fmax(f) are always visible.
If you build SPU code using C99 features, however, it would still be preferable to use -std=c99 as well -- this way, the compiler is able to recognize those functions as language-defined, which may enable extra optimizations.