FLOATING POINT with rtems

Jiri Gaisler jiri at gaisler.se
Tue Dec 3 09:10:41 UTC 2013



On 12/03/2013 09:02 AM, Sebastian Huber wrote:

> Recent GCCs will use (at least on PowerPC and ARM) floating point registers for integer operations if the register pressure is high for example.  So this separate integer/floating point context is an anachronism on these targets. Due to this the VFP/Neon on ARM and the
> SPE/Altivec for PowerPC context is part of the normal thread context since also interrupt handlers may use the floating point unit (GCC may use for example the multi-byte vector copy operations).
> 
> Are the soft-float and hard-float ABIs compatible on SPARC?  

Yes, floats/doubles are always passed in integer registers.

> What happens if we call a hard-float Newlib function with floating-point arguments inside a soft-float RTEMS library?


Newlib (and libgcc) are compiled with multi-lib, so if -msoft-float is given
during linking then soft-float routines will be pulled in. Without -msoft-float,
hard-floats will be pulled in (default). There is pathological case where a
task without the floating-point attribute can cause an FPU disabled trap because
gcc used %fp registers for integers. This can happen on hard-float targets
where not all tasks are supposed to use the FPU. To avoid this, all
task would need to have the floating-point attribute set (on hard-float targets).

Ideally, there should be an option in gcc to avoid storing floats in
integer registers (other than -msoft-float) ...

Jiri.




More information about the users mailing list