From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by sourceware.org (Postfix) with ESMTPS id 426223858D33 for ; Mon, 21 Nov 2022 03:24:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 426223858D33 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-ua1-x932.google.com with SMTP id p1so3627046uak.11 for ; Sun, 20 Nov 2022 19:24:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BofOcbN+Y08Tc83EstemzPOjhQiLRYyHEuc9ACRf2XQ=; b=iPdQtYXjnJhGfVjo/QWKoz6BL7BKvHJPq3RhL2/zsMzd9vaUStlY+jm2+cqbvB/pf3 nxz9h9cIextdfh4DlrV6GRw3dcsBQdVFrqZAGcXuKBSu/8wIYMUjDP9a4AZFRj1x6GES zNM68tWIqRKp7W1930LojTgoiPFRep6QfXNjQkN7dHF5h4a7KQ+HlUVcNrECDLtWsKvf zw5ZR57isbxOBgsMTZoiZXoSHTOmjnDXfvdoGCFc1Felx/qigGAw95NAc2dYAc/N4Qmn dYbWlyYwdKOvXIMRGzUFlAAc9I6HI/jXl8iMx5YOv2ywAIhLJyyVlm6Jj5Jkn9q0LOPO X1MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=BofOcbN+Y08Tc83EstemzPOjhQiLRYyHEuc9ACRf2XQ=; b=QXbuc4R2uNGTkheWpgBYQF53/EBbffXyRWOl0YWKnpi9JIK4aNrXi/J/7BfcFMH/zq tiaKUrS4v2/pm90knZ+UCYm1eXQXGcMqDgqaiBLOzhBI2RMYV+pgiJIuEMrw5xVCCZtj kryQLKGnlFvdeEH+Q64L1eR2JLNXNhSuIuq/x53rXR6QeIsA5Rn7PVqNmuV0YwDtdc5v 6a4IPDVAi//sS/3BKnfLaeoMydJcOisVYi2nAQCn2LX9O3V2ME4rKE4RD5zFsmsKaTKC 3mxhRUfnvMTOXgI2kWt9g8UGrsrLeSb6U0OMim1YSD3mWzFETB3156U3Li+G0j8La3sy hspg== X-Gm-Message-State: ANoB5pnN4mJ+eZw2affs6hLVQ/4LXbMtl7q2ZOkSjbGJVwzTBGeR3d42 rDe3thEQMqz9Pm9ZVIEvLf7N6Q6HFEFCM/J3F38= X-Google-Smtp-Source: AA0mqf65ezAxhfkGaUv223JTITr8Se0hpg75MFC4WMFj6YXt6Qv+cyHhoHuGC27AFim2N56UlQMwuVR+9saeQ7UB5q4= X-Received: by 2002:ab0:6015:0:b0:418:c2fa:f8a6 with SMTP id j21-20020ab06015000000b00418c2faf8a6mr548222ual.119.1669001089419; Sun, 20 Nov 2022 19:24:49 -0800 (PST) MIME-Version: 1.0 References: <20221113230521.712693-1-christoph.muellner@vrull.eu> <20221113230521.712693-8-christoph.muellner@vrull.eu> In-Reply-To: From: Kito Cheng Date: Mon, 21 Nov 2022 11:24:38 +0800 Message-ID: Subject: Re: [PATCH 7/7] riscv: Add support for str(n)cmp inline expansion To: Philipp Tomsich Cc: Christoph Muellner , gcc-patches@gcc.gnu.org, Kito Cheng , Jim Wilson , Palmer Dabbelt , Andrew Waterman , Jeff Law , Vineet Gupta Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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: > > I would like to have a unified option interface, > > maybe -m[no-]inline-str[n]cmp and -minline-str[n]cmp-limit. > > For the basic option (-m[no-]inline-str[n]cmp), I would punt to > -fno-builtin-str[n]cmp. -fno-bulitin-* will also suppress middle-end optimization for those builtins. see: https://github.com/gcc-mirror/gcc/blob/master/gcc/tree-ssa-strlen.cc#L5372 and https://github.com/gcc-mirror/gcc/blob/master/gcc/tree-loop-distribution.cc for -fno-bulitin-memcpy/memset/memmove > The limit-one sounds more like a --param? Use -param=inline-*-limit= sound good idea, aarch64 and x86 have few options like that. > > > And add some option like this: > > -minline-str[n]cmp=[bitmanip|vector|auto] in future, > > If we want to follow the lead of others, then x86 has a -mstringop-strategy=alg Using same option name as x86 is SGTM. > > since I assume we'll have different versions of those things. > > > > > > > > gcc/ChangeLog: > > > > > > * config/riscv/riscv-protos.h (riscv_expand_strn_compare): New > > > prototype. > > > * config/riscv/riscv-string.cc (GEN_EMIT_HELPER3): New helper > > > macros. > > > (GEN_EMIT_HELPER2): New helper macros. > > > (expand_strncmp_zbb_sequence): New function. > > > (riscv_emit_str_compare_zbb): New function. > > > (riscv_expand_strn_compare): New function. > > > * config/riscv/riscv.md (cmpstrnsi): Invoke expansion functions > > > for strn_compare. > > > (cmpstrsi): Invoke expansion functions for strn_compare. > > > * config/riscv/riscv.opt: Add new parameter > > > '-mstring-compare-inline-limit'. > > > > We need to document this option.