Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into fedora/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schwab committed Apr 16, 2010
2 parents 1ef1727 + 1cdb215 commit 54627f3
Show file tree
Hide file tree
Showing 24 changed files with 2,133 additions and 162 deletions.
66 changes: 66 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
2010-04-15 H.J. Lu <hongjiu.lu@intel.com>

* string/test-strncmp.c (check_result): New function.
(do_one_test): Use it.
(check1): New function.
(test_main): Use it.
* sysdeps/i386/i686/multiarch/strcmp-sse4.S (crosspage): Properly
update source and destination.
* sysdeps/i386/i686/multiarch/strcmp-ssse3.S (gobble_ashr_12):
Properly check and update counter.

2010-04-14 H.J. Lu <hongjiu.lu@intel.com>

* sysdeps/x86_64/elf/configure.in: Move AVX test to ....
* sysdeps/i386/configure.in: ...here.
* sysdeps/i386/i686/multiarch/Makefile (libm-sysdep_routines): Define.
(CFLAGS-s_fma-fma.c): Define.
(CFLAGS-s_fmaf-fma.c): Define.
* sysdeps/i386/i686/multiarch/Versions: New file.
* sysdeps/i386/i686/multiarch/s_fma-fma.c: New file.
* sysdeps/i386/i686/multiarch/s_fma.c: New file.
* sysdeps/i386/i686/multiarch/s_fmaf-fma.c: New file.
* sysdeps/i386/i686/multiarch/s_fmaf.c: New file.

* sysdeps/x86_64/multiarch/memcmp-sse4.S: Check
DATA_CACHE_SIZE_HALF instead of SHARED_CACHE_SIZE_HALF.

2010-04-14 Andreas Schwab <schwab@redhat.com>

* elf/dl-version.c (_dl_check_map_versions): Avoid index overflow
when dependencies are missing.

2010-04-14 H.J. Lu <hongjiu.lu@intel.com>

* sysdeps/x86_64/multiarch/memcmp-sse4.S: Optimized for unaligned
data.

2010-04-12 H.J. Lu <hongjiu.lu@intel.com>

* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
memcmp-sse4.
* sysdeps/x86_64/multiarch/memcmp-sse4.S: New file.
* sysdeps/x86_64/multiarch/memcmp.S: New file.
* sysdeps/x86_64/multiarch/rtld-memcmp.c: New file.

2010-04-13 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/multiarch/init-arch.h: Pretty printing.
Add SSE 4.1 macros.

2010-04-10 Matt Fleming <matt@console-pimps.org>

* elf/elf.h: Add SH specific ELF header flags.

2010-04-13 Andreas Schwab <schwab@redhat.com>

* sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c: Fix setup of
overflow area.
* sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c: Likewise.

2010-04-12 Andreas Schwab <schwab@redhat.com>

* stdlib/tst-makecontext3.c (main): Initialize ucontext_t objects
only with getcontext. Test for unimplemented makecontext by
checking errno.

2010-04-09 Ulrich Drepper <drepper@redhat.com>

* nscd/aicache.c (addhstaiX): Correct passing memory to address
Expand Down
12 changes: 8 additions & 4 deletions elf/dl-version.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,14 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
while (1)
{
ElfW(Half) ndx = aux->vna_other & 0x7fff;
map->l_versions[ndx].hash = aux->vna_hash;
map->l_versions[ndx].hidden = aux->vna_other & 0x8000;
map->l_versions[ndx].name = &strtab[aux->vna_name];
map->l_versions[ndx].filename = &strtab[ent->vn_file];
/* In trace mode, dependencies may be missing. */
if (__builtin_expect (ndx < map->l_nversions, 1))
{
map->l_versions[ndx].hash = aux->vna_hash;
map->l_versions[ndx].hidden = aux->vna_other & 0x8000;
map->l_versions[ndx].name = &strtab[aux->vna_name];
map->l_versions[ndx].filename = &strtab[ent->vn_file];
}

if (aux->vna_next == 0)
/* No more symbols. */
Expand Down
24 changes: 24 additions & 0 deletions elf/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -2477,6 +2477,30 @@ typedef Elf32_Addr Elf32_Conflict;

/* SH specific declarations */

/* Processor specific flags for the ELF header e_flags field. */
#define EF_SH_MACH_MASK 0x1f
#define EF_SH_UNKNOWN 0x0
#define EF_SH1 0x1
#define EF_SH2 0x2
#define EF_SH3 0x3
#define EF_SH_DSP 0x4
#define EF_SH3_DSP 0x5
#define EF_SH4AL_DSP 0x6
#define EF_SH3E 0x8
#define EF_SH4 0x9
#define EF_SH2E 0xb
#define EF_SH4A 0xc
#define EF_SH2A 0xd
#define EF_SH4_NOFPU 0x10
#define EF_SH4A_NOFPU 0x11
#define EF_SH4_NOMMU_NOFPU 0x12
#define EF_SH2A_NOFPU 0x13
#define EF_SH3_NOMMU 0x14
#define EF_SH2A_SH4_NOFPU 0x15
#define EF_SH2A_SH3_NOFPU 0x16
#define EF_SH2A_SH4 0x17
#define EF_SH2A_SH3E 0x18

/* SH relocs. */
#define R_SH_NONE 0
#define R_SH_DIR32 1
Expand Down
62 changes: 33 additions & 29 deletions stdlib/tst-makecontext3.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,38 +136,42 @@ main (void)
exit (1);
}

