From nobody Sun Jun 02 13:05:09 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 4VscXV5Xz9z5Mkgt for ; Sun, 02 Jun 2024 13:05:14 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VscXV2X92z3wYD; Sun, 2 Jun 2024 13:05:14 +0000 (UTC) (envelope-from tuexen@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:1c07:30e1:d10:75ea]) (Authenticated sender: micmac) by drew.franken.de (Postfix) with ESMTPSA id 3E35D721E2806; Sun, 2 Jun 2024 15:05:10 +0200 (CEST) Content-Type: text/plain; charset=us-ascii 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 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: Detecting the Zbb extension on riscv64 From: tuexen@freebsd.org In-Reply-To: Date: Sun, 2 Jun 2024 15:05:09 +0200 Cc: freebsd-riscv@freebsd.org, Mitchell Horne , strajabot@gmail.com Content-Transfer-Encoding: quoted-printable Message-Id: <5343E09C-017B-40B7-9349-01F1195BBB7C@freebsd.org> References: To: Robert Clausecker X-Mailer: Apple Mail (2.3774.600.62) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:680, ipnet:193.174.0.0/15, country:DE] X-Rspamd-Queue-Id: 4VscXV2X92z3wYD > On 2. Jun 2024, at 13:38, Robert Clausecker wrote: >=20 > Greetings! >=20 > I'm currently working on two projects that require the Zbb > instruction set extension on riscv64: >=20 > - 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 >=20 > - 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. >=20 > Zbb is supported by the SiFive unmatched board for example. Hi Robert, just double checking: According to = https://sifive.cdn.prismic.io/sifive/d0556df9-55c6-47a8-b0f2-4b1521546543_= hifive-unmatched-datasheet.pdf the processor supports RV64GC (RV64IMAFDC). I don't see a B there. So does it actually support Zbb? What about Zbr? Best regards Michael >=20 > 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. >=20 > 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. >=20 > 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. >=20 > We are working with 15-CURRENT, so if it's there it'll suffice > for our needs. >=20 > Yours, > Robert Clausecker >=20 > --=20 > () ascii ribbon campaign - for an encoding-agnostic world > /\ - against html email - against proprietary attachments >=20