Age | Commit message (Collapse) | Author |
|
TS 18661-1 adds an iseqsig type-generic comparison macro to <math.h>.
This macro is like the == operator except that unordered operands
result in the "invalid" exception and errno being set to EDOM.
This patch implements this macro for glibc. Given the need to set
errno, this is implemented with out-of-line functions __iseqsigf,
__iseqsig and __iseqsigl (of which the last only exists at all if long
double is ABI-distinct from double, so no function aliases or compat
support are needed). The present patch ignores excess precision
issues; I intend to deal with those in a followup patch. (Like
comparison operators, type-generic comparison macros should *not*
convert operands to their semantic types but should preserve excess
range and precision, meaning that for some argument types and values
of FLT_EVAL_METHOD, an underlying function should be called for a
wider type than that of the arguments.)
The underlying functions are implemented with the type-generic
template machinery. Comparing x <= y && x >= y is sufficient in ISO C
to achieve an equality comparison with "invalid" raised for unordered
operands (and the results of those two comparisons can also be used to
tell whether errno needs to be set). However, some architectures have
GCC bugs meaning that unordered comparison instructions are used
instead of ordered ones. Thus, a mechanism is provided for
architectures to use an explicit call to feraiseexcept to raise
exceptions if required. If your architecture has such a bug you
should add a fix-fp-int-compare-invalid.h header for it, with a
comment pointing to the relevant GCC bug report; if such a GCC bug is
fixed, that header's contents should have a __GNUC_PREREQ conditional
added so that the workaround can eventually be removed for that
architecture.
Tested for x86_64, x86, mips64, arm and powerpc.
* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (iseqsig): New
macro.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(__iseqsig): New declaration.
* math/s_iseqsig_template.c: New file.
* math/Versions (__iseqsigf): New libm symbol at version
GLIBC_2.25.
(__iseqsig): Likewise.
(__iseqsigl): Likewise.
* math/libm-test.inc (iseqsig_test_data): New array.
(iseqsig_test): New function.
(main): Call iseqsig_test.
* math/Makefile (gen-libm-calls): Add s_iseqsigF.
* manual/arith.texi (FP Comparison Functions): Document iseqsig.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/generic/fix-fp-int-compare-invalid.h: New file.
* sysdeps/powerpc/fpu/fix-fp-int-compare-invalid.h: Likewise.
* sysdeps/x86/fpu/fix-fp-int-compare-invalid.h: 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.
|
|
Update comments for some functions to bring them in sync with what the
functions are actually doing.
|
|
Adjust calls to do_sincos_1 and do_sincos_2 to pass a boolean
shift_quadrant instead of the numeric 0 and 1.
This does not affect codegen.
|
|
Like the previous change, make the quadrant shift a boolean to make it
clearer that we will do at most a single rotation of the quadrants to
compute the cosine from the sine function.
This does not affect codegen.
|
|
* manual/nss.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/contrib.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/maint.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/install.texi: Fix typos in the manual.
* INSTALL: Regenerated.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/lang.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/probes.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/threads.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/debug.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/crypt.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/conf.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/sysinfo.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/users.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/job.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/process.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/argp.texi: Fix typos in the manual.
* manual/getopt.texi: Likewise.
* manual/startup.texi: Likewise.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/signal.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/setjmp.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/resource.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/time.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/arith.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/math.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/syslog.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/terminal.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/socket.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/filesys.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/llio.texi: Fix typos in the manual.
|
|
2016-05-06 Rical Jasan <ricaljasan@pacific.net>
* manual/stdio.text: Fix typos in the manual.
|
|
For k1 in 1 and 3, n can only have values of 0 and 2, so checking k1 &
2 is equivalent to checking n & 2. We prefer the latter so that we
don't use k1 for anything other than selecting the quadrant in
do_sincos_1, thus dropping it completely.
The previous logic was:
"Compute sine for the value and based on the new rotated quadrant
(k1) negate the value if we're in the fourth quadrant."
With this change, the logic now is:
"Compute sine for the value and negate it if we were either (1) in
the fourth quadrant or (2) we actually wanted the cosine and were
in the third quadrant."
* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Check N
instead of K1.
|
|
The do_sincos_* functions are helpers to compute sin/cos, where they
get cosine by computing sine for the next quadrant. This is decided
with the value of K passed to it, which is the amount by which to
shift the quadrant. Since we will only need the shift to be 0 or 1,
we make K a bool to make that explicit.
* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Rename K to
SHIFT_QUADRANT and make it bool.
(do_sincos_2): Likewise.
(sloww): Likewise.
(sloww1): Likewise.
(__sin): Adjust calls to do_sincos_1 and do_sincos_2.
(__cos): Likewise.
|
|
* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.
|
|
As described in
<https://sourceware.org/ml/libc-alpha/2016-10/msg00047.html>, there is
an include ordering issue with the integer width macros in glibc's
<limits.h>, where definitions conditional on LONG_MAX do not work as
intended because when the headers are installed, this part of glibc's
<limits.h> is processed before the part of GCC's <limits.h> that will
define LONG_MAX. This patch changes the definitions just to use
__WORDSIZE for the expansion of LONG_WIDTH and ULONG_WIDTH rather than
making those definitions conditional on LONG_MAX.
Tested for x86_64 and x86.
* include/limits.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (LONG_WIDTH):
Define to __WORDSIZE, not conditional on [LONG_MAX ==
0x7fffffffL].
[__GLIBC_USE (IEC_60559_BFP_EXT)] (ULONG_WIDTH): Likewise.
|
|
Fix powerpc-specific headers:
- Make it compatible to C89 by replace references to inline by __inline__.
- Get the definition of sigset_t used by
sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h.
- Includes missing header file.
|
|
Regenerated ulps file after recent commit "Use __builtin_fma more in dbl-64 code.".
ChangeLog:
* sysdeps/s390/fpu/libm-test-ulps: Regenerated.
|
|
Linux 4.8 adds TCP_REPAIR_WINDOW to include/uapi/linux/tcp.h. This
patch adds it to sysdeps/gnu/netinet/tcp.h accordingly, along with
struct tcp_repair_window as requested in
<https://sourceware.org/ml/libc-alpha/2016-10/msg00019.html>.
Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).
* sysdeps/gnu/netinet/tcp.h (TCP_REPAIR_WINDOW): New macro.
(struct tcp_repair_window): New type.
|
|
Add string.h to avoid tst-memstream3 build failure in some environments:
tst-memstream3.c:32:17: error: implicit declaration of function 'strcmp' [-Werror=implicit-function-declaration]
# define STRCMP strcmp
^
tst-memstream3.c:96:7: note: in expansion of macro 'STRCMP'
if (STRCMP (buf, W("b")) != 0)
Checked on x86_64.
* libio/tst-memstream3.c: Include string.h.
|
|
This patches fixes multiples issues on open_{w}memstream reported on both
BZ#18241 and BZ#20181:
- failed fseek does not set errno.
- negative offset in fseek fails even when resulting position is
a valid one.
- a flush after write if the current write position is not at the
end of the stream currupt data.
The main fix is on seek operation for memstream (_IO_{w}str_seekoff), where
both _IO_read_ptr and _IO_read_end pointer are updated if a write operation
has occured (similar to default file operations). Also, to calculate the
offset on both read and write pointers, a temporary value is instead of
updating the argument supplied value. Negative offset are valid if resulting
internal pointer is within the range of _IO_{read,write}_base and
_IO_{read,write}_end.
Also POSIX states that a null or wide null shall be appended to the current
buffer iff a write moves the position to a value larger than the current
lenght. Current implementation appends a null or wide null regardless
of this condition. This patch fixes it by removing the 'else' condition
on _IO_{w}mem_sync.
Checked on x86_64.
[BZ #18241]
[BZ #20181]
* libio/Makefile (test): Add tst-memstream3 and tst-wmemstream3.
* libio/memstream.c (_IO_mem_sync): Only append a null byte if
write position is at the end the buffer.
* libio/wmemstream.c (_IO_wmem_sync): Likewise.
* libio/strops.c (_IO_str_switch_to_get_mode): New function.
(_IO_str_seekoff): Set correct offset from negative displacement and
set EINVAL for invalid ones.
* libio/wstrops.c (enlarge_userbuf): Use correct function to calculate
buffer length.
(_IO_wstr_switch_to_get_mode): New function.
(_IO_wstr_seekoff): Set correct offset from negative displacement and
set EINVAL for invalid ones.
* libio/tst-memstream3.c: New file.
* libio/tst-wmemstream3.c: Likewise.
* manual/examples/memstrm.c: Remove warning when priting size_t.
|
|
sysdeps/ieee754/dbl-64/dla.h can use a macro DLA_FMS for more
efficient double-width operations when fused multiply-subtract is
supported. However, this macro is only defined for x86_64,
conditional on architecture-specific __FMA4__. This patch makes the
code use __builtin_fma conditional on __FP_FAST_FMA, as used elsewhere
in glibc.
Tested for x86_64, x86 and powerpc. On powerpc (where this is causing
fused operations to be used where they weren't previously) I see an
increase from 1ulp to 2ulp in the imaginary part of clog10:
testing double (without inline functions)
Failure: Test: Imaginary part of: clog10 (0x1.7a858p+0 - 0x6.d940dp-4 i)
Result:
is: -1.2237865208199886e-01 -0x1.f5435146bb61ap-4
should be: -1.2237865208199888e-01 -0x1.f5435146bb61cp-4
difference: 2.7755575615628914e-17 0x1.0000000000000p-55
ulp : 2.0000
max.ulp : 1.0000
Maximal error of real part of: clog10
is : 3 ulp
accepted: 3 ulp
Maximal error of imaginary part of: clog10
is : 2 ulp
accepted: 1 ulp
This is actually resulting from atan2 becoming *more* accurate (atan2
(-0x6.d940dp-4, 0x1.7a858p+0) should ideally be -0x1.208cd6e841554p-2
but was -0x1.208cd6e841555p-2 from a powerpc libm built before this
change, and is -0x1.208cd6e841554p-2 from a powerpc libm built after
this change). Since these functions are not expected to be correctly
rounding by glibc's accuracy goals, neither result is a problem, but
this does imply that some of this code, although designed to be
correctly rounding, is not in fact correctly rounding (possibly
because of GCC creating fused operations where the code does not
expect it, something we've only disabled for specific functions where
it was found to cause large errors). (Of course as previously
discussed I think we should remove the slow cases where an error
analysis shows this wouldn't increase the errors much above 0.5ulp;
it's only functions such as cratan2 that are expected to be correctly
rounding, not atan2.)
* sysdeps/ieee754/dbl-64/dla.h [__FP_FAST_FMA] (DLA_FMS): Define
macro to use __builtin_fma.
* sysdeps/x86_64/fpu/dla.h: Remove file.
|
|
This patch fixes the ldbl-128ibm version of the iscanonical macro not
to use __iscanonicall when long double = double (-mlong-double-64).
Tested for powerpc.
* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
[__NO_LONG_DOUBLE_MATH] (__iscanonicall): Do not declare.
[__NO_LONG_DOUBLE_MATH] (iscanonical): Define to evaluate to 1.
|
|
The function _dl_addr_inside_object is simplified by removing
the conditional 'reladdr - l->l_phdr[n].p_vaddr >= 0' which is
always true. The function is refactored into it's own object file
and a unit test added to verify the correct behaviour of the
function.
|
|
TS 18661-1 adds an iscanonical classification macro to <math.h>.
The motivation for this is decimal floating-point, where some values
have both canonical and noncanonical encodings. For IEEE binary
interchange formats, all encodings are canonical. For x86/m68k
ldbl-96, and for ldbl-128ibm, there are encodings that do not
represent any valid value of the type; although formally iscanonical
does not need to handle trap representations (and so could just always
return 1), it seems useful, and in line with the description in the TS
of "representations that are extraneous to the floating-point model"
as being non-canonical (as well as "redundant representations of some
or all of its values"), for it to detect those representations and
return 0 for them.
This patch adds iscanonical to glibc. It goes in a header
<bits/iscanonical.h>, included under appropriate conditions in
<math.h>. The default header version just evaluates the argument
(converted to its semantic type, though current GCC will probably
discard that conversion and any exceptions resulting from it) and
returns 1. ldbl-96 and ldbl-128ibm then have versions of the header
that call a function __iscanonicall for long double (the sizeof-based
tests will of course need updating for float128 support, like other
such type-generic macro implementations). The ldbl-96 version of
__iscanonicall has appropriate conditionals to reflect the differences
in the m68k version of that format (where the high mantissa bit may be
either 0 or 1 when the exponent is 0 or 0x7fff). Corresponding tests
for those formats are added as well. Other architectures do not have
any new functions added because just returning 1 is correct for all
their floating-point formats.
Tested for x86_64, x86, mips64 (to test the default macro version) and
powerpc.
* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Include
<bits/iscanonical.h>.
* bits/iscanonical.h: New file.
* math/s_iscanonicall.c: Likewise.
* math/Versions (__iscanonicall): New libm symbol at version
GLIBC_2.25.
* math/libm-test.inc (iscanonical_test_data): New array.
(iscanonical_test): New function.
(main): Call iscanonical_test.
* math/Makefile (headers): Add bits/iscanonical.h.
(type-ldouble-routines): Add s_iscanonicall.
* manual/arith.texi (Floating Point Classes): Document
iscanonical.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h: New file.
* sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/test-iscanonical-ldbl-128ibm.c:
Likewise.
* sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Add
test-iscanonical-ldbl-128ibm.
* sysdeps/ieee754/ldbl-96/bits/iscanonical.h: New file.
* sysdeps/ieee754/ldbl-96/s_iscanonicall.c: Likewise.
* sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c: Likewise.
* sysdeps/ieee754/ldbl-96/Makefile: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Update.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/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/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
The new check-installed-headers rule check now complains with C++
comment from string3.h with:
../string/bits/string3.h:129:1: error: C++ style comments are not allowed in ISO C90
// XXX We have no corresponding builtin yet.
Let use old C style comment to make compiler happy in old modes.
Tested on x86_64.
* string/bits/string3.h: Remove C++ style comments.
|
|
These are remaining cases where we can deduce and conclude that the
sign of the result should be the same as the sign of the input being
checked. For example, for sin(x), the sign of the result is the same
as the result itself for x < pi. Likewise, for sine values where x
after range reduction falls into this range and its sign is preserved.
* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Use copysign
instead of ternary condition.
(do_sincos_2): Likewise.
(__sin): Likewise.
(__cos): Likewise.
(slow): Likewise.
(sloww): Likewise.
(sloww1): Likewise.
(bsloww): Likewise.
(bsloww1): Likewise.
|
|
This is the first very simple substitution of ternary conditions for
correction adjustments with __copysign for positive constants.
* sysdeps/ieee754/dbl-64/s_sin.c (do_cos_slow): use copysign
instead of ternary condition.
(do_sin_slow): Likewise.
(do_sincos_1): Likewise.
(do_sincos_2): Likewise.
(__cos): Likewise.
(sloww): Likewise.
(sloww1): Likewise.
(sloww2): Likewise.
(bsloww): Likewise.
(bsloww1): Likewise.
(bsloww2): Likewise.
|
|
Simplify the code a bit by consolidating sign checks in slow1 and
slow2 into __sin at the higher level.
* sysdeps/ieee754/dbl-64/s_sin.c (slow1): Consolidate sign
check from here...
(slow2): ... and here...
(__sin): ... to here.
|
|
Floating-point classification macros are supposed to remove any excess
range or precision from their arguments. This patch fixes the
non-sNaN version of iszero to do so, by casting the argument to its
own type. (This will of course work only for standard-conforming
excess precision, not for what GCC does on 32-bit x86 by default where
the back end hides excess precision from the front end; the same
applies to most of the classification macros in that case, as showed
up when we made them use GCC built-in functions.)
(iseqsig will have the reverse issue, needing to ensure that when an
underlying function is used it's for a type wide enough not to remove
any excess precision, since comparison macros must not remove excess
precision.)
Tested for x86_64 and x86.
* math/math.h
[__GLIBC_USE (IEC_60559_BFP_EXT) && !__SUPPORT_SNAN__] (iszero):
Cast argument to its own type.
* math/test-iszero-excess-precision.c: New file.
* math/Makefile (tests): Add test-iszero-excess-precision.
(CFLAGS-test-iszero-excess-precision.c): New variable.
|
|
On posix_spawn open file action (issued by posix_spawn_file_actions_addopen)
POSIX states that if fildes was already an open file descriptor, it shall be
closed before the new file is openedi [1]. This avoid pontential issues when
posix_spawn plus addopen action is called with the process already at maximum
number of file descriptor opened and also for multiple actions on single-open
special paths (like /dev/watchdog).
This fixes its behavior on Linux posix_spawn implementation and also adds
a tests to check for its behavior.
Checked on x86_64.
* posix/Makefile (tests): Add tst-spawn3.
* posix/tst-spawn3.c: New file.
* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Close file descriptor
if it is already opened for open action.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addclose.html
|