Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58381
-- v2: musl: Don't use __builtin_rint in clang builds.
From: Piotr Caban piotr@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58381 --- libs/musl/src/math/rint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/musl/src/math/rint.c b/libs/musl/src/math/rint.c index 61df07485b8..7ecf9d8625c 100644 --- a/libs/musl/src/math/rint.c +++ b/libs/musl/src/math/rint.c @@ -7,7 +7,7 @@ static const float_t toint = 1 / FLT_EPSILON;
double __cdecl rint(double x) { -#if defined(__GNUC__) || defined(__clang__) +#if defined(__GNUC__) && !defined(__clang__) return __builtin_rint(x); #else union {double f; uint64_t i;} u = {x};
On Tue Jun 17 17:50:32 2025 +0000, Piotr Caban wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/8347/diffs?diff_id=186273&start_sha=acbf1c74a9f08c0a6a46b571ab5dbb383acb9e32#0f1592d65ed3151832d08dcb68ab3e64e3c0aff3_10_10)
I have pushed the fix.
It would be good to optimize the function when clang is used. "Old" implementation used to work with clang because it's using sse instructions. Is it something we can determine easily / depend on?
On Tue Jun 17 17:52:47 2025 +0000, Piotr Caban wrote:
I have pushed the fix. It would be good to optimize the function when clang is used. "Old" implementation used to work with clang because it's using sse instructions. Is it something we can determine easily / depend on?
`__SSE_MATH__` indicates that the compiler will emit SSE instructions for floating-point math (also supported by GCC).
This is the default behavior in Clang. We could adjust the compiler options in the configure script to enable it on GCC as well (or disable it in Clang) for consistency across compilers.
This merge request was approved by Martin Storsjö.