From nobody Mon Jun 03 19:08:52 2024 X-Original-To: freebsd-riscv@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 4VtNYf6XVgz5JqYG for ; Mon, 03 Jun 2024 19:08:54 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VtNYf4RF5z4SHv; Mon, 3 Jun 2024 19:08:54 +0000 (UTC) (envelope-from mhorne@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717441734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=Jibx0SnoIL5r34/nUAArTLXHaLuGHPRj1IdSDTCsm5s=; b=CGKyb5zPE028yA5PsC3XoiOkjku45/9y79G5hAczGWfoeWlZ/PUWWVfZO8HvbkKBYXXQO/ tZvqEzkDUiW1LzVv91MlNGRg+dcwgu/fjkD+L5/8Jo74DYM7Wm6Tcu2XQsvoP0vJ7ZSS6R K0kErXefcDC/paZreEuItSz+eXCYyDYD84OhDLMqmPaDqxskQb2IVhohp2+aLivQ3nyhbW F21DODLr2KZOVK4uevmEjAo7Mq2xgv+2ty/Dh28pYcU14HnV/mxjwY3q9zmSaCDRPG7pMe LjRffoge83UsdWA8nmvHS7PgIg4J8BlGYCRYEz9wZJF9aEYIzfM56zYbrvJCAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717441734; a=rsa-sha256; cv=none; b=tF34rm/H52o+jtPH8f+17H8BngU/4rDtqBZwlwFLiVlQOVKHenwhCmaaGMiokU8C8S/NUN bbSRQi79IiD5Ctv75AEcbWgj6t2Nx0EK3mIKf8ZZoZkzyczZPH07la3lG/vx31let2+2/O VCxw3VcOhoCSVsY96yMb546tbuNOFjQMiPm+JBuMk/HJzYz62Kjog4ht83e48dOX+qjghT STvpeUXdQrHRv01HzoFZnvLrpAh1qTAc8OmE1kCCL+gOjwScm/v/AKdPfvO4yvTTU9CZig GGtcONHoFzHq8qSA9E+AtrBH3IjZ3w7zwWjvWEWjsAPDBvQmsnWtFxSYdc8c7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717441734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=Jibx0SnoIL5r34/nUAArTLXHaLuGHPRj1IdSDTCsm5s=; b=TJGzov6q4mjKYIOGzVWfaKAfrZSnlhGwkdcumdajJiKklwYxrjj/oJADwuG+nBRhW0WeUG XT3f8d79/+XPgoUEmId8idswgl5YmHJG8lMHN16c1mGLMUUhx0W3cE+FD99giYMzTBei0F LFMwyhMzoWlYnnYjKUrZ9DDyCvALcf3hxtld2hEOKsJACZPggUWi91u0cJAeBohJjfnNr1 kCFXTOkBRVUxk1zS0BvRp6ApGSeBxw/iKC07IgZrpnxMQ4wwDeOC8ccyucMmwHtRkj6pkt I9tULsA+u8vD3NRAAjkkK6GpmQIGX7EEGpeR1X/W1MBruCj+e2S0tGwp8pcPwQ== Received: from [192.168.1.151] (host-173-212-76-127.public.eastlink.ca [173.212.76.127]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id 4VtNYf2WGpz13jJ; Mon, 3 Jun 2024 19:08:54 +0000 (UTC) (envelope-from mhorne@freebsd.org) Message-ID: <5c8fcee8-61dc-4eec-8ef9-35aba33b8482@freebsd.org> Date: Mon, 3 Jun 2024 16:08:52 -0300 List-Id: FreeBSD on the RISC-V instruction set architecture List-Archive: https://lists.freebsd.org/archives/freebsd-riscv List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-riscv@freebsd.org Sender: owner-freebsd-riscv@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Detecting the Zbb extension on riscv64 To: Robert Clausecker , freebsd-riscv@freebsd.org Cc: strajabot@gmail.com References: From: Mitchell Horne Content-Language: en-CA Autocrypt: addr=mhorne@freebsd.org; keydata= xsBNBFyS2dQBCADdiXBG8hBVLmYbxu7aSzbwLwUf3HkGFz3rooS1kwyy+SfmjZ4UKNnl9WMx WKrJ7OAZpiNH6bLQ5nsqfx09OnpWL8c/QuPbhNdUywQoqqYpRI0K8GEn//nS9Gs0KTYwVpWb XlrzP+jf3Uh/9L5mcQmStLIH4zaaqMYHW+pMuPrvBmLIHTvLj2QjOkxslrcUdord9uvxe5Ht LU8RuTpQpHOKz705Z9/v7twFdi2HtKzpLwO6SzVyu351di1J+GihsVpcT5josQV5cHbIP3Un x+kmtKBEEc/jl/zBglF7ruWUtwgbryID+2ZPEaO1Mj+RResX4LFVMusq3uUpWRb5WJXxABEB AAHNI01pdGNoZWxsIEhvcm5lIDxtaG9ybmVARnJlZUJTRC5vcmc+wsCUBBMBCgA+AhsDBQsJ CAcCBhUKCQgLAgQWAgMBAh4BAheAFiEEkp/cYPcfabAiQvACi/gnTOdUid8FAmIyDpUFCQtC z0EACgkQi/gnTOdUid8IsQf+N8IptrrCgifT5Z0/WUVFfnHThFOKf4zBjaGswsIM8+VKsKnF 15jCWHODUHP6s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Uw== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/2/24 08:38, Robert Clausecker wrote: > Greetings! > > I'm currently working on two projects that require the Zbb > instruction set extension on riscv64: > > - strajabot@ is a gsoc student who is currently porting the > SIMD-enhanced libc string functions from amd64 to riscv64. > For these, Zbb is immensely useful as it provides the > CTZ and ORC.B instructions needed for fast string comparison > > - I'm trying to write a fast sha1 implementation for libmd, > which (you might have guessed it) requires Zbb for rotate > instructions. Not having these is possible here, but there > is a significant performance penalty. > > Zbb is supported by the SiFive unmatched board for example. > > I originally wanted to just write an ifunc dispatcher that > checks for the presence off Zbb and then picks an appropriate > implementation, but then noticed that AT_HWCAP currently only > supports the detection of capital letter extensions. > Hi Robert, It should not be much work to start parsing for Zbb or similar extensions, so I can take this on soon. I mainly need to see what Linux is doing these days w.r.t. reporting multi-letter extensions to userspace. > Furthermore, we do not give user space any access to the isa > string (a sysctl like hw.isa would be nice), so it's not even > possible to determine the availability manually. > > Please check if you can add a sysctl to get the ISA string and > possibly add an elf_aux_info extension to allow the user to find > out which Z extensions are present. This is good feedback; possible a little more annoying to implement than it would seem, but I'll consider this too. Cheers, Mitchell > > We are working with 15-CURRENT, so if it's there it'll suffice > for our needs. > > Yours, > Robert Clausecker >