B.5. Synthetic Instructions

Table B-1 describes the mapping of a set of synthetic (or "pseudo") instructions to actual ERC32 instructions. These synthetic instructions are provided by the ERC32 assembler for the convenience of assembly language programmers.

Note that synthetic instructions should not be confused with pseudo-ops,which typically provide information to the assembler but do not generate instructions. Synthetic instructions always generate instructions; they provide a more mnemonic syntax for standard ERC32 instructions.

The data in this table is based on Appendix A of The SPARC Architecture Manual, published by SPARC International, Inc.

Table B-1. Mapping of Synthetic Instructions to ERC32 Instructions

Synthetic InstructionERC32 Instruction(s)Comment
cmp regrs1,reg_or_immsubcc regrs1,reg_or_imm,%g0compare
jmp addressjmpl address,%g0
call addressjmpl address,%o7
tst regrs2orcc %g0,regrs2,%g0test
ret jmpl %i7+8,%g0return from subroutine
retl jmpl %o7+8,%g0return from leaf subroutine
restore restore %g0,%g0,%g0trivial restore
save save %g0,%g0,%g0trivial save (Warning: trivial save should only be used in kernel code! )
set value,regrdsethi %hi(value,regrd(when ((value & 0x1fff) == 0))
 or 
 or %g0,value,regrd(when -4096 <= value <= 4095)
 or 
 sethi %hi(value,regrd;(otherwise)
 or regrd,%lo(value),regrd 
not regrs1,regrdxnor regrs1,%g0,regrdone's complement
not regrdxnor regrd,%g0,regrdone's complement
neg regrs2,regrdsub %g0,regrs2, regrdtwo's complement
neg regrdsub %g0,regrd,regrdtwo's complement
inc regrdadd regrd,1,regrdincrement by 1
inc const13,regrdadd regrd,const13 ,regrdincrement by const13
inccc regrdaddcc regrd,1,regrdincrement by 1 and set icc
inccc const13,regrdaddcc regrd,const13,regrdincrement by const13 and set icc
dec regrdsub reg,1,regrddecrement by 1
dec const13,regrdsub reg,const13,regrddecrement by const13
deccc regrdsubcc reg,1,regrddecrement by 1 and set icc
deccc const13,regrdsubcc regrd,const13,regrddecrement by const13 and set icc
btst reg_or_imm,regrs1andcc regrs1,reg_or_imm,%g0bit test
bset reg_or_imm,regrdor regrd,reg_or_imm,regrdbit set
bclr reg_or_imm,regrdandn regrd,reg_or_imm,regrdbit clear
btog reg_or_imm,regrdxor regrd,reg_or_imm,regrdbit toggle
clr regrdor %g0,%g0,regrdclear(zero) register
clrb [address]stb %g0,[address]clear byte
clrh [address]sth %g0,[address]clear halfword
clr [address]st %g0,[address]clear word
mov reg_or_imm,regrdrd %g0,reg_or_imm,regrd
mov %y,regrdrd %y,regrd
mov %asrn,regrdrd %asrn,regrd
mov %psr,regrdrd %psr,regrd
mov %wim,regrdrd %wim,regrd
mov %tbr,regrdrd %tbr,regrd
mov reg_or_imm,%ywr %g0,reg_or_imm,%y
mov reg_or_imm,%asrnwr %g0,reg_or_imm,%asrn
mov reg_or_imm,%psrwr %g0,reg_or_imm,%psr
mov reg_or_imm,%wimwr %g0,reg_or_imm,%wim
mov reg_or_imm,%tbrwr %g0,reg_or_imm,%tbr