David Hildenbrand <da...@redhat.com> 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 <th...@redhat.com> >> Cc: David Hildenbrand <da...@redhat.com> >> Cc: Christian Borntraeger <borntrae...@linux.ibm.com> >> Cc: Richard Henderson <richard.hender...@linaro.org> >> Cc: Cornelia Huck <coh...@redhat.com> >> Cc: Harald Freudenberger <fre...@linux.ibm.com> >> Cc: Holger Dengler <deng...@linux.ibm.com> >> Signed-off-by: Jason A. Donenfeld <ja...@zx2c4.com> >> --- > <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