NetBSD Problem Report #57684

From  Mon Nov  6 16:03:22 2023
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 0518E1A9238
	for <>; Mon,  6 Nov 2023 16:03:22 +0000 (UTC)
Message-Id: <>
Date: Mon,  6 Nov 2023 16:03:20 +0000 (UTC)
Subject: fpsetround(3) fails to set SSE rounding mode
X-Send-Pr-Version: www-1.0

>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
The 387BSD Foundation
The i386 fpsetround function only sets the i387 rounding mode in the FP  control word with fldcw:

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

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

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

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.