From nobody Fri Jan 10 15:03:58 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YV4g30TwSz5kTTp; Fri, 10 Jan 2025 15:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YV4g25HlGz4wq1; Fri, 10 Jan 2025 15:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736521438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tH9eyOkvFzpm/32lORMxC+R73z4Ov5W10i/mFYgG44g=; b=sHoEhQxJNxe/yLbCcFdel9wfZ8HAaGmqJ5sn8B/WD2ScVN/T6Ij4Fdg/rwzY3+YIO8xuWl x3ueujfFbXlSIEj6KteP+gHWv50D2EqUnuneP1qUocJ4lnzyPz0s4zKcmvu/s5IFiGG4og jWgjLcjN5ZrVjDEDmePUbNrrZZAExwePh82yCKL8fx+jbblcMuVnurfTfEufpcfO4+5ehB lIQ4mCg9vSx2AHN7/lmG7ZygC8xsQstsOPCQLvA3Np4kI/y/+y3x3JWVUnV034Q4tHMegV kG7hIVLxRkxp1NwhVjJOL8omla//1fg1JFZ3zyLa8KI3L6tDD166ww3BoY1HcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736521438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tH9eyOkvFzpm/32lORMxC+R73z4Ov5W10i/mFYgG44g=; b=FUls+PA6NIi02YEMUoEO/kAQpjteELRfreKtLte9SSrJDr9yoc2lQyi/tmLMRz5QocZ+Vu WSL0+5Yvp1MXtvZW7QLsO0AJ7iLwcPFA5qTS1Vvx8V2DU3OW2P8qjXtYvXNMMTfNao+hVt uXT3FnrigJ+vJDpMssm2PMethMkTjHPBeNsDyY3h3UyPJlbjVoAgwU6q7XilnAfywS4rkp YD2xz9cHVLki1TubLbMrMd3gmNFi4+I6xh64osHdROkQFlbGD2BbHTZsTeKPmvF+4xj8Pj ehoL1z+Rv2wx4+rIA4ANAnHlqXFb8YzXakjMoNnSyqQlDF2iGBfRIkfUKfGkBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736521438; a=rsa-sha256; cv=none; b=V70qv7LfKmsZp9bB7AFdpnbpIM0DBRel5SAmVgZBFp91hi7L9lmwd+ae6tMgpWC/rpt0Yo anPzZYryatZTQuv3XdX+VO0p1Uuwv5diWbeQ2EHKDIRxc1v1dQ90YEGfqsfZad9GUTMVCQ n64GOicAyNUQIg9DUFnbIguseGEcOQfSqp8uPOOEGF36xYLHcCLnwj+xAS87KESlAPaiIs j2WvDctf9KGGc+T5PJQsAoksBXZaWS9IT0CHk7aqhccARyAmRp8trmydl2NjM7tckkQRem j1/kZheKgj3HK6+V1Lru9dZk4yGzgHU+n+Xjdskd8xq4OrAoIL6AtHFHD4i0Fg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YV4g24P6Pz2Jh; Fri, 10 Jan 2025 15:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50AF3wg9057323; Fri, 10 Jan 2025 15:03:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50AF3wBt057320; Fri, 10 Jan 2025 15:03:58 GMT (envelope-from git) Date: Fri, 10 Jan 2025 15:03:58 GMT Message-Id: <202501101503.50AF3wBt057320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: bea89d038ac5 - main - lib/libc/aarch64/string: add strlcat SIMD implementation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bea89d038ac54048bb7dcb149cabd99067e5a3a9 Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=bea89d038ac54048bb7dcb149cabd99067e5a3a9 commit bea89d038ac54048bb7dcb149cabd99067e5a3a9 Author: Getz Mikalsen AuthorDate: 2024-08-26 21:10:16 +0000 Commit: Robert Clausecker CommitDate: 2025-01-10 15:02:40 +0000 lib/libc/aarch64/string: add strlcat SIMD implementation This patch requires D46243 as it depends on strlcpy being labeled __strlcpy. It's a direct copy from the amd64 string functions using memchr and strlcpy to implement strlcat. Tested by: fuz (exprun) Reviewed by: fuz, emaste Sponsored by: Google LLC (GSoC 2024) PR: 281175 Differential Revision: https://reviews.freebsd.org/D46272 --- lib/libc/aarch64/string/Makefile.inc | 3 ++- lib/libc/aarch64/string/memchr.S | 4 ++++ lib/libc/aarch64/string/strlcat.c | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/libc/aarch64/string/Makefile.inc b/lib/libc/aarch64/string/Makefile.inc index 876ef4257b4c..f8c67319fe12 100644 --- a/lib/libc/aarch64/string/Makefile.inc +++ b/lib/libc/aarch64/string/Makefile.inc @@ -29,7 +29,8 @@ MDSRCS+= \ strlcpy.S \ strncmp.S \ memccpy.S \ - strncat.c + strncat.c \ + strlcat.c # # Add the above functions. Generate an asm file that includes the needed diff --git a/lib/libc/aarch64/string/memchr.S b/lib/libc/aarch64/string/memchr.S new file mode 100644 index 000000000000..6d4330d9115e --- /dev/null +++ b/lib/libc/aarch64/string/memchr.S @@ -0,0 +1,4 @@ + .weak memchr + .set memchr, __memchr_aarch64 + +#include "aarch64/memchr.S" diff --git a/lib/libc/aarch64/string/strlcat.c b/lib/libc/aarch64/string/strlcat.c new file mode 100644 index 000000000000..c3c996163ade --- /dev/null +++ b/lib/libc/aarch64/string/strlcat.c @@ -0,0 +1,25 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023 Robert Clausecker + */ + +#include + +#include + +void *__memchr_aarch64(const void *, int, size_t); +size_t __strlcpy(char *restrict, const char *restrict, size_t); + +size_t +strlcat(char *restrict dst, const char *restrict src, size_t dstsize) +{ + char *loc = __memchr_aarch64(dst, '\0', dstsize); + + if (loc != NULL) { + size_t dstlen = (size_t)(loc - dst); + + return (dstlen + __strlcpy(loc, src, dstsize - dstlen)); + } else + return (dstsize + strlen(src)); +}