From patchwork Thu Feb 2 18:11:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 64172 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB16F388883C for ; Thu, 2 Feb 2023 18:14:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB16F388883C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675361692; bh=y0lWmX08mljxv5oNTaThg5yPPAYl7+FH1A0aW7U6Dbc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=UcfLlimB2SyIaftx2S+FPWHwawm2+FAG4k0yCSW2qfXP8zOdWwmPDWks4NuwSv+hO yfzVScIbj855hF9/erwPXOZtwDOmMBil41gW5wrqOYqzFwV/iyZNfdy3dJf6RW6YnS bJ3NpTCpVcWkvGgzQNBVP8rp9XWzs24qYeqxCaoA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 7FC143844066 for ; Thu, 2 Feb 2023 18:13:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7FC143844066 Received: by mail-ot1-x331.google.com with SMTP id k91-20020a9d19e4000000b0068bca1294aaso690805otk.8 for ; Thu, 02 Feb 2023 10:13:05 -0800 (PST) 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=y0lWmX08mljxv5oNTaThg5yPPAYl7+FH1A0aW7U6Dbc=; b=FJM70yUCNuBQleOJAr177yBaaAZX60SUPTkXP4Qqkkx06ERYJYPnCkt7dvPNlO5coV LjiDCrzBcqleRAeWe/vlAFvWw3PuVWLmtQyWrWFSHO5z+EA2tsBH53O2i/WnZpvDmamN qrkknhEg4DZxMp5C0npNiX6kDQPn8GQ1QnrdZzMbCCM0cCpxtRkgFQXe18Y06d6jEThJ FBJuoVKJDqu8x58VxIKUPe9V6iZdBGB1COtb1wTFY07VEO1q8Mbf0lwrKGIjen9oPVpH bhKMjbEzmT1vnNJlaZtslFEZAeEsnevLGiWBe/9hsjEJfCC8w+ryWzaQpRr+BALvPjSe m21Q== X-Gm-Message-State: AO0yUKX6Oc72+moQPVJMz5UiNVJerrfPg2NWOVoIy01QXK9F3m35FfOB ZuOVQD0WNUJNFuIE2SelDMK43NeGk9uV/UQBgiU= X-Google-Smtp-Source: AK7set+XXMsQlBU1ncoICQ/s4gule+RRoOoFUk2IhNMMBEbCejs4Q8BJmbMNAgV4pYaEZjxoKtdAdg== X-Received: by 2002:a05:6830:1d81:b0:68b:dd4e:256c with SMTP id y1-20020a0568301d8100b0068bdd4e256cmr4204395oti.0.1675361584698; Thu, 02 Feb 2023 10:13:04 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c2:1887:da12:b9d3:2162:a28c]) by smtp.gmail.com with ESMTPSA id ci10-20020a05683063ca00b00684a10970adsm126689otb.16.2023.02.02.10.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 10:13:04 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson , Jeff Law , Xi Ruoyao , Noah Goldstein Subject: [PATCH v12 29/31] string: Hook up the default implementation on test-memchr Date: Thu, 2 Feb 2023 15:11:47 -0300 Message-Id: <20230202181149.2181553-30-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202181149.2181553-1-adhemerval.zanella@linaro.org> References: <20230202181149.2181553-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" And remove SIMPLE_MEMCHR, which is not used anywhere. Reviewed-by: Richard Henderson --- string/test-memchr.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/string/test-memchr.c b/string/test-memchr.c index 862094ef0b..0daecab537 100644 --- a/string/test-memchr.c +++ b/string/test-memchr.c @@ -30,7 +30,6 @@ # define MEMCHR memchr # define CHAR char # define UCHAR unsigned char -# define SIMPLE_MEMCHR simple_memchr # define BIG_CHAR CHAR_MAX # define SMALL_CHAR 127 #else @@ -38,7 +37,6 @@ # define MEMCHR wmemchr # define CHAR wchar_t # define UCHAR wchar_t -# define SIMPLE_MEMCHR simple_wmemchr # define BIG_CHAR WCHAR_MAX # define SMALL_CHAR 1273 #endif /* WIDE */ @@ -47,15 +45,26 @@ typedef CHAR *(*proto_t) (const CHAR *, int, size_t); IMPL (MEMCHR, 1) -/* Naive implementation to verify results. */ -CHAR * -SIMPLE_MEMCHR (const CHAR *s, int c, size_t n) -{ - while (n--) - if (*s++ == (CHAR) c) - return (CHAR *) s - 1; - return NULL; -} +/* Also check the generic implementation. */ +#undef MEMCHR +#undef weak_alias +#define weak_alias(a, b) +#undef libc_hidden_builtin_def +#define libc_hidden_builtin_def(a) +#undef libc_hidden_def +#define libc_hidden_def(a) +#undef libc_hidden_weak +#define libc_hidden_weak(a) +#ifndef WIDE +# define MEMCHR __memchr_default +# include "string/memchr.c" +# define MEMCHR_DEFAULT MEMCHR +#else +# define WMEMCHR __wmemchr_default +# include "wcsmbs/wmemchr.c" +# define MEMCHR_DEFAULT WMEMCHR +#endif +IMPL (MEMCHR_DEFAULT, 1) static void do_one_test (impl_t *impl, const CHAR *s, int c, size_t n, CHAR *exp_res)