3.2.3 Adder Based Operations

CAVA has asymmetric subtraction instructions. The sub instruction, which subtracts y from x leaving the result in x, is defined only for registers, while the cooresponding immediate form does a reverse subtract: imm minus x leaving the result in x. The reason is that (i) subtracting a constant is the same as adding the negative of the constant using the addi instruction, and (ii) if the dif instruction did not exist, then a negate or two's complement instruction would have to be defined.

Signed Comparisons

Mnemonic Format Unit Semantics Description
lti bI ia x.j = (x.j < imm ) Less than Immediate
ltj bL ia x.j = (x.j < immediate) Less than Long Immediate
lt bR ia x.j = (x.j < y.j ) Less than
lei bI ia x.j = (x.j < imm ) Less than Immediate
lej bL ia x.j = (x.j < immediate) Less than Long Immediate
le bR ia x.j = (x.j < y.j ) Less than


Unsigned Comparisons

Mnemonic Format Unit Semantics Description
ulti bI ia x.j = (x.n < (long long unsigned)imm ) Less than Immediate
ultj bL ia x.j = (x.n < (long long unsigned)immediate) Less than Long Immediate
ult bR ia x.j = (x.n < y.n ) Less than
ulei bI ia x.j = (x.n < (long long unsigned)imm ) Less than Immediate
ulej bL ia x.j = (x.n < (long long unsigned)immediate) Less than Long Immediate
ule bR ia x.j = (x.n < y.n ) Less than


Integer Addition

Mnemonic Format Unit Semantics Description
addi bI ia x.j += imm Add Immediate
addj bL ia x.j += immediate Add Long Immediate
add bR ia x.j += y.j Add
addwi bI ia x.i += imm sex Add Word Immediate
addwj bL ia x.i += immediate sex Add Word Long Immediate
addw bR ia x.i += y.i sex Add Word
sub bR ia x.j -= y.j Subtract
subw bR ia x.i -= y.i sex Subtract Word
difi bI ia x.j = imm - x.j Difference Immediate
difj bL ia x.j = immediate - x.j Difference Long Immediate
difwi bI ia x.i = imm - x.i sex Difference Word Immediate
difwj bL ia x.i = immediate - x.i sex Difference Word Long Immediate