Commit graph

38709 commits

Author SHA1 Message Date
Ilyahoo Proshel 189906b687 Add rif_MA locale [BZ #27781]
Resolves: BZ #27781
2022-04-07 14:59:41 +02:00
Siddhesh Poyarekar 67e3b0c63c tests/string: Drop simple/stupid/builtin tests
In most cases the simple/stupid/builtin functions were in there to
benchmark optimized implementations against.  Only in some cases the
functions are used to check expected results.

Remove these tests from IMPL() and only keep them in wherever they're
used for a specific purpose, e.g. to generate expected results.

This improves timing of `make subdirs=string` by over a minute and a
half (over 15%) on a Whiskey Lake laptop.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Noah Goldstein <libc-alpha@sourceware.org>
2022-04-06 20:53:24 +05:30
Siddhesh Poyarekar dfc7bf8a24 test-memcpy: Actually reverse source and destination
Looks like an oversight in memcpy tests resulted in s2 and s1 not being
swapped for the second iteration of the memcpy test.  Fix it.  Also fix
a formatting nit.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-04-06 12:45:39 +05:30
Adhemerval Zanella cbc2c56bab benchtests: Only build libmvec benchmarks iff $(build-mathvec) is set
Checked on x86_64-linux-gnu.
2022-04-05 12:01:10 -03:00
Adhemerval Zanella 053fe27343 linux: Fix __closefrom_fallback iterates until max int (BZ#28993)
The __closefrom_fallback tries to get a available file descriptor
if the initial open ("/proc/self/fd/", ...) fails.  It assumes the
failure would be only if procfs is not mount (ENOENT), however if
the the proc file is not accessible (due some other kernel filtering
such apparmor) it will iterate over a potentially large file set
issuing close calls.

It should only try the close fallback if open returns EMFILE,
ENFILE, or ENOMEM.

Checked on x86_64-linux-gnu.
2022-04-05 08:08:19 -03:00
Fangrui Song 3ee318c923 Remove -z combreloc and HAVE_Z_COMBRELOC
-z combreloc has been the default regadless of the architecture since
binutils commit f4d733664aabd7bd78c82895e030ec9779a92809 (2002). The
configure check added in commit fdde83499a (2001) has long been
unneeded.

We can therefore treat HAVE_Z_COMBRELOC as always 1 and delete dead code
paths in dl-machine.h files (many were copied from commit a711b01d34
and ee0cb67ec2).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-04-04 17:19:07 -07:00
Adhemerval Zanella 1c225a2dd1 sparc: Remove s_abs implementations
For sparc64 is the same as the generic implementation, while for
sparc32 the builtin generates the same code.

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.
2022-04-04 16:53:24 -03:00
Adhemerval Zanella caee5be74b ia64: Remove fabs implementations
The generic implementation fixes 5 fabs tests on ia64-linux-gnu:

  math/test-double-fabs
  math/test-float-fabs
  math/test-float32-fabs
  math/test-float32x-fabs
  math/test-float64-fabs

Checked on ia64-linux-gnu.
2022-04-04 16:30:38 -03:00
Adhemerval Zanella 7eed708edf x86: Remove fabs{f} implementation
For x86_64 is the same as the generic implementation, while for i686
the builtin generates the same code.
2022-04-04 16:23:11 -03:00
Adhemerval Zanella dc2cfd6a87 alpha: Remove s_abs implementations
The generic implementation already uses builtins.
2022-04-04 16:22:15 -03:00
DJ Delorie 2fe64148a8 Allow for unpriviledged nested containers
If the build itself is run in a container, we may not be able to
fully set up a nested container for test-container testing.
Notably is the mounting of /proc, since it's critical that it
be mounted from within the same PID namespace as its users, and
thus cannot be bind mounted from outside the container like other
mounts.

This patch defaults to using the parent's PID namespace instead of
creating a new one, as this is more likely to be allowed.

If the test needs an isolated PID namespace, it should add the "pidns"
command to its init script.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-04-04 14:17:08 -04:00
Szabolcs Nagy 6ff3c77149 Increase the test timeout of some string tests
Recent changes in test-strncasecmp and test-strncmp pushed the run time
of the tests above the 4 minute limit specified in test-string.h on an
arm tester machine.
2022-04-01 16:02:40 +01:00
Siddhesh Poyarekar b416555431 realpath: Bring back GNU extension on ENOENT and EACCES [BZ #28996]
The GNU extension for realpath states that if the path resolution fails
with ENOENT or EACCES and the resolved buffer is non-NULL, it will
contain part of the path that failed resolution.

commit 949ad78a18 broke this when it
omitted the copy on failure.  Bring it back partially to continue
supporting this GNU extension.

Resolves: BZ #28996

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
2022-03-31 22:00:58 +05:30
Adhemerval Zanella 7f2ddf7400 stdlib: Fix tst-getrandom memcmp call
The idea is to check if the up sizeof (buf) are equal, not only
the first byte.

Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 09:14:10 -03:00
Adhemerval Zanella 3ff447f7df stdlib: Fix tst-rand48.c printf types
Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 09:13:14 -03:00
Adhemerval Zanella bc02f1fa2f elf: Remove unused functions from tst-audit25(a,b) 2022-03-31 09:12:16 -03:00
Adhemerval Zanella 692c2571c8 nptl: Use libc-diag.h with tst-thread-setspecific
And also use libsupport.

Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 09:02:41 -03:00
Adhemerval Zanella 1dedc5bd5c crypt: Remove unused variable on cert test
Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 09:00:54 -03:00
Adhemerval Zanella f60510ddaf elf: Remove unused variables in tests
Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 08:59:23 -03:00
Adhemerval Zanella b2cd93fce6 elf: Fix wrong fscanf usage on tst-pldd
To take in consideration the extra '\0'.

Checked on x86_64-linux-gnu.
2022-03-31 08:57:59 -03:00
Adhemerval Zanella f902892aaf posix: Remove unused variable on tst-_Fork.c
Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 08:57:12 -03:00
Adhemerval Zanella 2fe316888a resolv: Initialize loop variable on tst-resolv-trailing
Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 08:55:48 -03:00
Adhemerval Zanella c5c65de1b2 locale: Remove set but unused variable on ld-collate.c
Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 08:53:40 -03:00
Adhemerval Zanella 74942fd273 localedate: Fix printf type on tst_mbrtowc
Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 08:49:55 -03:00
Adhemerval Zanella d1eefcb2a0 localedata: Remove unused variables in tests
Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-03-31 08:38:35 -03:00
Noah Goldstein 244b415d38 x86: Small improvements for wcslen
Just a few QOL changes.
    1. Prefer `add` > `lea` as it has high execution units it can run
       on.
    2. Don't break macro-fusion between `test` and `jcc`
    3. Reduce code size by removing gratuitous padding bytes (-90
       bytes).

geometric_mean(N=20) of all benchmarks New / Original: 0.959

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-28 15:00:03 -05:00
Noah Goldstein f5bff979d0 x86: Small improvements for wcscpy-ssse3
Just a few small QOL changes.
    1. Prefer `add` > `lea` as it has high execution units it can run
       on.
    2. Don't break macro-fusion between `test` and `jcc`

geometric_mean(N=20) of all benchmarks New / Original: 0.973

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-28 15:00:03 -05:00
Cristian Rodríguez 811c635dba debug: Improve fdelt_chk error message
It is not a "buffer overflow detected" but an out of range
bit on fd_set

Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-03-28 19:10:30 +05:30
Joseph Myers 866c599182 Add HWCAP2_AFP, HWCAP2_RPRES from Linux 5.17 to AArch64 bits/hwcap.h
Add the new HWCAP2_AFP and HWCAP2_RPRES constants from Linux 5.17.
Tested with build-many-glibcs.py for aarch64-linux-gnu.
2022-03-28 13:16:48 +00:00
Noah Goldstein 305769b2a1 x86: Remove AVX str{n}casecmp
The rational is:

1. SSE42 has nearly identical logic so any benefit is minimal (3.4%
   regression on Tigerlake using SSE42 versus AVX across the
   benchtest suite).
2. AVX2 version covers the majority of targets that previously
   prefered it.
3. The targets where AVX would still be best (SnB and IVB) are
   becoming outdated.

All in all the saving the code size is worth it.

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 13:16:51 -05:00
Noah Goldstein 84e7c46df4 x86: Add EVEX optimized str{n}casecmp
geometric_mean(N=40) of all benchmarks EVEX / SSE42: .621

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 13:16:50 -05:00
Noah Goldstein bbf8122234 x86: Add AVX2 optimized str{n}casecmp
geometric_mean(N=40) of all benchmarks AVX2 / SSE42: .702

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 13:16:43 -05:00
Noah Goldstein 39399913a2 string: Expand page cross test cases in test-strncmp.c
Test cases for when both `s1` and `s2` are near the end of a page
where previously missing.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:14 -05:00
Noah Goldstein 22833848e3 string: Expand page cross test cases in test-strcmp.c
Test cases for when both `s1` and `s2` are near the end of a page
where previously missing.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein d154758e61 x86: Optimize str{n}casecmp TOLOWER logic in strcmp-sse42.S
Slightly faster method of doing TOLOWER that saves an
instruction.

Also replace the hard coded 5-byte no with .p2align 4. On builds with
CET enabled this misaligned entry to strcasecmp.

geometric_mean(N=40) of all benchmarks New / Original: .920

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 670b54bc58 x86: Optimize str{n}casecmp TOLOWER logic in strcmp.S
Slightly faster method of doing TOLOWER that saves an
instruction.

Also replace the hard coded 5-byte no with .p2align 4. On builds with
CET enabled this misaligned entry to strcasecmp.

geometric_mean(N=40) of all benchmarks New / Original: .894

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 46d19d1b83 string: Expand page cross tests in test-strncasecmp.c
Add more robust tests that cover all the page cross edge cases.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 1edbcc82b5 string: Expand page cross tests in test-strcasecmp.c
Add more robust tests that cover all the page cross edge cases.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein c6853907b1 benchtests: Use json-lib in bench-strncasecmp.c
Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 6f2a331b16 benchtests: Use json-lib in bench-strcasecmp.c
Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 9fef7039a7 x86: Fix fallback for wcsncmp_avx2 in strcmp-avx2.S [BZ #28896]
Overflow case for __wcsncmp_avx2_rtm should be __wcscmp_avx2_rtm not
__wcscmp_avx2.

commit ddf0992cf5
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Sun Jan 9 16:02:21 2022 -0600

    x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]

Set the wrong fallback function for `__wcsncmp_avx2_rtm`. It was set
to fallback on to `__wcscmp_avx2` instead of `__wcscmp_avx2_rtm` which
can cause spurious aborts.

This change will need to be backported.

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 9c8a6ad620 x86: Remove strspn-sse2.S and use the generic implementation
The generic implementation is faster.

geometric_mean(N=20) of all benchmarks New / Original: .710

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 6533585352 x86: Remove strpbrk-sse2.S and use the generic implementation
The generic implementation is faster (see strcspn commit).

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein fe28e7d9d9 x86: Remove strcspn-sse2.S and use the generic implementation
The generic implementation is faster.

geometric_mean(N=20) of all benchmarks New / Original: .678

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 412d103431 x86: Optimize strspn in strspn-c.c
Use _mm_cmpeq_epi8 and _mm_movemask_epi8 to get strlen instead of
_mm_cmpistri. Also change offset to unsigned to avoid unnecessary
sign extensions.

geometric_mean(N=20) of all benchmarks that dont fallback on
sse2; New / Original: .901

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 30d627d477 x86: Optimize strcspn and strpbrk in strcspn-c.c
Use _mm_cmpeq_epi8 and _mm_movemask_epi8 to get strlen instead of
_mm_cmpistri. Also change offset to unsigned to avoid unnecessary
sign extensions.

geometric_mean(N=20) of all benchmarks that dont fallback on
sse2/strlen; New / Original: .928

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein dc18cd6c81 benchtests: Use json-lib in bench-strspn.c
Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein 4ed0347a25 benchtests: Use json-lib in bench-strpbrk.c
Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein ec285ea904 x86: Code cleanup in strchr-evex and comment justifying branch
Small code cleanup for size: -81 bytes.

Add comment justifying using a branch to do NULL/non-null return.

All string/memory tests pass and no regressions in benchtests.

geometric_mean(N=20) of all benchmarks New / Original: .985
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00
Noah Goldstein a6fbf4d51e x86: Code cleanup in strchr-avx2 and comment justifying branch
Small code cleanup for size: -53 bytes.

Add comment justifying using a branch to do NULL/non-null return.

All string/memory tests pass and no regressions in benchtests.

geometric_mean(N=20) of all benchmarks Original / New: 1.00
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25 11:46:13 -05:00