From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id C44F63858C60 for ; Wed, 1 Feb 2023 15:33:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C44F63858C60 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-pl1-x62a.google.com with SMTP id r8so11949141pls.2 for ; Wed, 01 Feb 2023 07:33:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0o3xUwf3ia2zXs8c/qgUYdi2CY7OD5LUZOowM1kwx4s=; b=B8N+Pvmwu2XDszcF7JO3XuPAvNbTBRjDctU2qwnRDo7BPDVMKnU1lO3ACDVbIYDCWG 9ZJRc8XNHwMkMSLdMXiHsaJbKA/3JrHNbkmBYE6wDi6Odsy5/U/nTuHQjZLc8nHk6naK 4W2heF8boRJ1S50ZUvKmNB6iIpixwX7EvucJlflgVQYXOpjJUz9IF/w5+88vNLaeKiUF sdglo5uxl8DpeSbPOzhX9K+3iv1MDClPg1d5ljkWwr7X/lazLbPOnTNJymrb5RfF6jtJ RpgEHS/Ep+ZBH+3TAxl0WM3MKLEShgc8k/MFGjI+LQ/CNtbfoX8CHwRYIljlL91pEzEI NVhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0o3xUwf3ia2zXs8c/qgUYdi2CY7OD5LUZOowM1kwx4s=; b=ocSZElNG9SVI/9A2v/es8bNiY9227NVOn1oOj12IYgpHGR/VqnRenthlu9IV2qJWSg XdAJW8PoW1nx8cCGbm8NESTfj+8XoREH7I/mtR3wHfRa4MygHi8lD95hU/4hL0oyWrS1 UvHd54YEskxSCUAt3CaO9tMTe/0BwbIYKuRzexE5HBdYNHZe0wR4Qd4L6o0kUHgAGUO8 3jA9jr1CtLibt0NHlvxlGsBSYw32ouxIGvttxU1UTBrUBma7J26ixKRY/rNB5LqnvjcP AjzxflCxgDNZg+uF+OeLDxVwdHWrfC3It2/5ddCm34q87vz/q68Vj5rJ0UC7JVFtfNjv 3zKA== X-Gm-Message-State: AO0yUKUi4QqF/ZJ3nncYJimA7sG2sshqugsdmlkLTEaLMukVhtkEgwkg qinu7WrFr9hVzAD9+gAlI67HkdJ/AT8= X-Google-Smtp-Source: AK7set/6B6r9umcjhoKxmIzIwFsHWxDi1z86MeAZVFL/1YklANxcijgQuzU1ZurnlADt9VdlmuVJwA== X-Received: by 2002:a17:902:dcc5:b0:194:a7cd:7e09 with SMTP id t5-20020a170902dcc500b00194a7cd7e09mr1881463pll.50.1675265595583; Wed, 01 Feb 2023 07:33:15 -0800 (PST) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id ay2-20020a1709028b8200b0019468fe44d3sm11841552plb.25.2023.02.01.07.33.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Feb 2023 07:33:15 -0800 (PST) Message-ID: <972db14d-390f-f79a-bc56-41afce041257@gmail.com> Date: Wed, 1 Feb 2023 08:33:13 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 2/2] riscv: vectorised mem* and str* functions Content-Language: en-US To: Sergei Lewis , libc-alpha@sourceware.org References: <20230201095232.15942-1-slewis@rivosinc.com> <20230201095232.15942-2-slewis@rivosinc.com> From: Jeff Law In-Reply-To: <20230201095232.15942-2-slewis@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,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: On 2/1/23 02:52, Sergei Lewis wrote: > Initial implementations of memchr, memcmp, memcpy, memmove, memset, strchr, > strcmp, strcpy, strlen, strncmp, strncpy, strnlen, strrchr, strspn > targeting the riscv "V" extension, version 1.0 > > The vectorised implementations assume VLENB of at least 128 and at least 32 > registers (as mandated by the "V" extension spec). They also assume that > VLENB is a power of two which is no larger than the page size, and (as > vectorised code in glibc for other platforms does) that it is safe to read > past null terminators / buffer ends provided one does not cross a page > boundary. > > Signed-off-by: Sergei Lewis > --- > sysdeps/riscv/rv64/rvv/Implies | 2 + > sysdeps/riscv/rv64/rvv/memchr.S | 127 +++++++++++++++++++ > sysdeps/riscv/rv64/rvv/memcmp.S | 93 ++++++++++++++ > sysdeps/riscv/rv64/rvv/memcpy.S | 154 +++++++++++++++++++++++ > sysdeps/riscv/rv64/rvv/memmove.c | 22 ++++ > sysdeps/riscv/rv64/rvv/memset.S | 89 ++++++++++++++ > sysdeps/riscv/rv64/rvv/strchr.S | 92 ++++++++++++++ > sysdeps/riscv/rv64/rvv/strchrnul.c | 22 ++++ > sysdeps/riscv/rv64/rvv/strcmp.S | 108 +++++++++++++++++ > sysdeps/riscv/rv64/rvv/strcpy.S | 72 +++++++++++ > sysdeps/riscv/rv64/rvv/strcspn.c | 22 ++++ > sysdeps/riscv/rv64/rvv/strlen.S | 67 ++++++++++ > sysdeps/riscv/rv64/rvv/strncmp.S | 104 ++++++++++++++++ > sysdeps/riscv/rv64/rvv/strncpy.S | 96 +++++++++++++++ > sysdeps/riscv/rv64/rvv/strnlen.S | 81 +++++++++++++ > sysdeps/riscv/rv64/rvv/strrchr.S | 88 ++++++++++++++ > sysdeps/riscv/rv64/rvv/strspn.S | 189 +++++++++++++++++++++++++++++ Does this need to be revamped given the recent push to do more with generic code and target specific hooks for mem* and str*? Shouldn't the implementations be in a multiarch directory? I would fully expect we're going to need both a vector and scalar implementation selected by an ifunc. I'm happy to pass along the current bits from VRULL which put that infrastructure in place. I just haven't had the time to look at revamping their assembly implementations for the new generic+hooks scheme. jeff