large overhead when cast float to uint64_t for arm cortex-m4 (ARMv7E-M fpv4-sp-d16). Compiler: arm-none-eabi-gcc
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
New
|
Undecided
|
Sergei | ||
Newlib |
New
|
Undecided
|
Sergei |
Bug Description
To cast float to uint64 the initial value first converted to double. Cortex-M4 does not have hardware support for "double". Therefore, such an implementation adds several kilobytes of code, which is unacceptable for embeded systems with limited resources. In addition, increasing the code size is, of course, low performance.
I think there is a need to separate softfloat functions for platforms that only have hardware float support. The current version cannot be used for embedded systems. Additional functions need to be written.
Below is the __aeabi_f2ulz code for fpv4-sp-d16 (ieee 754):
uint64_t __aeabi_f2ulz(float f)
{
uint32_t result = *((uint32_t*)&f);
uint32_t exp;
result &= (~0x80000000);
exp = result >> 23;
result |= 0x800000;
if (exp < 0x7F)
{
return 0;
}
if (exp <= 0x96U)
{
exp = 0x96 - exp;
result >>= exp;
return (uint64_t)result;
}
exp -=0x96U;
return (uint64_t)result << exp;
}
bin>arm-
Using built-in specs.
COLLECT_
COLLECT_
Target: arm-none-eabi
Configured with: /data/jenkins/
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 13.2.1 20231009 (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7))
Changed in gcc-arm-embedded: | |
assignee: | nobody → Sergei (ksergeyp) |
status: | New → Opinion |
status: | Opinion → New |
tags: | added: arm |
tags: |
added: cortex removed: arm |
Changed in newlib: | |
assignee: | nobody → Sergei (ksergeyp) |