NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-i386/57684: fpsetround(3) fails to set SSE rounding mode



>Number:         57684
>Category:       port-i386
>Synopsis:       fpsetround(3) fails to set SSE rounding mode
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 06 16:05:00 +0000 2023
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The 387BSD Foundation
>Environment:
>Description:
The i386 fpsetround function only sets the i387 rounding mode in the FP  control word with fldcw:

https://nxr.netbsd.org/xref/src/lib/libc/arch/i386/gen/fpsetround.S?r=1.6

If machdep.sse is true, it needs to also set the SSE rounding mode in the MXCSR with ldmxcsr like fesetround does:

https://nxr.netbsd.org/xref/src/lib/libm/arch/i387/fenv.c?r=1.10#335

However, fpsetround can't simply call fesetround because fpsetround lives in libc while fesetround lives in libm.
>How-To-Repeat:
call fpsetround, read the mxcsr or do SSE floating-point
>Fix:
Yes, please!

Copy & paste of the i387/fenv.c approach should work.



Home | Main Index | Thread Index | Old Index