[PATCH 1/4 v3] [SH/SH4]: Add support fedisableexcept, feenableexcept, fegetexcept and feupdateenv

Kaz Kojima kkojima@rr.iij4u.or.jp
Sun May 20 11:43:00 GMT 2012


> Maybe something wired happened on my environment. Hmm...

The problem is two-fold at least.  The first one is that my kernel
has a bug with supplementing fcnvsd instruction for denormal float
numbers and raised a unexpected fpu error exception.  It broke my
tests.  The 2nd one is that we defined fexcept_t as unsigned short.
There are codes like

  fexcept_t temp;
  _FPU_GETCW (temp);
  ...
  _FPU_SETCW (temp);

in the current sh4/fpu/f*.c routines where temp is zero extended
when calling __set_fpscr.  This clears the PR flag in fpscr and
breaks the floating operations very badly.  I guess that the odd
behavior of test_double you described can be explained with it.
I'm testing the patch below.

Regards,
	kaz
--
	* sysdeps/sh/sh4/fpu/bits/fenv.h (fexcept_t): Use unsigned int,
	not unsigned short.

--- sysdeps/sh/sh4/fpu/bits/fenv.h.orig	2012-02-16 07:09:44.000000000 +0900
+++ sysdeps/sh/sh4/fpu/bits/fenv.h	2012-05-20 10:21:14.000000000 +0900
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -56,7 +56,7 @@ enum
 
 
 /* Type representing exception flags.  */
-typedef unsigned short int fexcept_t;
+typedef unsigned int fexcept_t;
 
 
 /* Type representing floating-point environment.  This function corresponds



More information about the Libc-alpha mailing list