From patchwork Wed Jan 10 12:47:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 25312 Received: (qmail 129960 invoked by alias); 10 Jan 2018 12:48:43 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 120627 invoked by uid 89); 10 Jan 2018 12:48:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*rth X-HELO: mail-qt0-f195.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fTc+nqctqGyeIWTSzskTRZNdD2E/CoCwkDIgQhLo3X4=; b=hTvFYlcJWYKmMTLnGvUyAp8fbDawhNXjsEpqNsSgfItQfXE5Vg1i9kr7/8rfeZ1RsH S5oyag+5JBwt9SNdwgq0XoE5Ap9SuO11Pn59AUsSNp08H1RmGkCiI/FXPuBipaCvBovq c9rP/5iCIlzjgi5z9S2D6t/dldWjQRPx85a58oOFmdXrdsC8EMvr3T/aCNA5Zx4pgL56 25GAZxl0lbmILMQm5LcrYtq0tDZH9FP5xAPRthe0ulXkeR421sjYGG4bv75AdZueF5EA Lvr3zJ8jJwrwQp5SMToNLWybqbsPKSxdFyB4U+N2XWS08shdnfJyjXcr8BoxEDJpAmv1 1Lkw== X-Gm-Message-State: AKwxytfC1uNbrxYJKPwf7qgCapPhhALhYL5dYd8N5gtOPHpwwvggwUfu vg0h+na0DIqxBTQzfzx3Sr9sDMgUXkQ= X-Google-Smtp-Source: ACJfBot4c0iVEp6/TdUzal5R59mW33mhtIhPLtOUWve7wP6RegH0Gas/kWPazLuUblSGQ/d5yXKzbg== X-Received: by 10.200.5.10 with SMTP id u10mr26968140qtg.103.1515588490881; Wed, 10 Jan 2018 04:48:10 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Richard Henderson Subject: [PATCH v3 01/18] Parameterize op_t from memcopy.h Date: Wed, 10 Jan 2018 10:47:45 -0200 Message-Id: <1515588482-15744-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1515588482-15744-1-git-send-email-adhemerval.zanella@linaro.org> References: <1515588482-15744-1-git-send-email-adhemerval.zanella@linaro.org> From: Richard Henderson Basically moves op_t definition out to an specific header, adds the attribute 'may-alias', and cleanup its duplicated definitions. It lead to inclusion of tilegx32 gmp-mparam.h similar to x32 so op_t can be define as a long long (from _LONG_LONG_LIMB). Checked with a build and check with run-built-tests=no for all major Linux ABIs (alpha, aarch64, arm, hppa, i686, ia64, m68k, microblaze, mips, mips64, nios2, powerpc, powerpc64le, s390x, sh4, sparc64, tilegx, and x86_64). Richard Henderson Adhemerval Zanella * sysdeps/generic/string-optype.h: New file. * sysdeps/generic/memcopy.h: Include it. * string/memcmp.c (op_t): Remove define. * sysdeps/tile/memcmp.c (op_t): Likewise. * sysdeps/tile/memcopy.h (op_t): Likewise. * sysdeps/tile/tilegx32/gmp-mparam.h: New file. --- string/memcmp.c | 1 - sysdeps/generic/memcopy.h | 7 +++---- sysdeps/generic/string-optype.h | 31 +++++++++++++++++++++++++++++++ sysdeps/tile/memcmp.c | 1 - sysdeps/tile/memcopy.h | 7 ------- sysdeps/tile/tilegx32/gmp-mparam.h | 30 ++++++++++++++++++++++++++++++ 6 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 sysdeps/generic/string-optype.h create mode 100644 sysdeps/tile/tilegx32/gmp-mparam.h diff --git a/string/memcmp.c b/string/memcmp.c index aea5129..4fd2f83 100644 --- a/string/memcmp.c +++ b/string/memcmp.c @@ -46,7 +46,6 @@ /* Type to use for aligned memory operations. This should normally be the biggest type supported by a single load and store. Must be an unsigned type. */ -# define op_t unsigned long int # define OPSIZ (sizeof(op_t)) /* Threshold value for when to enter the unrolled loops. */ diff --git a/sysdeps/generic/memcopy.h b/sysdeps/generic/memcopy.h index c0d8da3..c7e9cc9 100644 --- a/sysdeps/generic/memcopy.h +++ b/sysdeps/generic/memcopy.h @@ -56,10 +56,9 @@ [I fail to understand. I feel stupid. --roland] */ -/* Type to use for aligned memory operations. - This should normally be the biggest type supported by a single load - and store. */ -#define op_t unsigned long int +/* Type to use for aligned memory operations. */ +#include + #define OPSIZ (sizeof(op_t)) /* Type to use for unaligned operations. */ diff --git a/sysdeps/generic/string-optype.h b/sysdeps/generic/string-optype.h new file mode 100644 index 0000000..1324070 --- /dev/null +++ b/sysdeps/generic/string-optype.h @@ -0,0 +1,31 @@ +/* Define a type to use for word access. Generic version. + Copyright (C) 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 + 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 + . */ + +#ifndef STRING_OPTYPE_H +#define STRING_OPTYPE_H 1 + +/* Use the existing parameterization from gmp as a default. */ +#include + +#ifdef _LONG_LONG_LIMB +typedef unsigned long long int __attribute__((__may_alias__)) op_t; +#else +typedef unsigned long int __attribute__((__may_alias__)) op_t; +#endif + +#endif /* string-optype.h */ diff --git a/sysdeps/tile/memcmp.c b/sysdeps/tile/memcmp.c index b7cf00a..89fff57 100644 --- a/sysdeps/tile/memcmp.c +++ b/sysdeps/tile/memcmp.c @@ -45,7 +45,6 @@ /* Type to use for aligned memory operations. This should normally be the biggest type supported by a single load and store. Must be an unsigned type. */ -# define op_t unsigned long int # define OPSIZ (sizeof(op_t)) /* Threshold value for when to enter the unrolled loops. */ diff --git a/sysdeps/tile/memcopy.h b/sysdeps/tile/memcopy.h index 0c357c1..748f648 100644 --- a/sysdeps/tile/memcopy.h +++ b/sysdeps/tile/memcopy.h @@ -22,10 +22,3 @@ /* The tilegx implementation of memcpy is safe to use for memmove. */ #undef MEMCPY_OK_FOR_FWD_MEMMOVE #define MEMCPY_OK_FOR_FWD_MEMMOVE 1 - -/* Support more efficient copying on tilegx32, which supports - long long as a native 64-bit type. */ -#if __WORDSIZE == 32 -# undef op_t -# define op_t unsigned long long int -#endif diff --git a/sysdeps/tile/tilegx32/gmp-mparam.h b/sysdeps/tile/tilegx32/gmp-mparam.h new file mode 100644 index 0000000..7d1cb98 --- /dev/null +++ b/sysdeps/tile/tilegx32/gmp-mparam.h @@ -0,0 +1,30 @@ +/* Compiler/machine parameter header file. TileGX32 version. + + Copyright (C) 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 + 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 + . */ + +#if defined __GMP_H__ && ! defined _LONG_LONG_LIMB +#error "Included too late for _LONG_LONG_LIMB to take effect" +#endif + +#define _LONG_LONG_LIMB +#define BITS_PER_MP_LIMB 64 +#define BYTES_PER_MP_LIMB 8 +#define BITS_PER_LONGINT 32 +#define BITS_PER_INT 32 +#define BITS_PER_SHORTINT 16 +#define BITS_PER_CHAR 8