NetBSD Problem Report #44293

From paul@whooppee.com  Wed Dec 29 16:22:29 2010
Return-Path: <paul@whooppee.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id D074763B89A
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 29 Dec 2010 16:22:28 +0000 (UTC)
Message-Id: <20101229162228.594F49799E@quicky.whooppee.com>
Date: Wed, 29 Dec 2010 08:22:28 -0800 (PST)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@gnats.NetBSD.org
Subject: fpsetround(3) doesn't work
X-Send-Pr-Version: 3.95

>Number:         44293
>Category:       port-amd64
>Synopsis:       fpsetround(3) doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-amd64-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 29 16:25:00 +0000 2010
>Closed-Date:    Sat Nov 05 16:11:23 +0000 2011
>Last-Modified:  Sat Nov 05 16:11:23 +0000 2011
>Originator:     Paul Goyette
>Release:        NetBSD 5.99.39
>Organization:
-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------
>Environment:


System: NetBSD quicky.whooppee.com 5.99.39 NetBSD 5.99.39 (WHOOPPEE (shared) 2010-10-28 23:55:07) #48: Thu Oct 28 16:58:51 PDT 2010 paul@speedy.whooppee.com:/build-out/netbsd-local/obj/amd64/sys/arch/amd64/compile/WHOOPPEE amd64
Architecture: x86_64
Machine: amd64
>Description:
On port-amd64 (at least), fpsetround() appears to be a no-op.  The code
for fpsetround() appears to attempt to set both the x87 control word and
the SSE mxcsr, and fpgetround() reads only the x87 state.  Regardless of
what value is passed to fpsetround(), fpgetround() always returns FP_RN.
>How-To-Repeat:

{101} cat t_round.c
#include <stdlib.h>
#include <stdio.h>
#include <ieeefp.h>
#include <float.h>

int
main(int argc, void *argv[])
{
	fp_rnd old, new;

#define TEST(mode)							\
	old = fpsetround(mode);						\
	new = fpgetround();						\
	printf("%s = %d: old %d new %d\n", ___STRING(mode), mode, old, new);

	TEST(FP_RN)
	TEST(FP_RP)
	TEST(FP_RM)
	TEST(FP_RZ)
	TEST(FP_RN)
}
{102} cc t_round.c -o t_round
{103} ./t_round 
FP_RN = 0: old 0 new 0
FP_RP = 2048: old 0 new 0
FP_RM = 1024: old 0 new 0
FP_RZ = 3072: old 0 new 0
FP_RN = 0: old 0 new 0
{104}
>Fix:


>Release-Note:

>Audit-Trail:
From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44293 CVS commit: src/tests/lib/libc
Date: Sun, 2 Jan 2011 03:51:22 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Sun Jan  2 03:51:21 UTC 2011

 Modified Files:
 	src/tests/lib/libc: Makefile
 Added Files:
 	src/tests/lib/libc/ieeefp: Makefile Makefile.inc t_except.c t_nan_inf.c
 	    t_round.c t_subnormal.c

 Log Message:
 Atf-ify several of the ieeefp tests.

 Note that t_round is currently mostly disabled, due to PR/44293.  Also,
 testfloat has not been converted.


 To generate a diff of this commit:
 cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libc/Makefile
 cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/ieeefp/Makefile \
     src/tests/lib/libc/ieeefp/Makefile.inc \
     src/tests/lib/libc/ieeefp/t_except.c \
     src/tests/lib/libc/ieeefp/t_nan_inf.c src/tests/lib/libc/ieeefp/t_round.c \
     src/tests/lib/libc/ieeefp/t_subnormal.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44293 CVS commit: src/lib/libc/arch/x86_64/gen
Date: Fri, 30 Sep 2011 13:42:35 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Fri Sep 30 17:42:35 UTC 2011

 Modified Files:
 	src/lib/libc/arch/x86_64/gen: flt_rounds.S fpgetround.S fpsetround.S

 Log Message:
 PR/44293: Paul Goyette: Fix the mess of the rounding code.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/x86_64/gen/flt_rounds.S
 cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/gen/fpgetround.S \
     src/lib/libc/arch/x86_64/gen/fpsetround.S

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 05 Nov 2011 16:11:23 +0000
State-Changed-Why:
committed, thanks


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.