ctx[1] = ctx[0];
if (getcontext (&ctx[1]) != 0)
{
printf ("%s: getcontext: %m\n", __FUNCTION__);
exit (1);
}

ctx[1].uc_stack.ss_sp = st1;
ctx[1].uc_stack.ss_size = sizeof st1;
ctx[1].uc_link = &ctx[0];
{
ucontext_t tempctx = ctx[1];
makecontext (&ctx[1], (void (*) (void)) f1, 33,
0x00000001 << flag, 0x00000004 << flag,
0x00000012 << flag, 0x00000048 << flag,
0x00000123 << flag, 0x0000048d << flag,
0x00001234 << flag, 0x000048d1 << flag,
0x00012345 << flag, 0x00048d15 << flag,
0x00123456 << flag, 0x0048d159 << flag,
0x01234567 << flag, 0x048d159e << flag,
0x12345678 << flag, 0x48d159e2 << flag,
0x23456789 << flag, 0x8d159e26 << flag,
0x3456789a << flag, 0xd159e26a << flag,
0x456789ab << flag, 0x159e26af << flag,
0x56789abc << flag, 0x59e26af3 << flag,
0x6789abcd << flag, 0x9e26af37 << flag,
0x789abcde << flag, 0xe26af37b << flag,
0x89abcdef << flag, 0x26af37bc << flag,
0x9abcdef0 << flag, 0x6af37bc3 << flag,
0xabcdef0f << flag);

/* Without this check, a stub makecontext can make us spin forever. */
if (memcmp (&tempctx, &ctx[1], sizeof ctx[1]) == 0)
{
puts ("makecontext was a no-op, presuming not implemented");
return 0;
}
}
errno = 0;
makecontext (&ctx[1], (void (*) (void)) f1, 33,
0x00000001 << flag, 0x00000004 << flag,
0x00000012 << flag, 0x00000048 << flag,
0x00000123 << flag, 0x0000048d << flag,
0x00001234 << flag, 0x000048d1 << flag,
0x00012345 << flag, 0x00048d15 << flag,
0x00123456 << flag, 0x0048d159 << flag,
0x01234567 << flag, 0x048d159e << flag,
0x12345678 << flag, 0x48d159e2 << flag,
0x23456789 << flag, 0x8d159e26 << flag,
0x3456789a << flag, 0xd159e26a << flag,
0x456789ab << flag, 0x159e26af << flag,
0x56789abc << flag, 0x59e26af3 << flag,
0x6789abcd << flag, 0x9e26af37 << flag,
0x789abcde << flag, 0xe26af37b << flag,
0x89abcdef << flag, 0x26af37bc << flag,
0x9abcdef0 << flag, 0x6af37bc3 << flag,
0xabcdef0f << flag);

/* Without this check, a stub makecontext can make us spin forever. */
if (errno == ENOSYS)
{
puts ("makecontext not implemented");
back_in_main = 1;
return 0;
}

/* Play some tricks with this context. */
if (++global == 1)
Expand Down
39 changes: 35 additions & 4 deletions string/test-strncmp.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Test and measure strncmp functions.
Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2002, 2003, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
Expand Down Expand Up @@ -51,8 +51,8 @@ stupid_strncmp (const char *s1, const char *s2, size_t n)
return ret;
}

static void
do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n,
static int
check_result (impl_t *impl, const char *s1, const char *s2, size_t n,
int exp_result)
{
int result = CALL (impl, s1, s2, n);
Expand All @@ -63,9 +63,19 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n,
error (0, 0, "Wrong result in function %s %d %d", impl->name,
result, exp_result);
ret = 1;
return;
return -1;
}

