diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 19:01:57 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 19:01:57 +0000 |
commit | cab56836b146bc129f1ad43f0393d95a9deca63a (patch) | |
tree | 4f4e655319bbac78fca170da05275c127429b460 /sysdeps/s390/bits | |
parent | 04ac1241a4cd004872282c2c82ec37fa33925292 (diff) | |
parent | 82dd75a7f436a19047325d62182590c9f9e23a78 (diff) |
Merge branch 't/tls' into refs/top-bases/t/tls-threadvar
Diffstat (limited to 'sysdeps/s390/bits')
-rw-r--r-- | sysdeps/s390/bits/byteswap-16.h | 65 | ||||
-rw-r--r-- | sysdeps/s390/bits/byteswap.h | 134 | ||||
-rw-r--r-- | sysdeps/s390/bits/flt-eval-method.h (renamed from sysdeps/s390/bits/mathdef.h) | 24 | ||||
-rw-r--r-- | sysdeps/s390/bits/link.h | 31 | ||||
-rw-r--r-- | sysdeps/s390/bits/setjmp.h | 2 | ||||
-rw-r--r-- | sysdeps/s390/bits/string.h | 252 | ||||
-rw-r--r-- | sysdeps/s390/bits/xtitypes.h | 2 |
7 files changed, 38 insertions, 472 deletions
diff --git a/sysdeps/s390/bits/byteswap-16.h b/sysdeps/s390/bits/byteswap-16.h deleted file mode 100644 index 87514d1b92..0000000000 --- a/sysdeps/s390/bits/byteswap-16.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Macros to swap the order of bytes in 16-bit integer values. s390 version - Copyright (C) 2012-2016 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _BITS_BYTESWAP_H -# error "Never use <bits/byteswap-16.h> directly; include <byteswap.h> instead." -#endif - -#include <bits/wordsize.h> - -/* Swap bytes in 16 bit value. */ -#if defined __GNUC__ && __GNUC__ >= 2 -# if __WORDSIZE == 64 -# define __bswap_16(x) \ - (__extension__ \ - ({ unsigned short int __v, __x = (unsigned short int) (x); \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_16 (__x); \ - else { \ - unsigned short int __tmp = (unsigned short int) (__x); \ - __asm__ __volatile__ ( \ - "lrvh %0,%1" \ - : "=&d" (__v) : "m" (__tmp) ); \ - } \ - __v; })) -# else -# define __bswap_16(x) \ - (__extension__ \ - ({ unsigned short int __v, __x = (unsigned short int) (x); \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_16 (__x); \ - else { \ - unsigned short int __tmp = (unsigned short int) (__x); \ - __asm__ __volatile__ ( \ - "sr %0,%0\n" \ - "la 1,%1\n" \ - "icm %0,2,1(1)\n" \ - "ic %0,0(1)" \ - : "=&d" (__v) : "m" (__tmp) : "1"); \ - } \ - __v; })) -# endif -#else -/* This is better than nothing. */ -static __inline unsigned short int -__bswap_16 (unsigned short int __bsx) -{ - return __bswap_constant_16 (__bsx); -} -#endif diff --git a/sysdeps/s390/bits/byteswap.h b/sysdeps/s390/bits/byteswap.h deleted file mode 100644 index 6a8cb9d82b..0000000000 --- a/sysdeps/s390/bits/byteswap.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Macros to swap the order of bytes in integer values. s390 version. - Copyright (C) 2000-2016 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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, see - <http://www.gnu.org/licenses/>. */ - -#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H -# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead." -#endif - -#include <bits/wordsize.h> - -#ifndef _BITS_BYTESWAP_H -#define _BITS_BYTESWAP_H 1 - -#define __bswap_constant_16(x) \ - ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) - -/* Get __bswap_16. */ -#include <bits/byteswap-16.h> - -/* Swap bytes in 32 bit value. */ -#define __bswap_constant_32(x) \ - ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) - -#if defined __GNUC__ && __GNUC__ >= 2 -# if __WORDSIZE == 64 -# define __bswap_32(x) \ - (__extension__ \ - ({ unsigned int __v, __x = (x); \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (__x); \ - else { \ - unsigned int __tmp = (unsigned int) (__x); \ - __asm__ __volatile__ ( \ - "lrv %0,%1" \ - : "=&d" (__v) : "m" (__tmp)); \ - } \ - __v; })) -# else -# define __bswap_32(x) \ - (__extension__ \ - ({ unsigned int __v, __x = (x); \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (__x); \ - else { \ - unsigned int __tmp = (unsigned int) (__x); \ - __asm__ __volatile__ ( \ - "la 1,%1\n" \ - "icm %0,8,3(1)\n" \ - "icm %0,4,2(1)\n" \ - "icm %0,2,1(1)\n" \ - "ic %0,0(1)" \ - : "=&d" (__v) : "m" (__tmp) : "1"); \ - } \ - __v; })) -# endif -#else -static __inline unsigned int -__bswap_32 (unsigned int __bsx) -{ - return __bswap_constant_32 (__bsx); -} -#endif - -/* Swap bytes in 64 bit value. */ -#if defined __GNUC__ && __GNUC__ >= 2 -# define __bswap_constant_64(x) \ - (__extension__ ((((x) & 0xff00000000000000ul) >> 56) \ - | (((x) & 0x00ff000000000000ul) >> 40) \ - | (((x) & 0x0000ff0000000000ul) >> 24) \ - | (((x) & 0x000000ff00000000ul) >> 8) \ - | (((x) & 0x00000000ff000000ul) << 8) \ - | (((x) & 0x0000000000ff0000ul) << 24) \ - | (((x) & 0x000000000000ff00ul) << 40) \ - | (((x) & 0x00000000000000fful) << 56))) - -# if __WORDSIZE == 64 -# define __bswap_64(x) \ - (__extension__ \ - ({ unsigned long __w, __x = (x); \ - if (__builtin_constant_p (x)) \ - __w = __bswap_constant_64 (__x); \ - else { \ - unsigned long __tmp = (unsigned long) (__x); \ - __asm__ __volatile__ ( \ - "lrvg %0,%1" \ - : "=&d" (__w) : "m" (__tmp)); \ - } \ - __w; })) -# else -# define __bswap_64(x) \ - __extension__ \ - ({ union { unsigned long long int __ll; \ - unsigned long int __l[2]; } __w, __r; \ - __w.__ll = (x); \ - __r.__l[0] = __bswap_32 (__w.__l[1]); \ - __r.__l[1] = __bswap_32 (__w.__l[0]); \ - __r.__ll; }) -# endif -#else -# define __bswap_constant_64(x) \ - ((((x) & 0xff00000000000000ull) >> 56) \ - | (((x) & 0x00ff000000000000ull) >> 40) \ - | (((x) & 0x0000ff0000000000ull) >> 24) \ - | (((x) & 0x000000ff00000000ull) >> 8) \ - | (((x) & 0x00000000ff000000ull) << 8) \ - | (((x) & 0x0000000000ff0000ull) << 24) \ - | (((x) & 0x000000000000ff00ull) << 40) \ - | (((x) & 0x00000000000000ffull) << 56)) - -__extension__ -static __inline unsigned long long int -__bswap_64 (unsigned long long int __bsx) -{ - return __bswap_constant_64 (__bsx); -} -#endif - -#endif /* _BITS_BYTESWAP_H */ diff --git a/sysdeps/s390/bits/mathdef.h b/sysdeps/s390/bits/flt-eval-method.h index 8c47ade208..b0663e80cc 100644 --- a/sysdeps/s390/bits/mathdef.h +++ b/sysdeps/s390/bits/flt-eval-method.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Define __GLIBC_FLT_EVAL_METHOD. S/390 version. + Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -15,22 +16,9 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#if !defined _MATH_H && !defined _COMPLEX_H -# error "Never use <bits/mathdef.h> directly; include <math.h> instead" +#ifndef _MATH_H +# error "Never use <bits/flt-eval-method.h> directly; include <math.h> instead." #endif -#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF -# define _MATH_H_MATHDEF 1 - -/* Normally, there is no long double type and the `float' and `double' - expressions are evaluated as `double'. */ -typedef double float_t; /* `float' expressions are evaluated as - `double'. */ -typedef double double_t; /* `double' expressions are evaluated as - `double'. */ - -/* The values returned by `ilogb' for 0 and NaN respectively. */ -# define FP_ILOGB0 (-2147483647) -# define FP_ILOGBNAN 2147483647 - -#endif /* ISO C99 */ +/* This value is used because of a historical mistake. */ +#define __GLIBC_FLT_EVAL_METHOD 1 diff --git a/sysdeps/s390/bits/link.h b/sysdeps/s390/bits/link.h index 2ef7f44225..8d17e9245b 100644 --- a/sysdeps/s390/bits/link.h +++ b/sysdeps/s390/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2016 Free Software Foundation, Inc. +/* Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +19,9 @@ # error "Never include <bits/link.h> directly; use <link.h> instead." #endif +#if defined HAVE_S390_VX_ASM_SUPPORT +typedef char La_s390_vr[16]; +#endif #if __ELF_NATIVE_CLASS == 32 @@ -32,6 +35,16 @@ typedef struct La_s390_32_regs uint32_t lr_r6; double lr_fp0; double lr_fp2; +# if defined HAVE_S390_VX_ASM_SUPPORT + La_s390_vr lr_v24; + La_s390_vr lr_v25; + La_s390_vr lr_v26; + La_s390_vr lr_v27; + La_s390_vr lr_v28; + La_s390_vr lr_v29; + La_s390_vr lr_v30; + La_s390_vr lr_v31; +# endif } La_s390_32_regs; /* Return values for calls from PLT on s390-32. */ @@ -40,6 +53,9 @@ typedef struct La_s390_32_retval uint32_t lrv_r2; uint32_t lrv_r3; double lrv_fp0; +# if defined HAVE_S390_VX_ASM_SUPPORT + La_s390_vr lrv_v24; +# endif } La_s390_32_retval; @@ -77,6 +93,16 @@ typedef struct La_s390_64_regs double lr_fp2; double lr_fp4; double lr_fp6; +# if defined HAVE_S390_VX_ASM_SUPPORT + La_s390_vr lr_v24; + La_s390_vr lr_v25; + La_s390_vr lr_v26; + La_s390_vr lr_v27; + La_s390_vr lr_v28; + La_s390_vr lr_v29; + La_s390_vr lr_v30; + La_s390_vr lr_v31; +# endif } La_s390_64_regs; /* Return values for calls from PLT on s390-64. */ @@ -84,6 +110,9 @@ typedef struct La_s390_64_retval { uint64_t lrv_r2; double lrv_fp0; +# if defined HAVE_S390_VX_ASM_SUPPORT + La_s390_vr lrv_v24; +# endif } La_s390_64_retval; diff --git a/sysdeps/s390/bits/setjmp.h b/sysdeps/s390/bits/setjmp.h index 8d29e8dbd8..07229c292f 100644 --- a/sysdeps/s390/bits/setjmp.h +++ b/sysdeps/s390/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/s390/bits/string.h b/sysdeps/s390/bits/string.h deleted file mode 100644 index 39e0b7fe7c..0000000000 --- a/sysdeps/s390/bits/string.h +++ /dev/null @@ -1,252 +0,0 @@ -/* Optimized, inlined string functions. S/390 version. - Copyright (C) 2000-2016 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _STRING_H -# error "Never use <bits/string.h> directly; include <string.h> instead." -#endif - -/* Use the unaligned string inline ABI. */ -#define _STRING_INLINE_unaligned 1 - -/* We only provide optimizations if the user selects them and if - GNU CC is used. */ -#if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \ - && defined __GNUC__ && __GNUC__ >= 2 - -#ifndef __STRING_INLINE -# ifndef __extern_inline -# define __STRING_INLINE inline -# else -# define __STRING_INLINE __extern_inline -# endif -#endif - -#define _HAVE_STRING_ARCH_strlen 1 -#ifndef _FORCE_INLINES -#define strlen(str) __strlen_g ((str)) - -__STRING_INLINE size_t __strlen_g (const char *) __asm__ ("strlen"); - -__STRING_INLINE size_t -__strlen_g (const char *__str) -{ - char *__ptr, *__tmp; - - __ptr = (char *) 0; - __tmp = (char *) __str; - __asm__ __volatile__ (" la 0,0\n" - "0: srst %0,%1\n" - " jo 0b\n" - : "+&a" (__ptr), "+&a" (__tmp) : - : "cc", "memory", "0" ); - return (size_t) (__ptr - __str); -} -#endif - -/* Copy SRC to DEST. */ -#define _HAVE_STRING_ARCH_strcpy 1 -#ifndef _FORCE_INLINES -#define strcpy(dest, src) __strcpy_g ((dest), (src)) - -__STRING_INLINE char *__strcpy_g (char *, const char *) __asm__ ("strcpy"); - -__STRING_INLINE char * -__strcpy_g (char *__dest, const char *__src) -{ - char *tmp = __dest; - - __asm__ __volatile__ (" la 0,0\n" - "0: mvst %0,%1\n" - " jo 0b" - : "+&a" (__dest), "+&a" (__src) : - : "cc", "memory", "0" ); - return tmp; -} -#endif - -#define _HAVE_STRING_ARCH_strncpy 1 -#ifndef _FORCE_INLINES -#define strncpy(dest, src, n) __strncpy_g ((dest), (src), (n)) - -__STRING_INLINE char *__strncpy_g (char *, const char *, size_t) - __asm__ ("strncpy"); - -__STRING_INLINE char * -__strncpy_g (char *__dest, const char *__src, size_t __n) -{ - char *__ret = __dest; - char *__ptr; - size_t __diff; - - if (__n > 0) { - __diff = (size_t) (__dest - __src); - __ptr = (char *) __src; - __asm__ __volatile__ (" j 1f\n" - "0: la %0,1(%0)\n" - "1: icm 0,1,0(%0)\n" - " stc 0,0(%2,%0)\n" - " jz 3f\n" -#if defined(__s390x__) - " brctg %1,0b\n" -#else - " brct %1,0b\n" -#endif - " j 4f\n" - "2: la %0,1(%0)\n" - " stc 0,0(%2,%0)\n" -#if defined(__s390x__) - "3: brctg %1,2b\n" -#else - "3: brct %1,2b\n" -#endif - "4:" - : "+&a" (__ptr), "+&a" (__n) : "a" (__diff) - : "cc", "memory", "0" ); - } - return __ret; -} -#endif - -/* Append SRC onto DEST. */ -#define _HAVE_STRING_ARCH_strcat 1 -#ifndef _FORCE_INLINES -#define strcat(dest, src) __strcat_g ((dest), (src)) - -__STRING_INLINE char *__strcat_g (char *, const char *) __asm__ ("strcat"); - -__STRING_INLINE char * -__strcat_g (char *__dest, const char *__src) -{ - char *__ret = __dest; - char *__ptr, *__tmp; - - /* Move __ptr to the end of __dest. */ - __ptr = (char *) 0; - __tmp = __dest; - __asm__ __volatile__ (" la 0,0\n" - "0: srst %0,%1\n" - " jo 0b\n" - : "+&a" (__ptr), "+&a" (__tmp) : - : "cc", "0" ); - - /* Now do the copy. */ - __asm__ __volatile__ (" la 0,0\n" - "0: mvst %0,%1\n" - " jo 0b" - : "+&a" (__ptr), "+&a" (__src) : - : "cc", "memory", "0" ); - return __ret; -} -#endif - -/* Append no more than N characters from SRC onto DEST. */ -#define _HAVE_STRING_ARCH_strncat 1 -#ifndef _FORCE_INLINES -#define strncat(dest, src, n) __strncat_g ((dest), (src), (n)) - -__STRING_INLINE char *__strncat_g (char *, const char *, size_t) - __asm__ ("strncat"); - -__STRING_INLINE char * -__strncat_g (char *__dest, const char *__src, size_t __n) -{ - char *__ret = __dest; - char *__ptr, *__tmp; - size_t __diff; - - if (__n > 0) { - /* Move __ptr to the end of __dest. */ - __ptr = (char *) 0; - __tmp = __dest; - __asm__ __volatile__ (" la 0,0\n" - "0: srst %0,%1\n" - " jo 0b\n" - : "+&a" (__ptr), "+&a" (__tmp) : - : "cc", "memory", "0" ); - - __diff = (size_t) (__ptr - __src); - __tmp = (char *) __src; - __asm__ __volatile__ (" j 1f\n" - "0: la %0,1(%0)\n" - "1: icm 0,1,0(%0)\n" - " stc 0,0(%2,%0)\n" - " jz 2f\n" -#if defined(__s390x__) - " brctg %1,0b\n" -#else - " brct %1,0b\n" -#endif - " slr 0,0\n" - " stc 0,1(%2,%0)\n" - "2:" - : "+&a" (__tmp), "+&a" (__n) : "a" (__diff) - : "cc", "memory", "0" ); - - } - return __ret; -} -#endif - -/* Search N bytes of S for C. */ -#define _HAVE_STRING_ARCH_memchr 1 -#ifndef _FORCE_INLINES -__STRING_INLINE void * -memchr (const void *__str, int __c, size_t __n) -{ - char *__ptr, *__tmp; - - __tmp = (char *) __str; - __ptr = (char *) __tmp + __n; - __asm__ __volatile__ (" lhi 0,0xff\n" - " nr 0,%2\n" - "0: srst %0,%1\n" - " jo 0b\n" - " brc 13,1f\n" - " la %0,0\n" - "1:" - : "+&a" (__ptr), "+&a" (__tmp) : "d" (__c) - : "cc", "memory", "0" ); - return __ptr; -} -#endif - -/* Compare S1 and S2. */ -#define _HAVE_STRING_ARCH_strcmp 1 -#ifndef _FORCE_INLINES -__STRING_INLINE int -strcmp (const char *__s1, const char *__s2) -{ - char *__p1, *__p2; - int __ret; - - __p1 = (char *) __s1; - __p2 = (char *) __s2; - __asm__ __volatile__ (" slr 0,0\n" - "0: clst %1,%2\n" - " jo 0b\n" - " ipm %0\n" - " srl %0,28" - : "=d" (__ret), "+&a" (__p1), "+&a" (__p2) : - : "cc", "memory", "0" ); - __ret = (__ret == 0) ? 0 : (__ret == 1) ? -1 : 1; - return __ret; -} -#endif - -#endif /* Use string inlines && GNU CC. */ diff --git a/sysdeps/s390/bits/xtitypes.h b/sysdeps/s390/bits/xtitypes.h index 3c9606a636..462b126d11 100644 --- a/sysdeps/s390/bits/xtitypes.h +++ b/sysdeps/s390/bits/xtitypes.h @@ -1,5 +1,5 @@ /* bits/xtitypes.h -- Define some types used by <bits/stropts.h>. S390/S390x - Copyright (C) 2002-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or |