Professional Documents
Culture Documents
Notation Load Instructions: Assembler Syntax Instruction Formats Operations
Notation Load Instructions: Assembler Syntax Instruction Formats Operations
, reg rd ) const unsigned integer value subscript denotes size in bits (e.g., const 22) disp signed integer displacement subscript denotes size in bits (e.g., disp 22) siconst 2's complement signed integer value subscript denotes size in bits (e.g., siconst 30) address reg rs1 reg rs1 + reg rs2 reg rs1 + siconst 13 reg rs1 ; siconst 13 siconst 13 siconst 13 + reg rs1 regaddr reg rs1 reg rs1 + reg rs2 label an instruction label asi address space identi er (0 to 255) Name %r0{%r31 %g0{%g7 %o0{%o7 %l0{%l7 %i0{%i7 %fp %sp %asr1{%ars31 %psr %tbr %y
31:28
Notation
Load Instructions
Instruction Formats
11 11 rd rd op3 op3
rs1 rs1
13
0 1
12:5
4:0
Operations
operation ldsb ldsh ldub lduh ld ldd ldstub swap
Registers
%r0 always holds the 32-bit integer value 0. %psr has the following structure: %tbr has the following structure:
Trap base address
31:12
Meaning integer registers global regs (%r0{%r7) output regs (%r8{%r15) local regs (%r16{%r23) input regs (%r24{%r31) frame pointer (%i6) stack pointer (%o6) ancillary state registers processor status register trap base register multiply/divide register
19:14 13 12
Assembler Syntax
31:30
SETHI Instructions
operation (alt. space) ldsba ldsha lduba lduha lda ldda ldstuba swapa
Assembler Syntax
7 6 5 4:0 31:30 29:25 24:19
impl
27:24
ver
23 22 21 20
11:8
Instruction Formats
10 10 rd rd op3 op3
operation reg rs1 , reg rs2 , reg rd operation reg rs1 , siconst 13, reg rd
rs1 rs1 0 unused (zero) rs2 siconst13 1
0000
3:0
Assembler Syntax
31:30 29:25 24:19
Store Instructions
18:14 13 12:5 4:0
Operations
operation add addx and andn or orn udiv umul sdiv smul sub subx taddcc tsubcc xor xnor
Instruction Formats
11 11 rd rd op3 op3
op3 000000 001000 000001 000101 000010 000110 001110 001010 001111 001011 000100 001100 100000 100001 000011 000111
Operations
operation stb sth st std
operation addcc addxcc andcc andncc mulscc orcc orncc udivcc umulcc sdivcc smulcc subcc subxcc taddcctv tsubcctv xorcc xnorcc
op3 010000 011000 010001 010101 100100 010010 010110 011110 011010 011111 011011 010100 011100 100010 100011 010011 010111
Assembler Syntax
31:30 29:25 24:19
Shift Instructions
18:14 13 12:5 4:0
Instruction Formats
10 10 rd rd op3 op3
operation reg rs1 , reg rs2 , reg rd operation reg rs1 , const 5, reg rd
rs1 rs1 0 unused (zero) 1 unused (zero) rs2 const5
Assembler Syntax
31:30 29:25 24:19
Instruction Formats
10 10 rd rd op3 op3
operation reg rs1 , reg rs2 , reg rd operation reg rs1 , siconst 13, reg rd
rs1 rs1 0 unused (zero) rs2 siconst13 1
Operations
operation sll sra srl
Assembler Syntax
operation label operation ,a label
010
Branch Instructions
21:0
Operations
Assembler Syntax
31:30 29 28:25 24:19
Trap Instructions
18:14 13 12:5 4:0
Instruction Formats
10 r cond 10 r cond 111010 111010
operation reg rs1 , reg rs2 , reg rd operation reg rs1 , siconst 13, reg rd
rs1 rs1 0 unused (zero) rs2 siconst13 1
disp22
Operations
operation bn be (bz) ble bl bleu bcs (blu) bneg bvs
Assembler Syntax
31:30
Operations
operation tn te (tz) tle tl tleu tcs (tlu) tneg tvs nop
Instruction Formats
10 10 rd rd 111000 111000
24:19
Assembler Syntax
12:5 4:0 31:30
18:14
rs1 rs1
13
0000000000000000000000
21:0
Assembler Syntax
rett address
00000 00000
29:25 31:30
Assembler Syntax
unimp const 22
000
31:30 4:0
Instruction Formats
10 10
rs1 rs1
13
12:5
Assembler Syntax
call label
31:30
Assembler Syntax
stbar
31:30
Instruction Format
01
unused (zero)
13:0
Assembler Syntax
rd statereg , rd
rd
31:30
rs1
unused (zero)
13:0
Register Encodings
state register %y %asr1{%asr31 %psr %wim %tbr
Assembler Syntax
31:30 29:25 24:19
Instruction Formats
10 10 rd rd op3 op3
wr reg rs1 , reg rs2 , statereg wr reg rs1 , siconst 13, statereg
rs1 rs1 rs2 0 unused (zero) siconst13 1
Register Encodings
state register %y %asr1{%asr31 %psr %wim %tbr
Assembler Syntax
ush address
29:25 31:30
FLUSH Instructions
111011 111011
24:19
Synthetic instruction bclr rs , rd bclr rs , siconst 13 bset rs , rd bset siconst 13 , rd btst rs 1, rs 2 btst rs , siconst 13 btog rs , rd btog rs , siconst 13 call address clr rd clrb address ] clrh address ] clr address ] cmp rs 1, rs 2 cmp rs , siconst 13 dec rd dec siconst 13 , rd deccc rd deccc siconst 13 , rd inc rd inc siconst 13 , rd inccc rd inccc siconst 13 , rd jmp address mov rs , rd mov siconst 13 , rd mov statereg , rd mov rs , statereg mov siconst 13 , statereg neg rs , rd neg rd not rd not rs , rd restore save ret retl set iconst , rd
Synthetic Instructions
Instruction Formats
10 unused 10 unused
18:14
rs1 rs1
13
12:5
4:0
tst
rs
Implementation andn rd , rs , rd andn rs , siconst 13 , rd or rd , rs , rd or rd , siconst 13 , rd andcc rs 1 , rs 2, %g0 andcc rs , siconst 13 , %g0 xor rd , rs , rd xor rs , siconst 13 , rd jmpl address , %g0 or %g0, %g0, rd stb %g0, address ] sth %g0, address ] st %g0, address ] subcc rs 1 , rs 2, %g0 subcc rs , siconst 13 , %g0 sub rd , 1, rd sub rd , siconst 13 , rd subcc rd , 1, rd subcc rd , siconst 13 , rd add rd , 1, rd add rd , siconst 13 , rd addcc rd , 1, rd addcc rd , siconst 13 , rd jmpl address , %g0 or %g0, rs , rd or %g0, siconst 13 , rd rd statereg , rd wr %g0, rs , statereg wr %g0, siconst 13 , statereg sub %g0, rs , rd sub %g0, rd , rd xnor rd , %g0, rd xnor rs , %g0, rd restore %g0, %g0, %g0 save %g0, %g0, %g0 jmpl %i7+8, %g0 jmpl %o7+8, %g0 or %g0, iconst , rd |or | sethi %hi(iconst ), rd |or | sethi %hi(iconst ), rd or rd , %lo(iconst ), rd orcc %g0, rs , %g0
.align .ascii .asciz .byte .data .global .half .include .skip .text .word 0 1 2 3
Assembler Directives
n
"string " , "string "]* "string " , "string "]* 8-bitval , 8-bitval ]*
label , label ]* 16-bitval , 16-bitval ]* " lename "
n
ISEM Traps
32-bitval , 32-bitval ]*
terminate program putchar( %r8 ) blocking getchar( %r8 ) nonblocking getchar( %r8 )