base/asm-common.h: Reverse the order of `SHUF' arguments.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 12 Nov 2018 11:03:05 +0000 (11:03 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 24 Nov 2018 21:53:38 +0000 (21:53 +0000)
commita117c06f5ee62cbe7812769703eada01843f76ca
treef5938102ed4589cb9022c06f8b73617a6288127c
parent866fb27f61c9de2b09d8febad41286fc3f953a4e
base/asm-common.h: Reverse the order of `SHUF' arguments.

The original idea was this: since one can change one's view of how the
bits in an XMM register are divided into lanes on a per-instruction
basis, it would make more sense if I took a single consistent view of
how the bits are arranged, with the least significant on the right and
the most significant on the left.  Therefore, I listed the shuffle
indices from left to right, counting from right to left.

This, I now realise, was a mistake.  The thing which finally made this
clear to me was that it makes the order of indices in the `SHUF' macro
be inconsistent with the order of bytes in a table for the SSSE3
`pshufb' instruction, and I can't do anything about that.

So: change the order of the arguments, and track down all uses of this
macro to fix them.  Sorry about that.

To verify that I got them all:

for i in $(git grep -l SHUF); do
  git blame -- $i | grep SHUF
done | less
base/asm-common.h
math/mpx-mul4-amd64-sse2.S
math/mpx-mul4-x86-sse2.S
symm/chacha-x86ish-sse2.S
symm/rijndael-x86ish-aesni.S
symm/salsa20-x86ish-sse2.S