468 Computer Architecture and Organization
Instructions for integer oriented arithmetic operations are shown in Table C.3 , which includes four
basic operations of arithmetic, addition, subtraction, multiplication and division with integer operands.
Note that for all instructions three register format is supported, i.e.,
R 1 ← R2 + R3
shown related with addition operation only. The multiply instruction generates a 64-bit product of two
32-bit integers.
The oating point instructions (Table C.4), on the other hand, support addition and multiplication
apart from loading and comparing oating numbers. It may be noted that apart from load and store
instructions, lfs is the only instruction, which interacts with the memory exclusively for oating point
data loading. Another special instruction is the fmadd instruction, which multiplies two oating point
numbers in two registers and then add the product with a third register to place the nal result in a fourth
register, e.g.,
R 1 ← (R2 × R3) + R4
The last instruction of this group compares two oating point numbers and the result is re ected
through ags.
Mnemonic Function
lfs Load 32-bit oating point number from memory, convert it to 64-bit format and then store in indi-
cated oating point register
fadd Add content of two registers and store result in a third register
fmadd Multiply contents of two registers, add the result with a third register and place the nal result in
a fourth register
fcmpu Compare two oating point registers and re ect the result of comparison through condition ags
Table C.4 Floating point instructions
The next group of instruction mnemonics, i.e., logical and shift instructions are presented in Table C.5
along with their functional descriptions. Both bit-wise as well as word-wise logical ANDing instructions
are provided along with the standard shift, rotate and compare instructions. For the shifting operation, the
shifted out bits are placed within an indicated destination register.
Mnemonic Function
cmp Compare two operands and adjust four condition bits in the speci ed eld of the condition register
crand Two indicated bits of the condition register are ANDed and the result is placed in one of the two
bit positions
and Logically AND content of two registers and place the result in a third register
cntlzd Starting from bit 0, count number of 0 bits in a source register and place the number of count in
a destination register
rldic Rotate left 64-bit register, AND with mask and store result in a destination register
sld Shift left bits in source register and store shifted bits in destination register
Table C.5 Logical and shift instructions
Z03_GHOS1557_01_SE_C18_App_C.indd 468Z03_GHOS1557_01_SE_C18_App_C.indd 468 4/29/11 5:42 PM4/29/11 5:42 PM