about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Use do_sin for sin(x) where 0.25 < |x| < 0.855469Siddhesh Poyarekar2016-09-021-18/+3
| | | | | | | | The only code looks slightly different from do_sin but on closer examination, should give exactly the same result. Drop it in favour of the do_sin function call. * sysdeps/ieee754/dbl-64/s_sin.c (__sin): Use do_sin.
* Consolidate input partitioning into do_cos and do_sinSiddhesh Poyarekar2016-09-021-109/+82
| | | | | | | | | | | | | | | | | | | | | | | | All calls to do_cos are preceded by code that partitions x into a larger double that gives an offset into the sincos table and a smaller double that is used in a polynomial computation. Consolidate all of them into do_cos and do_sin to reduce code duplication. * sysdeps/ieee754/dbl-64/s_sin.c (do_cos): Accept X and DX as input arguments. Consolidate input partitioning from callers here. (do_cos_slow): Likewise. (do_sin): Likewise. (do_sin_slow): Likewise. (do_sincos_1): Remove the no longer necessary input partitioning. (do_sincos_2): Likewise. (__sin): Likewise. (__cos): Likewise. (slow1): Likewise. (slow2): Likewise. (sloww1): Likewise. (sloww2): Likewise. (bsloww1): Likewise. (bsloww2): Likewise. (cslow2): Likewise.
* Remove unneeded stubs for k_rem_pio2l.Paul E. Murphy2016-09-015-10/+0
| | | | | | | | | | This is only used for the float and double variants. Instead, just add it to the type specific list of files, and remove all stubs, and remove the declaration from math_private.h. I verified x86_64, i486, ia64, m68k, and ppc64 build.
* Make common fmin implementation generic.Paul E. Murphy2016-09-013-10/+1
|
* Make common fmax implementation generic.Paul E. Murphy2016-09-016-13/+4
| | | | | Also update aarch64 to ensure the correct s_fmin.c is included. The include order favors including the generated copy.
* Make common nextdown implementation generic.Paul E. Murphy2016-09-011-0/+5
| | | | | | | | | | With the exception of those machines using the ldbl-opt in an Implies file, this is a trivial transformation. nextdownl is not subject to the non-trivial versioning rules of the other generated functions, so to keep things simple, it is handled as a one-off case in ldbl-opt to preserve the existing behavior.
* Make common fdim implementation generic.Paul E. Murphy2016-09-019-16/+19
| | | | | | | | | | | | | | The only difference is the usage of math_narrow_eval when building s_fdiml.c. This should be harmless for long double, but I did observe some code generation changes on m68k, but lack the resources to test it. Likewise, to more easily support overriding symbol generation, the aliasing macros are always conditionally defined on their absence to reduce boilerplate. I also ran builds for i486, ppc64, sparcv9, aarch64, s390x and observed no changes to s_fdim* objects.
* Base <sys/quota.h> on Linux kernel headers [BZ #20525]Florian Weimer2016-09-013-131/+98
| | | | | | | | Macros which are also defined in <linux/quota.h> are removed, and <linux/quota.h> is included instead. This commit cleans up the definition of fs_to_dq_blocks and struct dqblock and struct dqinfo, too.
* ldbl-128: Cleanup e_gammal_r.c after _Float128 renamePaul E. Murphy2016-08-311-6/+6
|
* ldbl-128: Rename 'long double' to '_Float128'Paul E. Murphy2016-08-3177-620/+646
| | | | | | | | | | | | | | | | | | Add a layer of macro indirection for long double files which need to be built using another typename. Likewise, add the L(num) macro used in a later patch to override real constants. These macros are only defined through the ldbl-128 math_ldbl.h header, thereby implicitly restricting these macros to machines which back long double with an IEEE binary128 format. Likewise, appropriate changes are made for the few files which indirectly include such ldbl-128 files. These changes produce identical binaries for s390x, aarch64, and ppc64.
* S390: Do not set FE_INEXACT with feraiseexcept (FE_OWERFLOW|FE_UNDERFLOW).Stefan Liebler2016-08-314-6/+100
| | | | | | | | | | | | | | | | | | | | | | | | | On s390 feraiseexcept (FE_OVERFLOW|FE_UNDERFLOW) sets FE_INEXACT, too. This patch uses z196 zarch load rounded instruction which can suppress FE_INEXACT exception if gcc has z196 support in used configuration. Otherwise FE_INEXACT flag is set as before. The gcc support is tested in a new configure-check. A comment in fsetexcptflg.c is corrected as new exceptions are not executed with the next floating-point instruction if fpc is set with _FPU_SETCW macro. It seems the comment was copied e.g. from sysdeps/x86_64/fpu/fsetexcptflg.c file. ChangeLog: * config.h.in (HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT): New undefine. * sysdeps/s390/configure.ac: Add test for z196 zarch support. * sysdeps/s390/configure: Regenerated. * sysdeps/s390/fpu/fraiseexcpt.c (__feraiseexcept): Use ledbra instruction for raising over-/underflow if z196 zarch is supported by default. * sysdeps/s390/fpu/fsetexcptflg.c (fesetexceptflag): Correct comment.
* hurd: Fix adjtime call with OLDDELTA == NULLSvante Signell2016-08-301-0/+4
| | | | | * sysdeps/mach/hurd/adjtime.c (__adjtime): When OLDDELTA is NULL, make it point to a dumb buffer for RPC to fill it.
* Use fabs(x) instead of branching on signedness of input to sin and cosSiddhesh Poyarekar2016-08-301-148/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The sin and cos code is inconsistent about its use of fabs to get the absolute value of X where in some places it conditionalizes the code while in others it uses fabs. fabs seems to be a better candidate in most cases because it avoids a branch. Similarly there is an attempt to make it easier for the compiler to emit conditional assignment instructions (like fcsel on aarch64) where it can, by isolating conditional assignment constructs from the rest of the expression. A further benefit of this change is to identify common constructs across functions and consolidate them in future patches. * sysdeps/ieee754/dbl-64/s_sin.c (do_cos_slow): Use ternary instead of if/else. (do_sin_slow): Likewise. (do_sincos_1): Use fabs instead of if/else. (do_sincos_2): Likewise. (__sin): Likewise. (__cos): Likewise. (slow2): Likewise. (sloww): Likewise. (sloww1): Likewise. Drop argument M. (sloww2): Use fabs instead of if/else. (bsloww): Likewise. (bsloww1): Likewise. (bsloww2): Likewise.
* Add fall through commentsSiddhesh Poyarekar2016-08-301-0/+2
| | | | Add fall through comments I had missed writing in previously.
* Consolidate reduce_and_compute codeSiddhesh Poyarekar2016-08-301-17/+14
| | | | | | | | | | | | This patch reshuffles the reduce_and_compute code so that the structure matches other code structures of the same type elsewhere in s_sin.c and s_sincos.c. This is the beginning of an attempt to consolidate and reduce code duplication in functions in s_sin.c to make it easier to read and possibly also easier for the compiler to optimize. * sysdeps/ieee754/dbl-64/s_sin.c (reduce_and_compute): Consolidate switch cases 0 and 2.
* Convert remaining complex function to generated filesPaul E. Murphy2016-08-2921-115/+80
| | | | | | Convert cpow, clog, clog10, cexp, csqrt, and cproj functions into generated templates. Note, ldbl-opt still retains s_clog10l.c as the aliasing rules are non-trivial.
* sparcv9: Restore fdiml@GLIBC_2.1Paul E. Murphy2016-08-291-1/+1
| | | | | Use s_fdim.c from sysdeps/ieee754/ldbl-opt/ instead of math/ to ensure a compat symbol for fdiml is created.
* Add fetestexceptflag.Joseph Myers2016-08-2928-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. (fegetexceptflag and fesetexceptflag use abbreviated filenames fgetexcptflg.c and fsetexcptflg.c. Because we are no longer concerned by 14-character filename limits, fetestexceptflag uses the obvious filename fetestexceptflag.c.) The NEWS entry is intended to be expanded along the lines given in <https://sourceware.org/ml/libc-alpha/2016-08/msg00356.html> when fegetmode and fesetmode are added. Tested for x86_64, x86, mips64 and powerpc. * math/fetestexceptflag.c: New file. * sysdeps/s390/fpu/fetestexceptflag.c: Likewise. Comment by Stefan Liebler. * math/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fetestexceptflag): New function declaration. * manual/arith.texi (fetestexceptflag): Document function. * math/Versions (fetestexceptflag): New libm symbol at version GLIBC_2.25. * math/Makefile (libm-support): Add fetestexceptflag. (tests): Add test-fetestexceptflag. * math/test-fetestexceptflag.c: New file. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* malloc: Simplify static malloc interposition [BZ #20432]Florian Weimer2016-08-262-6/+6
| | | | | | | | Existing interposed mallocs do not define the glibc-internal fork callbacks (and they should not), so statically interposed mallocs lead to link failures because the strong reference from fork pulls in glibc's malloc, resulting in multiple definitions of malloc-related symbols.
* X86-64: Correct CFA in _dl_runtime_resolveH.J. Lu2016-08-261-0/+2
| | | | | | | | | When stack is re-aligned in _dl_runtime_resolve, there is no need to adjust CFA when allocating register save area on stack. * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Don't adjust CFA when allocating register save area on re-aligned stack.
* Convert _Complex tangent functions to generated codePaul E. Murphy2016-08-1912-64/+32
| | | | | | This converts s_c{,a}tan{,h}{f,,l} into a single templated file c{,a}tan{,h}_template.c with the exception of alpha.
* Convert _Complex sine functions to generated codePaul E. Murphy2016-08-1918-101/+42
| | | | | Refactor s_c{,a}sin{,h}{f,,l} into a single templated macro.
* X86: Change bit_YMM_state to (1 << 2)H.J. Lu2016-08-191-1/+1
| | | | | | | All other state bits, except for bit_YMM_state, are defined as (1 << N). This patch changes bit_YMM_state from (2 << 1) to (1 << 2). * sysdeps/x86/cpu-features.h (bit_YMM_state): Set to (1 << 2).
* Merge common usage of mul_split functionPaul E. Murphy2016-08-1911-346/+22
| | | | | | | | | | | A number of files share identical code for the mul_split function. This moves the duplicated function mul_split into its own header, and refactors the fma usage into a single selection macro. Likewise, mul_split when used by a long double implementation is renamed mul_splitl for clarity.
* Convert _Complex cosine functions to generated codePaul E. Murphy2016-08-1915-79/+38
| | | | | | This is fairly straight fowards. m68k overrides are updated to use the framework, and thus are simplified a bit.
* Fix incorrect double-checked locking related to _res_hconf.initialized.Torvald Riegel2016-08-181-2/+1
| | | | | | | | | | | | | | | | | | _res_hconf.initialized was not suitable for use in a multi-threaded environment due to the lack of atomics and memory barriers. Use of it was also unnecessary because _res_hconf_init did the right thing by using __libc_once. This patch fixes the glibc-internal uses by just calling _res_hconf_init unconditionally, and switches to a release MO atomic store for _res_hconf.initialized to fix the glibc side of the synchronization problem (which will maintain backward compatibility, but cannot fix the lack of acquire MO on any glibc-external loads). [BZ #20477] * resolv/res_hconf.c (do_init): Use atomic access. * resolv/res_hconf.h: Add comments. * nscd/aicache.c (addhstaiX): Call _res_hconf_init unconditionally. * nss/getXXbyYY_r.c (REENTRANT_NAME): Likewise. * sysdeps/posix/getaddrinfo.c (gaih_inet): Likewise.
* Get rid of array-bounds warning in __kernel_rem_pio2[f] with gcc 6.1 -O3.Stefan Liebler2016-08-182-0/+20
| | | | | | | | | | | | | | | | | | On s390x I get the following werror when build with gcc 6.1 (or current gcc head) and -O3: ../sysdeps/ieee754/dbl-64/k_rem_pio2.c: In function ‘__kernel_rem_pio2’: ../sysdeps/ieee754/dbl-64/k_rem_pio2.c:254:18: error: array subscript is below array bounds [-Werror=array-bounds] for (k = 1; iq[jk - k] == 0; k++) ~~^~~~~~~~ I get the same error with sysdeps/ieee754/flt-32/k_rem_pio2f.c. This patch adds DIAG_* macros around it. ChangeLog: * sysdeps/ieee754/dbl-64/k_rem_pio2.c (__kernel_rem_pio2): Use DIAG_*_NEEDS_COMMENT macro to get rid of array-bounds warning. * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f): Likewise.
* ldbl-128: Remove unused sqrtl declaration in e_asinl.cPaul E. Murphy2016-08-171-1/+0
| | | | | This did not alter compilation for s390x and aarch64 targets.
* Support for type-generic libm function implementations libmPaul E. Murphy2016-08-1716-60/+320
| | | | | | | | | | | | | | | | | | | | | | | This defines a new classes of libm objects. The <func>_template.c file which is used in conjunction with the new makefile hooks to derive variants for each type supported by the target machine. The headers math-type-macros-TYPE.h are used to supply macros to a common implementation of a function in a file named FUNC_template.c and glued togethor via a generated file matching existing naming in the build directory. This has the properties of preserving the existing override mechanism and not requiring any arcane build system twiddling. Likewise, it enables machines to override these files without any additional work. I have verified the built objects for ppc64, x86_64, alpha, arm, and m68k do not change in any meaningful way with these changes using the Fedora cross toolchains. I have verified the x86_64 and ppc64 changes still run.
* Do not override objects in libc.a in other static libraries [BZ #20452]Florian Weimer2016-08-1713-1/+16
| | | | | With this change, we no longer add sysdep.o and similar objects which are present in libc.a to other static libraries.
* Add fesetexcept: sparc.Joseph Myers2016-08-161-0/+31
| | | | | | This patch adds a SPARC version of fesetexcept. Untested. * sysdeps/sparc/fpu/fesetexcept.c: New file.
* Add fesetexcept: sh.Joseph Myers2016-08-161-0/+32
| | | | | | This patch adds an SH version of fesetexcept. Untested. * sysdeps/sh/sh4/fpu/fesetexcept.c: New file.
* Add fesetexcept: s390.Joseph Myers2016-08-161-0/+33
| | | | | | | This patch adds an S/390 version of fesetexcept. Tested and corrected by Stefan Liebler. * sysdeps/s390/fpu/fesetexcept.c: New file.
* Add fesetexcept: powerpc.Joseph Myers2016-08-163-0/+107
| | | | | | | | This patch adds PowerPC versions of fesetexcept. * sysdeps/powerpc/fpu/fesetexcept.c: New file. * sysdeps/powerpc/nofpu/fesetexcept.c: Likewise. * sysdeps/powerpc/powerpc32/e500/nofpu/fesetexcept.c: Likewise.
* Add fesetexcept: mips.Joseph Myers2016-08-161-0/+32
| | | | | | This patch adds a MIPS version of fesetexcept. * sysdeps/mips/fpu/fesetexcept.c: New file.
* Add fesetexcept: m68k.Joseph Myers2016-08-161-0/+31
| | | | | | This patch adds an M68K version of fesetexcept. Untested. * sysdeps/m68k/fpu/fesetexcept.c: New file.
* Add fesetexcept: ia64.Joseph Myers2016-08-161-0/+31
| | | | | | This patch adds an IA64 version of fesetexcept. Untested. * sysdeps/ia64/fpu/fesetexcept.c: New file.
* Add fesetexcept: hppa.Joseph Myers2016-08-161-0/+35
| | | | | | This patch adds an HPPA version of fesetexcept. Untested. * sysdeps/hppa/fpu/fesetexcept.c: New file.
* Add fesetexcept: arm.Joseph Myers2016-08-161-0/+38
| | | | | | This patch adds an ARM version of fesetexcept. * sysdeps/arm/fesetexcept.c: New file.
* Add fesetexcept: alpha.Joseph Myers2016-08-161-0/+31
| | | | | | This patch adds an Alpha version of fesetexcept. Untested. * sysdeps/alpha/fpu/fesetexcept.c: New file.
* Add fesetexcept: aarch64.Joseph Myers2016-08-161-0/+34
| | | | | | This patch adds an AArch64 version of fesetexcept. Untested. * sysdeps/aarch64/fpu/fesetexcept.c: New file.
* Add fesetexcept.Joseph Myers2016-08-1629-0/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines an fesetexcept function for setting floating-point exception flags without the side-effect of causing enabled traps to be taken. This patch series implements this function for glibc. The present patch adds the fallback stub implementation, x86 and x86_64 implementations, documentation, tests and ABI baseline updates. The remaining patches, some of them untested, add implementations for other architectures. The implementations generally follow those of the fesetexceptflag function. As for fesetexceptflag, the approach taken for architectures where setting flags causes enabled traps to be taken is to set the flags (and potentially cause traps) rather than refusing to set the flags and returning an error. Since ISO C and TS 18661 provide no way to enable traps, this is formally in accordance with the standards. The NEWS entry should be considered a placeholder, since this patch series is intended to be followed by further such series adding other TS 18661-1 features, so that the NEWS entry would end up looking more like * New <fenv.h> features from TS 18661-1:2014 are added to libm: the fesetexcept, fetestexceptflag, fegetmode and fesetmode functions, the femode_t type and the FE_DFL_MODE macro. with hopefully more such entries for other features, rather than having an entry for a single function in the end. I believe we have consensus for adding TS 18661-1 interfaces as per <https://sourceware.org/ml/libc-alpha/2016-06/msg00421.html>. Tested for x86_64, x86, mips64 (hard float, and soft float to test the fallback version), arm (hard float) and powerpc (hard float, soft float and e500). * math/fesetexcept.c: New file. * sysdeps/i386/fpu/fesetexcept.c: Likewise. * sysdeps/x86_64/fpu/fesetexcept.c: Likewise. * math/fenv.h: Define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include <bits/libc-header-start.h> instead of including <features.h>. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fesetexcept): New function declaration. * manual/arith.texi (fesetexcept): Document function. * math/Versions (fesetexcept): New libm symbol at version GLIBC_2.25. * math/Makefile (libm-support): Add fesetexcept. (tests): Add test-fesetexcept and test-fesetexcept-traps. * math/test-fesetexcept.c: New file. * math/test-fesetexcept-traps.c: Likewise. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* arm: mark __startcontext as .cantunwind (bug 20435)Andreas Schwab2016-08-151-0/+7
| | | | | __startcontext marks the bottom of the call stack of the contexts created by makecontext.
* Add comment from sysdeps/powerpc/fpu/fraiseexcpt.c to fsetexcptflg.c.Joseph Myers2016-08-121-0/+1
| | | | | * sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Add comment from fraiseexcpt.c.
* Fix powerpc fesetexceptflag clearing FE_INVALID (bug 20455).Joseph Myers2016-08-101-1/+4
| | | | | | | | | | | | | | | | As shown by the test math/test-fexcept, the powerpc fesetexceptflag implementation fails to clear a previously set FE_INVALID flag, when that flag is clear in the saved exceptions and FE_INVALID is included in the mask of flags to restore, because it fails to mask out the sub-exceptions of FE_INVALID from the FPSCR state. This patch fixes the masking logic accordingly. Tested for powerpc. [BZ #20455] * sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Mask out all FE_INVALID sub-exceptions from FPSCR when FE_INVALID specified to be restored.
* Add tests for fegetexceptflag, fesetexceptflag.Joseph Myers2016-08-102-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed that there was no meaningful test coverage for fegetexceptflag and fesetexceptflag (one test ensures that calls to them compile and link, but nothing to verify they work correctly). This patch adds tests for these functions. fesetexceptflag is meant to set the relevant exception flag bits to the saved state without causing enabled traps to be taken. On some architectures, it is not possible to set exception flag bits without causing enabled traps to occur. Such architectures need to define EXCEPTION_SET_FORCES_TRAP to 1 in their math-tests.h, as is done in this patch for powerpc. x86 avoids needing to define this because the traps resulting from setting exception bits don't occur until the next floating-point operation or fwait instruction. Tested for x86_64, x86 and powerpc. Note that test-fexcept fails for powerpc because of a pre-existing bug in fesetexceptflag for powerpc, which I'll fix separately. * math/test-fexcept-traps.c: New file. * math/test-fexcept.c: Likewise. * math/Makefile (tests): Add test-fexcept and test-fexcept-traps. * sysdeps/generic/math-tests.h (EXCEPTION_SET_FORCES_TRAP): New macro. * sysdeps/powerpc/math-tests.h [!__NO_FPRS__] (EXCEPTION_SET_FORCES_TRAP): Likewise.
* Fix recvmsg returning SIGLOST on PF_LOCAL socketsSamuel Thibault2016-08-091-1/+3
| | | | | | | when msg_name is not NULL. * sysdeps/mach/hurd/recvmsg.c (__libc_recvmsg): Cope with aport being MACH_PORT_NULL.
* sparc32/sparcv9: add a VIS3 version of fdimAurelien Jarno2016-08-055-1/+114
| | | | | | | | | | | | | | | | | | | sparc32 passes floating point values in the integer registers. VIS3 instructions gives access to the movwtos instruction to directly transfer a value from an integer register to a floating point register. Therefore it makes sense to provide a VIS3 version consisting in the generic version compiled with -mvis3. Changelog: * math/s_fdim.c: Avoid alias renamed. * math/s_fdimf.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile [$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines): Add s_fdimf-vis3, s_fdim-vis3. (CFLAGS-s_fdimf-vis3.c): New. Set to -Wa,-Av9d -mvis3. (CFLAGS-s_fdim-vis3.c): Likewise. sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c: New file. sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Likewise.
* sparc: remove fdim sparc specific implementationsAurelien Jarno2016-08-0511-314/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fdim and fdimf functions on sparc do not fully follow the standard and do not set errno to ERANGE when the result overflows. Since glibc 2.24 this causes the two following tests to fail: Failure: fdim (max_value, -max_value): errno set to 0, expected 34 (ERANGE) Failure: fdim_upward (max_value, -max_value): errno set to 0, expected 34 (ERANGE) It happens that using GCC with the generic C code generates very similar code to the sparc specific implementations. Therefore this patches remove them. Note it might still worth adding a vis3 specific version of fdim on sparc32/sparcv9, this is done in a following patch to ease backporting. Changelog: * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile [$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines): Remove s_fdimf-vis3, s_fdim-vis3. * sysdeps/sparc/sparc32/fpu/s_fdim.S: Delete file. * sysdeps/sparc/sparc32/fpu/s_fdimf.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S: Likewise. * sysdeps/sparc/sparc64/fpu/s_fdim.S: Likewise. * sysdeps/sparc/sparc64/fpu/s_fdimf.S: Likewise.
* sparc: build with -mvis on sparc32/sparcv9 and sparc64Aurelien Jarno2016-08-052-1/+3
| | | | | | | | | | | | | | When building for sparc32/sparcv9 or sparc64, we assume that VIS instructions are available and use them in the sparc specific assembly code. However we do not tell GCC to use such instructions, resulting in slightly suboptimal code. Fix that by passing -Wa,-Av9a -mvis to GCC. Changelog: * sysdeps/sparc/sparc32/sparcv9/Makefile (sysdep-CFLAGS): Add -mvis. * sysdeps/sparc/sparc64/Makefile (sysdep-CFLAGS): New. Define to -Wa,-Av9a -mvis.