From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 9859E3858C2F for ; Wed, 1 Feb 2023 17:04:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9859E3858C2F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x32a.google.com with SMTP id p24-20020a056830131800b0068d4b30536aso37237otq.9 for ; Wed, 01 Feb 2023 09:04:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LLY0Tmc+7FJfLueVKTzcdxBygnFQ693kzbq1+1nrLr8=; b=C3gRzSq2qQqH533rc08Si507J+BT5jXxL5QxWbWuKAYJgfVU2G8TZOtnlHjKuyoQoH SUHBB+UQvUiBi5zBEpiu9YcUySP3NDGcUxRtpm5Ard/I7aLsXNzNfLkVk/PB9iyOC3Cf 6ZW+cKYbumYBPDo6DbcfTL5Dc+eYA6TcxFgWRJ59g1hGOSO6Be57EAL1laNcfB0Vn2K2 IOMJfb0zzowomO+uwLN8l+KiT8OSML9F9TTbWOh7oNjCSzIOil8T+zoYsS+FJxhPWVJr WdOHZOjPFGPq6MZwoT/dMSCMP27go80myeYkE2dh5e/5nEcxGCf+Vl8ZKxWg0LIQFyrq wQdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LLY0Tmc+7FJfLueVKTzcdxBygnFQ693kzbq1+1nrLr8=; b=o2ekUSl3rAMdaU1N+/OPJl0vgdyUW27RMndfyztuLkbp1jqSIKhF8qlnsoJEYfPuoa 9DfnXruJnP4sPxaJXgnA6egCcc4+9sczfVO34vab0G6jTiwWJGrUanp+aoQKMqGeopOU sdFo85kGoNEY86iQTk9rJKGRzEdpCHd+5CuQPkUwNxNG7kQPImpylWoKr5b8zk4da7wp K6WpjDYhcASvPfAI5+9mRpe7evSJBQpqvGA1haRwFmgs9WL1YPHwnSy5vn/LjT4L1gIN sTonh/mzotBHKN5UmBHfwy3p6tIMjimVWTIl09Qwnq2pDc4Rp7bIVU5yQ9a3i3MGxqMB RExA== X-Gm-Message-State: AO0yUKU6qlfgROsVDJgSHw7XbzHA1NTGzpQ08nDmxr9QaI1oRMhipOG1 qWBTEEgjPND+qHj1hDYZxITt16301sPj6JxdzqU= X-Google-Smtp-Source: AK7set+rcFg2U0lxlwB/RBGa75d8rnRU0UO4nlwDSy/viPtNRBF/x03dlBujSG6qeeCy3mcSNTDQAw== X-Received: by 2002:a9d:82a:0:b0:68b:e020:e67e with SMTP id 39-20020a9d082a000000b0068be020e67emr3427102oty.12.1675271081009; Wed, 01 Feb 2023 09:04:41 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c2:1887:d2ed:98c2:d2cc:bf06]) by smtp.gmail.com with ESMTPSA id b17-20020a056830311100b006863ccbf067sm8077090ots.74.2023.02.01.09.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 09:04:40 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Richard Henderson , Noah Goldstein , Jeff Law , Xi Ruoyao Subject: [PATCH v11 11/29] string: Improve generic strcpy Date: Wed, 1 Feb 2023 14:03:48 -0300 Message-Id: <20230201170406.303978-12-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230201170406.303978-1-adhemerval.zanella@linaro.org> References: <20230201170406.303978-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: Now that stpcpy is vectorized based on op_t, it should be better to call it instead of strlen plus memcpy. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu, and powerpc-linux-gnu by removing the arch-specific assembly implementation and disabling multi-arch (it covers both LE and BE for 64 and 32 bits). --- string/strcpy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/string/strcpy.c b/string/strcpy.c index 0345c71d15..d945d8fdf0 100644 --- a/string/strcpy.c +++ b/string/strcpy.c @@ -19,6 +19,9 @@ #include #undef strcpy +/* Disable internal stpcpy optimization, otherwise the __stpcpy might it + generate a strcpy call. */ +#undef __stpcpy #ifndef STRCPY # define STRCPY strcpy @@ -28,6 +31,7 @@ char * STRCPY (char *dest, const char *src) { - return memcpy (dest, src, strlen (src) + 1); + __stpcpy (dest, src); + return dest; } libc_hidden_builtin_def (strcpy) -- 2.34.1