SPARC assembly language instructions fall into one of the following categories listed below.
Arithmetic - addition and subtraction, with further instructions for either that set condition codes, as well as a special instructions to start multiply routines and to read and write from the Y register (a special register used in multiiply and divide routines).
Logical - ands, ors, nors, & xors, with further instructions for each to set condition codes.
Shift - three shift instructions - logical left, logical right, and arithmetic right.
Load - loads for unsigned bytes, signed bytes, unsigned halfwords, signed halfwords, words, and doublewords.
Store - stores for the low-order byte or low order half of a register, a full register (word), two registers (doubleword), or a swap (a load and store at the same time!)
Integer Branch - SPARC architecture keeps a condition code register that records the result of compares and other operations (hi, lo, less than, etc). Branch instructions read the condtion code and branch accordingly. There are branches on equal, not equal, less than, less or equal, greater than or equal, greater than; and all of the same again for unsigned integers. Also branches for special condtions such as signed integer overflow. There is also the uncondtional branch, and a curious branch never, which has the same execution as a branch instruction, in that it calculates the displacement to the branch address named, but itdoes not branch.
Trap - a set of instructions to run to trap handlers. Traps read conditon codes, like the branch instructions, and branch on almost all of the same condition Traps also have an unconditional trap, and, you guessed it, the trap never instruction.
Control - these are the commands that call subroutines or help in the effort. Call causes an uncondtional jump to any address in memory; a function call. Jumps do the same but with a register and displacement calculation to determine the target address. A return instruction returns from a trap routine and restores the user state prior to the call to the trap. A "sethi" instruction is included to create larger immediate constants for other instructions. Save and restore commands save and restore register windows over function calls.
Floating-Point - SPARC includes separate set of commands for floating point operations to do loads stores, adds, multiplications, divisions, compares, and branches.
Pseudo-instruction - SPARC also includes to improve readability where the operation being performed might not seem obvious from the instruction it generates. For example, to get the negative value of a postive number, you might do a 'sub' and subtract the value from zero - using the three operands that the 'sub' instruction requires. SPARC provides the pseudo instruction 'neg', which requires only the register to be negated as the operand, to save from writing the extra parameters and make the purpose of the instruction more obvious to a reader.
Paul Austin
Charles Gates
Last modified: Tue Apr 23 09:09:04 EDT 2002