-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
Code Generation Tools
-
CODEGEN-14888
-
C29_2.1.0.STS
-
C29_2.2.0.LTS*
-
F29x
In some cases, the compiler may encode 16-bit "abbreviated" floating-point immediate values incorrectly. One set of instances where this issue occurs is in the fast-math implementations of the C library functions asinf, acosf and roundf. This causes results failures in code that relies on these operations. Affected code includes:
- Uses of library functions asinf, acosf, and roundf under the -ffast-math flag
- Uses of the "fast" intrinsics __builtin_c29_fast_asinf, __builtin_c29_fast_acosf, and __builtin_c29_fast_roundf
Workarounds:
If you are compiling without O3, you can remap the symbols to the original non-optimized fast math functions during linking using the --symbol_map command. For example:
--symbol_map=fast_acosf=asinf --symbol_map=fast_acosf=acosf --symbol_map=fast_acosf=roundf
If you are compiling with O3 you can use one of the following approaches:
Map an alternative function to the original RTS library implementation with the correct function signature, this will result in calling the original RTS library implementation. For Example:
typedef float (*libcall)(float); libcall RTS_roundf = roundf; libcall RTS__acosf = acosf; libcall RTS__asinf = asinf;
The second option is to block optimization of the RTS call by wrapping the original RTS call in a non-optimized function. For Example:
float32_t __attribute__((optnone)) libcall(float32_t in) {
return RTS_function(x);
}