5.3 Floating-Point Instruction
Table 5-4 shows floating-point instructions. In cases where more than numeric type is involved, each instruction in a group is described; otherwise, only the first member of a group is described.
Table 5-4
SPARC | Mnemonic1 | Argument List | Description |
---|---|---|---|
FiTOs | fitos | fregrs2, fregrd | Convert integer to single |
FiTOd | fitod | fregrs2, fregrd | Convert integer to double |
FiTOq | fitoq | fregrs2, fregrd | Convert integer to quad |
FsTOi | fstoi | fregrs2, fregrd | Convert single to integer |
FdTOi | fdtoi | fregrs2, fregrd | Convert double to integer |
FqTOi | fqtoi | fregrs2, fregrd | Convert quad to integer |
FsTOd | fstod | fregrs2, fregrd | Convert single to double |
FsTOq | fstoq | fregrs2, fregrd | Convert single to quad |
FdTOs | fdtos | fregrs2, fregrd | Convert double to single |
FdTOq | fdtoq | fregrs2, fregrd | Convert double to quad |
FqTOd | fqtod | fregrs2, fregrd | Convert quad to double |
FqTOs | fqtos | fregrs2, fregrd | Convert quad to single |
FMOVs | fmovs | fregrs2, fregrd | Move |
FNEGs | fnegs | fregrs2, fregrd | Negate |
FABSs | fabss | fregrs2, fregrd | Absolute value |
FSQRTs FSQRTd FSQRTq | fsqrts fsqrtd fsqrtq | fregrs2, fregrd fregrs2, fregrd fregrs2, fregrd | Square root |
FADDs FADDd FADDq | fadds faddd faddq | fregrs1, fregrs2, fregrd fregrs1, fregrs2, fregrd fregrs1, fregrs2, fregrd | Add |
FSUBs FSUBd FSUBq | fsubs fsubd fsubq | fregrs1, fregrs2, fregrd fregrs1, fregrs2, fregrd fregrs1, fregrs2, fregrd | Subtract |
FMULs FMULd FMULq | fmuls fmuld fmulq | fregrs1, fregrs2, fregrd fregrs1, fregrs2, fregrd fregrs1, fregrs2, fregrd | Multiply |
FdMULq | fmulq | fregrs1, fregrs2, fregrd | Multiply double to quad |
FsMULd | fsmuld | fregrs1, fregrs2, fregrd | Multiply single to double |
FDIVs FDIVd FDIVq | fdivs fdivd fdivq | fregrs1, fregrs2, fregrd fregrs1, fregrs2, fregrd fregrs1, fregrs2, fregrd | Divide |
FCMPs FCMPd FCMPq | fcmps fcmpd fcmpq | fregrs1, fregrs2 fregrs1, fregrs2 fregrs1, fregrs2 | Compare |
FCMPEs FCMPEd FCMPEq | fcmpes fcmped fcmpeq | fregrs1, fregrs2 fregrs1, fregrs2 fregrs1, fregrs2 | Compare, generate exception if not ordered |
1 Types of Operands are denoted by the following lower-case letters:i integers singled doubleq quad
5.4 Coprocessor Instructions
All coprocessor-operate (cpopn) instructions take all operands from and return all results to coprocessor registers. The data types supported by the coprocessor are coprocessor-dependent. Operand alignment is also coprocessor-dependent. Coprocessor-operate instructions are described in Table 5-5.
If the EC (PSR_enable_coprocessor) field of the processor state register (PSR) is 0, or if a coprocessor is not present, a cpopn instruction causes a cp_disabled trap.
The conditions that cause a cp_exception trap are coprocessor-dependent.
Table 5-5
SPARC | Mnemonic | Argument List | Name | Comments |
---|---|---|---|---|
CPop1 | cpop1 | opc, regrs1, regrs2, regrd | Coprocessor operation |
|
CPop2 | cpop2 | opc, regrs1, regrs2, regrd | Coprocessor operation | May modify ccc |
5.5 Synthetic Instructions
Table 5-6 describes the mapping of synthetic instructions to hardware instructions.
Table 5-6
Synthetic Instruction | Hardware Equivalent(s) | Comment | ||
---|---|---|---|---|
btst | reg_or_imm, regrs1 | andcc | regrs1, reg_or_imm, %g0 | Bit test |
bset | reg_or_imm, regrd | or | regrd, reg_or_imm, regrd | Bit set |
bclr | reg_or_imm, regrd | andn | regrd, reg_or_imm, regrd | Bit clear |
btog | reg_or_imm, regrd | xor | regrd, reg_or_imm, regrd | Bit toggle |
call | reg_or_imm | jmpl | reg_or_imm, %o7 |
|
clr | regrd | or | %g0, %g0, regrd | Clear (zero) register |
clrb | [address] | stb | %g0, [address] | Clear byte |
clrh | [address] | st | %g0, [address] | Clear halfword |
clr | [address] | st | %g0, [address] | Clear word |
cmp | reg, reg_or_imm | subcc | regrs1, reg_or_imm, %g0 | Compare |
dec | regrd | sub | regrd, 1, regrd | Decrement by 1 |
dec | const13, regrd | sub | regrd, const13, regrd | Decrement by const13 |
deccc | regrd | subcc | regrd, 1, regrd | Decrement by 1 and set icc |
deccc | const13, regrd | subcc | regrd, const13, regrd | Decrement by const13 and set icc |
inc | regrd | add | regrd, 1, regrd | Increment by 1 |
inc | const13, regrd | add | regrd, const13, regrd | Increment by const13 |
inccc | regrd | addcc | regrd, 1, regrd | Increment by 1 and set icc |
inccc | const13, regrd | addcc | regrd, const13, regrd | Increment by const13 and set icc |
jmp | address | jmpl | address, %g0 |
|
mov mov mov mov mov mov mov mov mov | reg_or_imm,regrd %y, regrs1 %psr, regrs1 %wim, regrs1 %tbr, regrs1 reg_or_imm, %y reg_or_imm, %psr reg_or_imm, %wim reg_or_imm, %tbr | or rd rd rd rd wr wr wr wr | %g0, reg_or_imm, regrd %y, regrs1 %psr, regrs1 %wim, regrs1 %tbr, regrs1 %g0,reg_or_imm,%y %g0,reg_or_imm,%psr %g0,reg_or_imm,%wim %g0,reg_or_imm,%tbr |
|
not | regrs1, regrd | xnor | regrs1, %g0, regrd | One's complement |
not | regrd | xnor | regrd, %g0, regrd | One's complement |
neg | regrs1, regrd | sub | %g0, regrs2, regrd | Two's complement |
neg | regrd | sub | %g0, regrd, regrd | Two's complement |
restore |
| restore | %g0, %g0, %g0 | Trivial restore |
save |
| save | %g0, %g0, %g0 | Trivial save trivial save should only be used in supervisor code! |
set | value,regrd | or | %g0, value, regrd | if -4096 <=value <= 4095 Do not use the set synthetic instruction in an instruction delay slot. |
set | value,regrd | sethi | %hi(value), regrd | if ((value & 0x3ff) == 0) |
set | value, regrd | sethi or | %hi(value), regrd; regrd, %lo(value), regrd | otherwise Do not use the set synthetic instruction in an instruction delay slot. |
skipz |
| bnz,a .+8 |
| if z is set, ignores next instruction |
skipnz |
| bz,a .+8 |
| if z is not set, ignores next instruction |
tst | reg | orcc | regrs1, %g0, %g0 | test |
5.6 V8/V9 Natural Pseudo Instructions
Table 5-7 describes the V8/V9 natural pseudo instructions that will help increase the portability of your assembly code from V8/V8plus to V9.
Table 5-7
Pseudo Instructions | -xarch= | |
---|---|---|
V8/V8plus1 | V9 | |
ldn | ld | ldx |
stn | st | stx |
ldna | lda | ldxa |
stna | sta | stxa |
setn | set | setx |
setnhi | sethi | setxhi |
casn | cas | casx |
slln | sll | sllx |
srln | srl | srlx |
sran | sra | srax |
clrn | clr | clrx |
Note - Depending on the value set for the -xarch option, the assembler substitutes the appropriate pseudo instruction.