Re: Revised PPC assembly implementation
From: Paul Mackerras <hidden>
Date: 2016-06-15 22:41:54
David S. Miller writes:
Time to bust out the altivec perhaps :)
I looked at this but I couldn't see a way to use altivec effectively for SHA1. The problem is that we have a chain of dependencies with the A variable (which is 32-bit) where each A value depends on the previous A value and on one of the 80 W values. The W values are derived from the 16 words (32-bit) of the input data block. It might be possible to use altivec for generating the W values (although there is the problem that W[k] depends on W[k-3], making it hard to do a 4-way parallelization), but I don't see any way of parallelizing the calculation of the A values, which is the critical path. Using altivec for generating the W values but the integer ALUs for the A calculations would mean we had to go via memory, too, since there isn't any way to transfer stuff directly between altivec registers and GPRs. We can't do four blocks from the same sequence in parallel either. We could do four blocks from four separate streams in parallel, but that seems hard to organize... Regards, Paul.