libm/libm: disable optimization for sincos

Disable sincos optimization for all functions in this file,
otherwise gcc would generate infinite calls.
Refer to gcc bug 46926.
-fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
but these two options do not work inside optimize pragma in-file.
Thus we just enforce -O0 when compiling this file.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
p-szafonimateusz 2024-05-24 09:17:08 +02:00 committed by Xiang Xiao
parent c5d1eaae72
commit 23b2f96c9d
3 changed files with 27 additions and 0 deletions

View File

@ -27,12 +27,21 @@
#include <math.h>
/* Disable sincos optimization for all functions in this file,
* otherwise gcc would generate infinite calls.
* Refer to gcc PR46926.
* -fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
* but these two options do not work inside optimize pragma in-file.
* Thus we just enforce -O0 when compiling this file.
*/
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_HAVE_DOUBLE
nooptimiziation_function
void sincos(double x, double *s, double *c)
{
*s = sin(x);

View File

@ -27,10 +27,19 @@
#include <math.h>
/* Disable sincos optimization for all functions in this file,
* otherwise gcc would generate infinite calls.
* Refer to gcc PR46926.
* -fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
* but these two options do not work inside optimize pragma in-file.
* Thus we just enforce -O0 when compiling this file.
*/
/****************************************************************************
* Public Functions
****************************************************************************/
nooptimiziation_function
void sincosf(float x, float *s, float *c)
{
*s = sinf(x);

View File

@ -27,12 +27,21 @@
#include <math.h>
/* Disable sincos optimization for all functions in this file,
* otherwise gcc would generate infinite calls.
* Refer to gcc PR46926.
* -fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
* but these two options do not work inside optimize pragma in-file.
* Thus we just enforce -O0 when compiling this file.
*/
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_HAVE_LONG_DOUBLE
nooptimiziation_function
void sincosl(long double x, long double *s, long double *c)
{
*s = sinl(x);