b/sysdeps/riscv/math-use-builtins-ceil.h
new file mode 100644
@@ -0,0 +1,4 @@
+#define USE_CEIL_BUILTIN 1
+#define USE_CEILF_BUILTIN 1
+#define USE_CEILL_BUILTIN 0
+#define USE_CEILF128_BUILTIN 0
b/sysdeps/riscv/math-use-builtins-ffs.h
new file mode 100644
@@ -0,0 +1,2 @@
+#define USE_FFS_BUILTIN 1
+#define USE_FFSLL_BUILTIN 1
b/sysdeps/riscv/math-use-builtins-floor.h
new file mode 100644
@@ -0,0 +1,4 @@
+#define USE_FLOOR_BUILTIN 1
+#define USE_FLOORF_BUILTIN 1
+#define USE_FLOORL_BUILTIN 0
+#define USE_FLOORF128_BUILTIN 0
b/sysdeps/riscv/math-use-builtins-nearbyint.h
new file mode 100644
@@ -0,0 +1,4 @@
+#define USE_NEARBYINT_BUILTIN 1
+#define USE_NEARBYINTF_BUILTIN 1
+#define USE_NEARBYINTL_BUILTIN 0
+#define USE_NEARBYINTF128_BUILTIN 0
b/sysdeps/riscv/math-use-builtins-rint.h
new file mode 100644
@@ -0,0 +1,4 @@
+#define USE_RINT_BUILTIN 1
+#define USE_RINTF_BUILTIN 1
+#define USE_RINTL_BUILTIN 0
+#define USE_RINTF128_BUILTIN 0
b/sysdeps/riscv/math-use-builtins-round.h
new file mode 100644
@@ -0,0 +1,4 @@
+#define USE_ROUND_BUILTIN 1
+#define USE_ROUNDF_BUILTIN 1
+#define USE_ROUNDL_BUILTIN 0
+#define USE_ROUNDF128_BUILTIN 0
b/sysdeps/riscv/math-use-builtins-roundeven.h
new file mode 100644
@@ -0,0 +1,4 @@
+#define USE_ROUNDEVEN_BUILTIN 1
+#define USE_ROUNDEVENF_BUILTIN 1
+#define USE_ROUNDEVENL_BUILTIN 0
+#define USE_ROUNDEVENF128_BUILTIN 0
b/sysdeps/riscv/math-use-builtins-trunc.h
new file mode 100644
@@ -0,0 +1,4 @@
+#define USE_TRUNC_BUILTIN 1
+#define USE_TRUNCF_BUILTIN 1
+#define USE_TRUNCL_BUILTIN 0
+#define USE_TRUNCF128_BUILTIN 0
b/sysdeps/riscv/rv64/rvd/s_ceil.c
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
double
__ceil (double x)
{
+#if USE_CEIL_BUILTIN
+ return __builtin_ceil (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
double mag = fabs (x);
@@ -48,6 +52,7 @@ __ceil (double x)
}
return x;
+#endif /* ! USE_CEIL_BUILTIN */
}
libm_alias_double (__ceil, ceil)
b/sysdeps/riscv/rv64/rvd/s_floor.c
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
double
__floor (double x)
{
+#if USE_FLOOR_BUILTIN
+ return __builtin_floor (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
double mag = fabs (x);
@@ -48,6 +52,7 @@ __floor (double x)
}
return x;
+#endif /* ! USE_FLOOR_BUILTIN */
}
libm_alias_double (__floor, floor)
b/sysdeps/riscv/rv64/rvd/s_nearbyint.c
@@ -20,10 +20,14 @@
#include
#include
#include
+#include
double
__nearbyint (double x)
{
+#if USE_NEARBYINT_BUILTIN
+ return __builtin_nearbyint (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
double mag = fabs (x);
@@ -47,6 +51,7 @@ __nearbyint (double x)
}
return x;
+#endif /* ! USE_NEARBYINT_BUILTIN */
}
libm_alias_double (__nearbyint, nearbyint)
b/sysdeps/riscv/rv64/rvd/s_rint.c
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
double
__rint (double x)
{
+#if USE_RINT_BUILTIN
+ return __builtin_rint (x);
+#else
bool nan;
double mag;
@@ -48,6 +52,7 @@ __rint (double x)
}
return x;
+#endif /* ! USE_RINT_BUILTIN */
}
libm_alias_double (__rint, rint)
b/sysdeps/riscv/rv64/rvd/s_round.c
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
double
__round (double x)
{
+#if USE_ROUND_BUILTIN
+ return __builtin_round (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
double mag = fabs (x);
@@ -48,6 +52,7 @@ __round (double x)
}
return x;
+#endif /* ! USE_ROUND_BUILTIN */
}
libm_alias_double (__round, round)
b/sysdeps/riscv/rv64/rvd/s_roundeven.c
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
double
__roundeven (double x)
{
+#if USE_ROUNDEVEN_BUILTIN
+ return __builtin_roundeven (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
double mag = fabs (x);
@@ -48,6 +52,7 @@ __roundeven (double x)
}
return x;
+#endif /* ! USE_ROUNDEVEN_BUILTIN */
}
libm_alias_double (__roundeven, roundeven)
b/sysdeps/riscv/rv64/rvd/s_trunc.c
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
double
__trunc (double x)
{
+ #if USE_TRUNC_BUILTIN
+ return __builtin_trunc (x);
+ #else
int flags = riscv_getflags ();
bool nan = isnan (x);
double mag = fabs (x);
@@ -48,6 +52,7 @@ __trunc (double x)
}
return x;
+ #endif /* ! USE_TRUNC_BUILTIN */
}
libm_alias_double (__trunc, trunc)
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
float
__ceilf (float x)
{
+#if USE_CEILF_BUILTIN
+ return __builtin_ceilf (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
float mag = fabsf (x);
@@ -48,6 +52,7 @@ __ceilf (float x)
}
return x;
+#endif /* ! USE_CEILF_BUILTIN */
}
libm_alias_float (__ceil, ceil)
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
float
__floorf (float x)
{
+#if USE_FLOORF_BUILTIN
+ return __builtin_floorf (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
float mag = fabsf (x);
@@ -48,6 +52,7 @@ __floorf (float x)
}
return x;
+#endif /* ! USE_FLOORF_BUILTIN */
}
libm_alias_float (__floor, floor)
b/sysdeps/riscv/rvf/s_nearbyintf.c
@@ -20,10 +20,14 @@
#include
#include
#include
+#include
float
__nearbyintf (float x)
{
+#if USE_NEARBYINTF_BUILTIN
+ return __builtin_nearbyintf (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
float mag = fabsf (x);
@@ -47,6 +51,7 @@ __nearbyintf (float x)
}
return x;
+#endif /* ! USE_NEARBYINT_BUILTIN */
}
libm_alias_float (__nearbyint, nearbyint)
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
float
__rintf (float x)
{
+#if USE_RINTF_BUILTIN
+ return __builtin_rintf (x);
+#else
bool nan;
float mag;
@@ -48,6 +52,7 @@ __rintf (float x)
}
return x;
+#endif /* ! USE_RINTF_BUILTIN */
}
libm_alias_float (__rint, rint)
b/sysdeps/riscv/rvf/s_roundevenf.c
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
float
__roundevenf (float x)
{
+#if USE_ROUNDEVENF_BUILTIN
+ return __builtin_roundevenf (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
float mag = fabsf (x);
@@ -48,6 +52,7 @@ __roundevenf (float x)
}
return x;
+#endif /* ! USE_ROUNDEVENF_BUILTIN */
}
libm_alias_float (__roundeven, roundeven)
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
float
__roundf (float x)
{
+#if USE_ROUNDF_BUILTIN
+ return __builtin_roundf (x);
+#else
int flags = riscv_getflags ();
bool nan = isnan (x);
float mag = fabsf (x);
@@ -48,6 +52,7 @@ __roundf (float x)
}
return x;
+#endif /* ! USE_ROUNDF_BUILTIN */
}
libm_alias_float (__round, round)
@@ -21,10 +21,14 @@
#include
#include
#include
+#include
float
__truncf (float x)
{
+ #if USE_TRUNCF_BUILTIN
+ return __builtin_truncf (x);
+ #else
int flags = riscv_getflags ();
bool nan = isnan (x);
float mag = fabsf (x);
@@ -48,6 +52,7 @@ __truncf (float x)
}
return x;
+ #endif /* ! USE_TRUNCF_BUILTIN */
}
libm_alias_float (__trunc, trunc)