Mix and Match

Name:

MOR $X,$Y,$ZMOR $X,$Y,Z
MXOR $X,$Y,$ZMXOR $X,$Y,Z

Specification:

Assume that the 64 bits in $Y are numbered as follows (and similar for the bits in register $Z and $X):

y00y01...y07 y10y11...y17 ... y70y71...y77

Now bit xij in register register $X is computed as follows:

MOR: xij = y0j& zi0 | y1j& zi1 | ... | y7j& zi7
MXOR: xij = y0j & zi0 ˆ y1j & zi1 ˆ ... ˆ y7j & zi7

Timing:

Description:

These instructions regard the 8 Byte of a register as a 8 × 8-Matrix and compute the result as a matrix multiplication, where in MOR, Addition is replaced by OR (logical or (|)) and in MXOR, Addition is replaced by XOR (exclusive or (ˆ)). In both cases the AND operation (&) is used instead of multiplication.

MOR:For better understanding an example: If register Z contains the constant #0102040810204080, MOR reverses the order of the bytes in register $Y, converting between little-endian and big-endian addressing. (The ith byte of $X depends on the bytes of $Y as specified by the ith byte of $Z or Z. If we regard 64-bit words as 8 × 8 Boolean matrices, with one byte per column, this operation computes the Boolean product $X = $Y $Z or $X = $Y Z. Alternatively, if we regard 64-bit words as 8 × 8 matrices with one byte per row, MOR computes the Boolean product $X = $Z $Y or $X = Z $Y with operands in the opposite order. The immediate form MOR $X,$Y,Z always sets the leading seven bytes of register X to zero; the other byte is set to the bitwise or of whatever bytes of register $Y are specified by the immediate operand Z.)
MXOR:This operation is like the Boolean multiplication just discussed, but exclusive-or is used to combine the bits. Thus we obtain a matrix product over the field of two elements instead of a Boolean matrix product. This operation can be used to construct hash functions, among many other things.