Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jun 2024 13:38:07 +0200
From:      Robert Clausecker <fuz@freebsd.org>
To:        freebsd-riscv@freebsd.org, mhorne@freebsd.org
Cc:        strajabot@gmail.com
Subject:   Detecting the Zbb extension on riscv64
Message-ID:  <ZlxZn5IQuQ-zqbwl@fuz.su>

next in thread | raw e-mail | index | archive | help
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.

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.

We are working with 15-CURRENT, so if it's there it'll suffice
for our needs.

Yours,
Robert Clausecker

-- 
()  ascii ribbon campaign - for an encoding-agnostic world
/\  - against html email  - against proprietary attachments



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZlxZn5IQuQ-zqbwl>