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: Add fetestexceptflag


On 08/26/2016 07:37 PM, Joseph Myers wrote:
TS 18661-1 defines an fetestexceptflag function to test the exception
state saved in an fexcept_t object by fegetexceptflag.

This patch implements this function for glibc.  Almost all
architectures save exception state in such a way that it can be
directly ANDed with exception flag bits, so rather than having lots of
fetestexceptflag implementations that all do the same thing, the math/
implementation is made to use this generic logic (which is also OK in
the fallback case where FE_ALL_EXCEPT is zero).  The only architecture
that seems to need anything different is s390.
Hi Joseph,

the s390-version of fetestexceptflag is okay.
The testcase passes on s390/s390x and I verified that the content of dxc-byte is used.

Please add the following comment:
diff --git a/sysdeps/s390/fpu/fetestexceptflag.c b/sysdeps/s390/fpu/fetestexceptflag.c
index b7e64ab..d5646c5 100644
--- a/sysdeps/s390/fpu/fetestexceptflag.c
+++ b/sysdeps/s390/fpu/fetestexceptflag.c
@@ -22,6 +22,9 @@
 int
 fetestexceptflag (const fexcept_t *flagp, int excepts)
 {
+ /* As *flagp is obtained by an earlier call of fegetexceptflag the bits 0-5
+     of dxc-byte are either zero or correspond to the flag-bits.
+     Evaluate flags and last dxc-exception-code.  */
   return (((*flagp >> FPC_FLAGS_SHIFT) | (*flagp >> FPC_DXC_SHIFT))
          & excepts
          & FE_ALL_EXCEPT);


Thanks,
Stefan


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