David Hildenbrand <[email protected]> writes:
> On 21.09.22 12:07, Jason A. Donenfeld wrote: >> In order to fully support MSA_EXT_5, we have to support the SHA-512 >> special instructions. So implement those. >> The implementation began as something TweetNacl-like, and then was >> adjusted to be useful here. It's not very beautiful, but it is quite >> short and compact, which is what we're going for. >> Cc: Thomas Huth <[email protected]> >> Cc: David Hildenbrand <[email protected]> >> Cc: Christian Borntraeger <[email protected]> >> Cc: Richard Henderson <[email protected]> >> Cc: Cornelia Huck <[email protected]> >> Cc: Harald Freudenberger <[email protected]> >> Cc: Holger Dengler <[email protected]> >> Signed-off-by: Jason A. Donenfeld <[email protected]> >> --- > <snip> > > This passes the Linux boot test, but I'm pretty sure I messed up some > corner case. > > > Interestingly, I discovered tests/tcg/multiarch/sha512.c. I added that because I wanted to further exercise the vector code and it is a nice test because it verifies its own results. It gets rebuilt with various flavours to exercise different sets of instructions e.g.: # MVX versions of sha512 sha512-mvx: CFLAGS=-march=z13 -mvx -O3 sha512-mvx: sha512.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) so it might be worth enabling the SHA512 instructions and building another variant of the binary. That does depend on the compiler recognising whats going on and using the appropriate instructions instead. Alternatively we could extend the test to use compiler intrinsics if available although I suspect that will get messy quick. -- Alex Bennée
