[PATCH] x86-64: Don't use asm statement for trunc/truncf
Florian Weimer
fw@deneb.enyo.de
Fri Sep 12 14:16:12 GMT 2025
* H. J. Lu:
> On Thu, Sep 11, 2025 at 10:47 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>
>> * H. J. Lu:
>>
>> > diff --git a/sysdeps/x86/fpu/math_private.h
>> b/sysdeps/x86/fpu/math_private.h
>> > index d30d580cea..610ae364f3 100644
>> > --- a/sysdeps/x86/fpu/math_private.h
>> > +++ b/sysdeps/x86/fpu/math_private.h
>> > @@ -33,27 +33,35 @@ __NTH (__ieee754_atan2l (long double y, long double
>> x))
>> > __extern_always_inline double
>> > __trunc (double x)
>> > {
>> > +#if HAVE_X86_OS_INLINE_TRUNC
>> > + return trunc (x);
>> > +#else
>> > +# ifdef __AVX__
>> > asm ("vroundsd $11, %1, %1, %0" : "=v" (x) : "v" (x));
>> > +# elif defined __SSE4_1__
>> > asm ("roundsd $11, %1, %0" : "=x" (x) : "x" (x));
>> > +# else
>> > x = trunc (x);
>> > +# endif
>> > return x;
>> > +#endif
>> > }
>>
>> The HAVE_X86_OS_INLINE_TRUNC preprocessor conditional is checked
>> outside of __AVX__.
>>
>
> The compiler enables roundsX for SSE4.1. We have AVX and SSE4.1
> since they have different numbers of operands. I can change -mavx to
> -msse4.1 in configure.ac.
I think the configure check must match the condition you use in the
source code if you pass explicit flags.
More information about the Libc-alpha
mailing list