This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> Good point.  Thanks!  Rewriting such _FPU_GETCW/_FPU_SETCW
> pairs with int variables might be less intrusive.  I'll try
> both way.

And here is a patch with the 2nd way.

Regards,
	kaz
--
	* sysdeps/sh/sh4/fpu/fraiseexcpt.c (feraiseexcept): Restore
	fpscr flag fields.
	* sysdeps/sh/sh4/fpu/fsetexcptflg.c (fesetexceptflag): Use
	int variable.
	* sysdeps/sh/sh4/fpu/ftestexcept.c (fetestexcept): Likewise.

diff -upr ORIG/sysdeps/sh/sh4/fpu/fraiseexcpt.c sysdeps/sh/sh4/fpu/fraiseexcpt.c
--- ORIG/sysdeps/sh/sh4/fpu/fraiseexcpt.c	2012-04-05 11:52:06.000000000 +0900
+++ sysdeps/sh/sh4/fpu/fraiseexcpt.c	2012-05-20 21:47:43.000000000 +0900
@@ -1,5 +1,5 @@
 /* Raise given exceptions.
-   Copyright (C) 1997, 1998, 2000, 2002, 2012 Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Nobuhiro Iwamatsu <iwamatsu@nigauri.org>, 2012.
 
@@ -60,6 +60,14 @@ feraiseexcept (int excepts)
     __asm__ __volatile__ ("fmul %1, %0" : "+d" (d) : "d" (x));
   }
 
+  {
+    /* Restore flag fields.  */
+    int temp;
+    _FPU_GETCW (temp);
+    temp |= (excepts & FE_ALL_EXCEPT);
+    _FPU_SETCW (temp);
+  }
+
   return 0;
 }
 libm_hidden_def (feraiseexcept)
diff -upr ORIG/sysdeps/sh/sh4/fpu/fsetexcptflg.c sysdeps/sh/sh4/fpu/fsetexcptflg.c
--- ORIG/sysdeps/sh/sh4/fpu/fsetexcptflg.c	2012-02-16 07:09:44.000000000 +0900
+++ sysdeps/sh/sh4/fpu/fsetexcptflg.c	2012-05-20 21:49:34.000000000 +0900
@@ -1,5 +1,5 @@
 /* Set floating-point environment exception handling.
-   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997-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
@@ -23,7 +23,7 @@
 int
 fesetexceptflag (const fexcept_t *flagp, int excepts)
 {
-  fexcept_t temp;
+  int temp;
 
   /* Get the current environment.  */
   _FPU_GETCW (temp);
diff -upr ORIG/sysdeps/sh/sh4/fpu/ftestexcept.c sysdeps/sh/sh4/fpu/ftestexcept.c
--- ORIG/sysdeps/sh/sh4/fpu/ftestexcept.c	2012-04-05 11:55:14.000000000 +0900
+++ sysdeps/sh/sh4/fpu/ftestexcept.c	2012-05-20 21:49:16.000000000 +0900
@@ -1,5 +1,5 @@
 /* Test exception in current environment.
-   Copyright (C) 1997, 1998, 2000, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1997-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
@@ -22,7 +22,7 @@
 int
 fetestexcept (int excepts)
 {
-  fexcept_t temp;
+  int temp;
 
   /* Get current exceptions.  */
   _FPU_GETCW (temp);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]