top decor
Instruction set Logical operations


MMIX has extensive set of logical operations: these instructions have codes from C0 to DF inclusive. We will take only the most important of them.

Note that NOT operation, being the unary one, can be obtained by the specific case of combined NOR instruction (C5 operation code): X = NOT(X OR 0)

CodeMnemonicName Comments
C0OR $X, $Y, $Z bitwise OR each bit of register Y is logically "ored" with register Z; the result is stored into register X
C1OR $X, $Y, Z bitwise OR each bit of register Y is logically "ored" with the constant Z; the result is stored into register X
...   
C5NOR $X, $Y, Z bitwise OR-NOT NOR $X, $X, 0 is equivalent to NOT X$!
C6XOR $X, $Y, $Z bitwise XOR each bit of register Y is logically "xored" with register Z; the result is stored into register X
C7XOR $X, $Y, Z bitwise XOR each bit of register Y is logically "xored" with the constant Z; the result is stored into register X
C8AND $X, $Y, $Z bitwise AND each bit of register Y is logically "anded" with register Z; the result is stored into register X
C9AND $X, $Y, Z bitwise AND each bit of register Y is logically "anded" with the constant Z; the result is stored into register X

To applet
Examples:

  • instruction OR $1, $6, $7 executes logical operation OR with registers 6 and 7 and places the result to register 1
  • instruction OR $1, $6, 7 executes logical operation OR with registers 6 and constant 7, i.e. sets 3 lowest bits in its value, and stores the result to register 1
  • instruction NOR $3, $3, 0 calculates binary complement of registers 3


Related topics:

"MMIX basics" page
 

  (C) 2001, Evgeny Eremin. rEd-MMI project documentation