From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0FB2F3858D28 for ; Tue, 20 Sep 2022 10:49:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0FB2F3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663670983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=n+MDBp+J2kEL3aXyD170bTqNKNiLgZ1yuiv/LD3s/SM=; b=d9SPzVMrKDtLfE6fRRni+6aEuyBCTbAET5vAGCBeEHWAl8USUBSrmhrvT7Tr4q3PO5pCNV TWoBH3RAGH2p8+t+14xJiX9Nqs96oGe+PkuHu7UQN63YclyWICX5m/NfuW7yQ40N+ZbTON 8RXwCbIrfaIdDZAHLI5mWpo/yNNhxT4= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-270-YseMjFXhNEOiSgpdjv-S9g-1; Tue, 20 Sep 2022 06:49:42 -0400 X-MC-Unique: YseMjFXhNEOiSgpdjv-S9g-1 Received: by mail-io1-f71.google.com with SMTP id u9-20020a5edd49000000b006a0f03934e9so1217707iop.4 for ; Tue, 20 Sep 2022 03:49:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=n+MDBp+J2kEL3aXyD170bTqNKNiLgZ1yuiv/LD3s/SM=; b=Vl+fS5GF5+BD5QdhwcXh7HBa99GmKANmR5ZfeUVLZqC3efbbxPiqN7p06743CfYEPO OrhG5Ss751lu+1Y+W0JmtAU+mZlSO0i20rcb6M5m0vGqjnOibIGR663/gGWbLUWTcIdw zgdje6D88n7An8rxyTempxufMmjeBBbrcIADNRixj5ETPrizEoGsvHhV/IulJSxp6bTv 4NfSwy6/PYzlf4CJw9t1zOrH8cNL5CpqCfXV4KXDkY8A2TSiMHCq5MgxbbQk8xd6ewBA kuy24j9N3QCDCLIfYSlxL2b6hB+2mUS2cb2zslTPjFgLjxOYfaoWmsEo5PnsLpizNe3t oPFA== X-Gm-Message-State: ACrzQf0ZBF9Eco89yNLneZk+kslADrmiBX1iqYENTgma16COQyQoevOU oSUW4B5VB9mZjv/8c0ExIXnnXm9ZTmeVmX9uGaGH+/i8MeFYtCLJ5kPXluz6CXxEKUMiT0oPJ/H cHQi2CIN/2+BlEuVDGUPj X-Received: by 2002:a05:6638:4110:b0:35a:6d6b:57f7 with SMTP id ay16-20020a056638411000b0035a6d6b57f7mr10183724jab.134.1663670981548; Tue, 20 Sep 2022 03:49:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5s76n4L1ghibLWZczRduvNYkT/kdDMSr20prPRi64pbjBV+uqcCHTrLBkUJJcV/DERNr9GDg== X-Received: by 2002:a05:6638:4110:b0:35a:6d6b:57f7 with SMTP id ay16-20020a056638411000b0035a6d6b57f7mr10183715jab.134.1663670981304; Tue, 20 Sep 2022 03:49:41 -0700 (PDT) Received: from fedora ([104.129.158.232]) by smtp.gmail.com with ESMTPSA id g3-20020a05663810e300b0034ac4b215c3sm499015jae.102.2022.09.20.03.49.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 03:49:40 -0700 (PDT) Date: Tue, 20 Sep 2022 06:49:38 -0400 From: Carlos O'Donell To: Adhemerval Zanella Cc: libc-alpha@sourceware.org, Richard Henderson Subject: Re: [PATCH v5 02/17] Parameterize OP_T_THRES from memcopy.h Message-ID: References: <20220919195920.956393-1-adhemerval.zanella@linaro.org> <20220919195920.956393-3-adhemerval.zanella@linaro.org> MIME-Version: 1.0 In-Reply-To: <20220919195920.956393-3-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Sep 19, 2022 at 04:59:05PM -0300, Adhemerval Zanella via Libc-alpha wrote: > From: Richard Henderson > > It moves OP_T_THRES out of memcopy.h to its own header and adjust > each architecture that redefines it. > > Checked with a build and check with run-built-tests=no for all major > Linux ABIs. This is a generic refactor which I think can go in regardless. We can always reorganize again if we end up wtih too many split headers and want to talk about unrolling in different contexts. LGTM. Reviewed-by: Carlos O'Donell > Co-authored-by: Adhemerval Zanella > --- > string/memcmp.c | 3 --- > sysdeps/generic/memcopy.h | 4 +--- > sysdeps/generic/string-opthr.h | 25 ++++++++++++++++++++++ > sysdeps/i386/memcopy.h | 3 --- > sysdeps/i386/string-opthr.h | 25 ++++++++++++++++++++++ > sysdeps/m68k/memcopy.h | 3 --- > sysdeps/powerpc/powerpc32/power4/memcopy.h | 5 ----- > 7 files changed, 51 insertions(+), 17 deletions(-) > create mode 100644 sysdeps/generic/string-opthr.h > create mode 100644 sysdeps/i386/string-opthr.h > > diff --git a/string/memcmp.c b/string/memcmp.c > index 6a9ceb8ac3..7c4606c2d0 100644 > --- a/string/memcmp.c > +++ b/string/memcmp.c > @@ -48,9 +48,6 @@ > and store. Must be an unsigned type. */ > # define OPSIZ (sizeof (op_t)) > > -/* Threshold value for when to enter the unrolled loops. */ > -# define OP_T_THRES 16 > - > /* Type to use for unaligned operations. */ > typedef unsigned char byte; > > diff --git a/sysdeps/generic/memcopy.h b/sysdeps/generic/memcopy.h > index efe5f2475d..a6baa4dfbb 100644 > --- a/sysdeps/generic/memcopy.h > +++ b/sysdeps/generic/memcopy.h > @@ -57,6 +57,7 @@ > > /* Type to use for aligned memory operations. */ > #include > +#include > #define OPSIZ (sizeof (op_t)) > > /* Type to use for unaligned operations. */ > @@ -188,9 +189,6 @@ extern void _wordcopy_bwd_dest_aligned (long int, long int, size_t) > > #endif > > -/* Threshold value for when to enter the unrolled loops. */ > -#define OP_T_THRES 16 > - > /* Set to 1 if memcpy is safe to use for forward-copying memmove with > overlapping addresses. This is 0 by default because memcpy implementations > are generally not safe for overlapping addresses. */ > diff --git a/sysdeps/generic/string-opthr.h b/sysdeps/generic/string-opthr.h > new file mode 100644 > index 0000000000..eabd9fd669 > --- /dev/null > +++ b/sysdeps/generic/string-opthr.h > @@ -0,0 +1,25 @@ > +/* Define a threshold for word access. Generic version. > + Copyright (C) 2022 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_OPTHR_H > +#define _STRING_OPTHR_H 1 > + > +/* Threshold value for when to enter the unrolled loops. */ > +#define OP_T_THRES 16 > + > +#endif /* string-opthr.h */ > diff --git a/sysdeps/i386/memcopy.h b/sysdeps/i386/memcopy.h > index 8cbf182096..66f5665f82 100644 > --- a/sysdeps/i386/memcopy.h > +++ b/sysdeps/i386/memcopy.h > @@ -18,9 +18,6 @@ > > #include > > -#undef OP_T_THRES > -#define OP_T_THRES 8 > - > #undef BYTE_COPY_FWD > #define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \ > do { \ > diff --git a/sysdeps/i386/string-opthr.h b/sysdeps/i386/string-opthr.h > new file mode 100644 > index 0000000000..ed3e4b2ddb > --- /dev/null > +++ b/sysdeps/i386/string-opthr.h > @@ -0,0 +1,25 @@ > +/* Define a threshold for word access. i386 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 I386_STRING_OPTHR_H > +#define I386_STRING_OPTHR_H 1 > + > +/* Threshold value for when to enter the unrolled loops. */ > +#define OP_T_THRES 8 > + > +#endif /* I386_STRING_OPTHR_H */ > diff --git a/sysdeps/m68k/memcopy.h b/sysdeps/m68k/memcopy.h > index cf147f2c4a..3777baac21 100644 > --- a/sysdeps/m68k/memcopy.h > +++ b/sysdeps/m68k/memcopy.h > @@ -20,9 +20,6 @@ > > #if defined(__mc68020__) || defined(mc68020) > > -#undef OP_T_THRES > -#define OP_T_THRES 16 > - > /* WORD_COPY_FWD and WORD_COPY_BWD are not symmetric on the 68020, > because of its weird instruction overlap characteristics. */ > > diff --git a/sysdeps/powerpc/powerpc32/power4/memcopy.h b/sysdeps/powerpc/powerpc32/power4/memcopy.h > index a98f6662d8..d27caa2277 100644 > --- a/sysdeps/powerpc/powerpc32/power4/memcopy.h > +++ b/sysdeps/powerpc/powerpc32/power4/memcopy.h > @@ -50,11 +50,6 @@ > [I fail to understand. I feel stupid. --roland] > */ > > - > -/* Threshold value for when to enter the unrolled loops. */ > -#undef OP_T_THRES > -#define OP_T_THRES 16 > - > /* Copy exactly NBYTES bytes from SRC_BP to DST_BP, > without any assumptions about alignment of the pointers. */ > #undef BYTE_COPY_FWD > -- > 2.34.1 >