From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id BFE483858D37 for ; Thu, 27 Jul 2023 20:26:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFE483858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-307d58b3efbso1370612f8f.0 for ; Thu, 27 Jul 2023 13:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690489594; x=1691094394; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=X7DKlZuDi/19VNtuzqHU5yNUAMJeyEPYyv6mk68z0EY=; b=HN9+7qrgJChiFGG2+L45vWDvxTEuJJA59neNgJIjDVA8iexsWkJm8wNT/9d1oAgaee Uz5j2GW/BGDzU9gDxri0aFPdKlFAW+TIs3FaF4ZpraZHRosr2d5w2FBkL7jVDpMb/CJB Vjq9Fqki2FTZpXUn1/IDnQ5aa2GS0LwlfQxGznieqlgt1vragcNotr9B5D9G7zRepZyj DYwFnfdng+O3SGnQfl2galL2twrwm3ATptn6r7IuR5NK3xuwhLIs1eiQz70y4fznc3Pd ngX7Toi0EJq7wPZAN5fuCU7YqUalmu7BAngXWC1jbLXr6yDa2FZlW2eQmAmUlzgc/IxH Xu/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690489594; x=1691094394; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=X7DKlZuDi/19VNtuzqHU5yNUAMJeyEPYyv6mk68z0EY=; b=Ajm55JFdWCBsJac1esJWp9mbEGvXljjpWaJ1XbpdDfYjKM2H4AwfxzoFIyQhqjUzNA Xp9WKozC+nlZCcb7oX+z8p8/J/JcvVR1ZYxHcg6YTS80ktwlQF70RY2bowcaMDXvA8yo BcIdasC9XDG1y7V1RR4AFLRlzeQc21A8ubARR/f72s7ZuPGfsuZoqxJKY6bTYa3LxqQb AzjFpbKFJnYFaJmoiY47o8EwiqpUVsJMpEn7SZ//T4aug6ZWfixZmx/XFUTChKlpN41C 7lpvH3Syx4ypwDOAKg2Bjwqp48MtKci05pvzSrvEFBUN056/SHAlnbOXbhFl04vTNNF0 wtfA== X-Gm-Message-State: ABy/qLZhIK1xHf/VeikI2ICJV+84vEw9A1dy46p0KyypyAfPo2ixJByb pkZ0sKolQL6vk/Rd4+iEkPu+Yyj8bpxfW1tp5o4g+LSO X-Google-Smtp-Source: APBJJlFmKUX5KJWieFFRlBdXCjxvnMLMPNL5Ypg1ef7io1tlY4NDIM+aYnyYvuOUd57ypkOobxU/D+ovxWAljRgWEoo= X-Received: by 2002:adf:dd0e:0:b0:314:152d:f8db with SMTP id a14-20020adfdd0e000000b00314152df8dbmr163458wrm.58.1690489593847; Thu, 27 Jul 2023 13:26:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sunil Pandey Date: Thu, 27 Jul 2023 13:25:57 -0700 Message-ID: Subject: Re: [PATCH] Add strlcpy/wcslcpy testcase To: DJ Delorie Cc: libc-alpha@sourceware.org Content-Type: multipart/alternative; boundary="000000000000bce5be06017dc7b1" X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: --000000000000bce5be06017dc7b1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jul 27, 2023 at 12:20=E2=80=AFPM DJ Delorie wrote: > Sunil Pandey writes: > > Actually, it's already testing the generic version of strlcpy > > implementation from the string/strlcpy.c file, so no need to implement > > another SIMPLE_* function. > > While that is true at the moment, in the future someone will start > optimizing that function, add cpu-family-specific variants, etc. Then, > when you're running on some core that chooses a vector-optimized > strlcpy, the simple function will be useful. > > Note: I'm not saying "you must add this" as most of the other tests > don't either, and some test is better than no test. I just don't want > you to make a decision based on me not explaining myself well enough ;-) > > The easy path would have been to just add the IMPL line and have that > extra level of paranoia built-in from the start. > > If someone has to optimize this function with the vector version, he has to provide a fallback implementation to the generic scalar version. Generic version shouldn't be duplicated and should map to (strlcpy)string/strlcpy.c implementation. I have vector implementation of this function that looks like this. $ string/tst-strlcpy2 __strlcpy_evex __strlcpy_evex512 __strlcpy_avx2 __strlcpy_sse4_2 __strlcpy_generic Where __strlcpy_generic is alias to strlcpy(implemented in string/strlcpy.c). Same is true for other flavors of strlcat/strlcpy/wcslcat and wcslcpy functions. I can certainly implement SIMPLE_* function but don't see any real use case. In addition, it could be prone to error as you pointed out in my v1 patch. --000000000000bce5be06017dc7b1--