return 0;
}

static void
do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n,
int exp_result)
{
if (check_result (impl, s1, s2, n, exp_result) < 0)
return;

if (HP_TIMING_AVAIL)
{
hp_timing_t start __attribute ((unused));
Expand Down Expand Up @@ -283,13 +293,34 @@ do_random_tests (void)
}
}

static void
check1 (void)
{
char *s1 = (char *)(buf1 + 0xb2c);
char *s2 = (char *)(buf1 + 0xfd8);
size_t i;
int exp_result;

strcpy(s1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs");
strcpy(s2, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkLMNOPQRSTUV");

for (i = 0; i < 80; i++)
{
exp_result = simple_strncmp (s1, s2, i);
FOR_EACH_IMPL (impl, 0)
check_result (impl, s1, s2, i, exp_result);
}
}

int
test_main (void)
{
size_t i;

test_init ();

check1 ();

printf ("%23s", "");
FOR_EACH_IMPL (impl, 0)
printf ("\t%s", impl->name);
Expand Down
25 changes: 25 additions & 0 deletions sysdeps/i386/configure
Original file line number Diff line number Diff line change
Expand Up @@ -656,3 +656,28 @@ fi
fi
{ $as_echo "$as_me:$LINENO: result: $libc_cv_as_i686" >&5
$as_echo "$libc_cv_as_i686" >&6; }

{ $as_echo "$as_me:$LINENO: checking for AVX support" >&5
$as_echo_n "checking for AVX support... " >&6; }
if test "${libc_cv_cc_avx+set}" = set; then
$as_echo_n "(cached) " >&6
else
if { ac_try='${CC-cc} -mavx -xc /dev/null -S -o /dev/null'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
libc_cv_cc_avx=yes
else
libc_cv_cc_avx=no
fi
fi
{ $as_echo "$as_me:$LINENO: result: $libc_cv_cc_avx" >&5
$as_echo "$libc_cv_cc_avx" >&6; }
if test $libc_cv_cc_avx = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_AVX_SUPPORT 1
_ACEOF

fi
11 changes: 11 additions & 0 deletions sysdeps/i386/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ if AC_TRY_COMMAND([${CC-cc} -Wa,-mtune=i686 -xc /dev/null -S -o /dev/null]); the
else
libc_cv_as_i686=no
fi])

dnl Check if -mavx works.
AC_CACHE_CHECK(for AVX support, libc_cv_cc_avx, [dnl
if AC_TRY_COMMAND([${CC-cc} -mavx -xc /dev/null -S -o /dev/null]); then
libc_cv_cc_avx=yes
else
libc_cv_cc_avx=no
fi])
if test $libc_cv_cc_avx = yes; then
AC_DEFINE(HAVE_AVX_SUPPORT)
fi
6 changes: 6 additions & 0 deletions sysdeps/i386/i686/multiarch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ CFLAGS-strstr.c += -msse4
CFLAGS-strcasestr.c += -msse4
endif
endif

ifeq (mathyes,$(subdir)$(config-cflags-avx))
libm-sysdep_routines += s_fma-fma s_fmaf-fma
CFLAGS-s_fma-fma.c += -mavx -mfpmath=sse
CFLAGS-s_fmaf-fma.c += -mavx -mfpmath=sse
endif
5 changes: 5 additions & 0 deletions sysdeps/i386/i686/multiarch/Versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
libc {
GLIBC_PRIVATE {
__get_cpu_features;
}
}
30 changes: 30 additions & 0 deletions sysdeps/i386/i686/multiarch/s_fma-fma.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* FMA version of fma.
Copyright (C) 2010 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <config.h>

#ifdef HAVE_AVX_SUPPORT
double
__fma_fma (double x, double y, double z)
{
asm ("vfmadd213sd %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z));
return x;
}
#endif
36 changes: 36 additions & 0 deletions sysdeps/i386/i686/multiarch/s_fma.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* Multiple versions of fma.
Copyright (C) 2010 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <config.h>

#ifdef HAVE_AVX_SUPPORT
#include <math.h>
#include <init-arch.h>

extern double __fma_ia32 (double x, double y, double z) attribute_hidden;
extern double __fma_fma (double x, double y, double z) attribute_hidden;

libm_ifunc (__fma, HAS_FMA ? __fma_fma : __fma_ia32);
weak_alias (__fma, fma)

# define __fma __fma_ia32
#endif

#include <math/s_fma.c>
Loading

0 comments on commit 54627f3

Please sign in to comment.