This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/4 v3] [SH/SH4]: Add support fedisableexcept,feenableexcept, fegetexcept and feupdateenv
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: thomas at codesourcery dot com
- Cc: iwamatsu at nigauri dot org, libc-alpha at sourceware dot org
- Date: Thu, 17 May 2012 10:07:00 +0900 (JST)
- Subject: Re: [PATCH 1/4 v3] [SH/SH4]: Add support fedisableexcept,feenableexcept, fegetexcept and feupdateenv
- References: <1333589869-2155-1-git-send-email-iwamatsu@nigauri.org><20120405.120912.498906559.kkojima@rr.iij4u.or.jp><874nrgrwtb.fsf@schwinge.name>
Hi,
Thomas Schwinge <thomas@codesourcery.com> wrote:
> With these patches applied, while there is also some improvement visible
> in the test results, I'm seeing a lot more failures in the math/*
> testsuites than without them. I just re-confirmed this in the current
> source tree with the patches reverted. As I have no knowledge about math
> exception handling but you evidently do -- would it be possible for you
> to review that situation?
>
> For example, diff of current source tree vs. current source tree with
> these four patches reverted:
I haven't seen any differences in test results for those
patches. Surely I did something wrong when testing them.
Sorry for not noticing these new failures.
It looks that almost new failures come from fraiseexcpt change:
http://sourceware.org/ml/libc-alpha/2012-04/msg00165.html
It seems that now instructions to raise execptions clear old
exception flag fields. A quick fix maybe
--- ORIG/libc/sysdeps/sh/sh4/fpu/fraiseexcpt.c 2012-05-17 09:50:58.000000000 +0900
+++ libc/sysdeps/sh/sh4/fpu/fraiseexcpt.c 2012-05-17 09:50:34.000000000 +0900
@@ -60,6 +60,14 @@ feraiseexcept (int excepts)
__asm__ __volatile__ ("fmul %1, %0" : "+d" (d) : "d" (x));
}
+ /* Restore flag fields. */
+ {
+ fexcept_t temp;
+ _FPU_GETCW (temp);
+ temp |= (excepts & FE_ALL_EXCEPT);
+ _FPU_SETCW (temp);
+ }
+
return 0;
}
libm_hidden_def (feraiseexcept)
> Similar for math/test-double.out, math/test-ifloat.out, and
> math/test-idouble.out -- though a lot of these may be due to deficient
> ULP information, which is another topic that I (or someone else, of
> course) should have a look at (and that I have no experience with).
I'm a bit curious about what is going on these failures,
though I have almost zero experience with ULP issues.
Regards,
kaz