From nobody Fri Jan 10 15:03:57 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 4YV4g21yQbz5kTfF; Fri, 10 Jan 2025 15:03:58 +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 4YV4g13fxpz4x2P; Fri, 10 Jan 2025 15:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736521437; 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=PBkgiTpbEO4nfrYnuSvYnpfM0v7MvGXiaxsKqLhq3rc=; b=Tq04ns4jdbpcH/PXbrxXmG5qsP5eulM7CnHz5s7pezDx3GCD8An0U375YiYiEGFQNVS5mi 2IwqRChdJvMPVyuPFk1Gbn+11gcEXH/ZJ/mjgzBbOiYxIfD7EgZTQv/2/vOPUaZ7DXA0GS hrXKOnW/zsfjvcIq/rsiaTWxBrnv5/ycV8p6uxjLDG74ONJ3u5kXuuYhLdWMX99rXNimIc cdI1ll5gjwlAuBcpHTpKCx5r2hrIAmn6LVQlQoY6Xf/ij+hAing2B8GvJOaSuOsIQKfbMW yNg24ny3GXpmmXdReNkHgjn0RpdtYdfUPNIcco6Xa/TGSn8PEjdZwDrwU6oWTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736521437; 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=PBkgiTpbEO4nfrYnuSvYnpfM0v7MvGXiaxsKqLhq3rc=; b=CrPm52NlrWkLiGjNXR8iCPadhTpuO8BDvIvADtzQRz0f8PEaYABlgc5bRo1hm+seuplk56 okHMwLPV2k/LctsJEpFLnvHx4BFckLX2mfOQvfQRQS8s+a+pAPmrt3rkvmJ+GUVtqlQQMn 8M/oFyKH8i0UcEg5NO7DIuQD+lTgpITRILgdghCv2mTNMS83bt9QgfHjfGc92KlZ9ASMgJ Zqzg2m+CvbqJKS9F3GKSwMD9NdUYRoz8aK4g3EVLXm0GAFORJ4yYychxc+4AH+CO1jvTd9 LP5G8yB2O7dPdvj5FlG2fHRsQouqGbYzIRq+VdAHWznteAHJvmqHJ0KU6bMBUg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736521437; a=rsa-sha256; cv=none; b=ua5LFLTGCHm5+we0uL4BVHHO3RibZiC6ukXw3ra+7ux6hvv5TJU4ST3uKDaN7uxhrE+plY QavgG5QV99de9I/V1+60/aNREIToMH3/j4xKebrq80is1FIdR1hLQygWzZ1TCbsjGRhGyD 63ipM5RDutVclfC93K3zI3K+VJBIwviVxZnOQUs0TkwuGxpc7gZX3iswKWBEivHNBuV2jP XZZihxlWv46tVF4TkiNR5JE/G5pEABJOL1KTOW/rGEhPJvjk+w6TqrpuJPXXw4im3jq5FO 9lzdqvkJrdbh1NPrPoo3m2eVnEjU3pFptJluMc3V/WmvcEEwf9HTrU8Ld4xnDg== 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 4YV4g135l3z2Jg; Fri, 10 Jan 2025 15:03:57 +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 50AF3vph057281; Fri, 10 Jan 2025 15:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50AF3vpD057278; Fri, 10 Jan 2025 15:03:57 GMT (envelope-from git) Date: Fri, 10 Jan 2025 15:03:57 GMT Message-Id: <202501101503.50AF3vpD057278@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: 3dc5429158cf - main - lib/libc/aarch64/string: add strncat 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: 3dc5429158cf221374cdbd0bbb728962bff4fb76 Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=3dc5429158cf221374cdbd0bbb728962bff4fb76 commit 3dc5429158cf221374cdbd0bbb728962bff4fb76 Author: Getz Mikalsen AuthorDate: 2024-08-26 18:15:34 +0000 Commit: Robert Clausecker CommitDate: 2025-01-10 15:02:40 +0000 lib/libc/aarch64/string: add strncat SIMD implementation This patch requires D46170 as it depends on strlcpy being labeled __memccpy. It's a direct copy from the amd64 string functions. Tested by: fuz (exprun) Reviewed by: fuz, emaste Sponsored by: Google LLC (GSoC 2024) PR: 281175 Differential Revision: https://reviews.freebsd.org/D46292 --- lib/libc/aarch64/string/Makefile.inc | 3 ++- lib/libc/aarch64/string/strncat.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/libc/aarch64/string/Makefile.inc b/lib/libc/aarch64/string/Makefile.inc index 78145a17ab85..876ef4257b4c 100644 --- a/lib/libc/aarch64/string/Makefile.inc +++ b/lib/libc/aarch64/string/Makefile.inc @@ -28,7 +28,8 @@ MDSRCS+= \ strcat.c \ strlcpy.S \ strncmp.S \ - memccpy.S + memccpy.S \ + strncat.c # # Add the above functions. Generate an asm file that includes the needed diff --git a/lib/libc/aarch64/string/strncat.c b/lib/libc/aarch64/string/strncat.c new file mode 100644 index 000000000000..33b278ac5e04 --- /dev/null +++ b/lib/libc/aarch64/string/strncat.c @@ -0,0 +1,29 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023 Robert Clausecker + */ + +#include + +#include + +void *__memccpy(void *restrict, const void *restrict, int, size_t); + +char * +strncat(char *dest, const char *src, size_t n) +{ + size_t len; + char *endptr; + + len = strlen(dest); + endptr = __memccpy(dest + len, src, '\0', n); + + /* avoid an extra branch */ + if (endptr == NULL) + endptr = dest + len + n + 1; + + endptr[-1] = '\0'; + + return (dest); +}