]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/doc/c-sh.texi
Fix typo: bfd_mmo_mmix_vec => bfd_mmo_vec.
[thirdparty/binutils-gdb.git] / gas / doc / c-sh.texi
CommitLineData
f7e42eb4
NC
1@c Copyright 1991, 1992, 1993, 1994, 1995, 1997
2@c Free Software Foundation, Inc.
252b5132
RH
3@c This is part of the GAS manual.
4@c For copying conditions, see the file as.texinfo.
5@page
6@node SH-Dependent
7@chapter Hitachi SH Dependent Features
8
9@cindex SH support
10@menu
11* SH Options:: Options
12* SH Syntax:: Syntax
13* SH Floating Point:: Floating Point
14* SH Directives:: SH Machine Directives
15* SH Opcodes:: Opcodes
16@end menu
17
18@node SH Options
19@section Options
20
21@cindex SH options (none)
22@cindex options, SH (none)
23@code{@value{AS}} has no additional command-line options for the Hitachi
24SH family.
25
26@node SH Syntax
27@section Syntax
28
29@menu
30* SH-Chars:: Special Characters
31* SH-Regs:: Register Names
32* SH-Addressing:: Addressing Modes
33@end menu
34
35@node SH-Chars
36@subsection Special Characters
37
38@cindex line comment character, SH
39@cindex SH line comment character
40@samp{!} is the line comment character.
41
42@cindex line separator, SH
43@cindex statement separator, SH
44@cindex SH line separator
45You can use @samp{;} instead of a newline to separate statements.
46
47@cindex symbol names, @samp{$} in
48@cindex @code{$} in symbol names
49Since @samp{$} has no special meaning, you may use it in symbol names.
50
51@node SH-Regs
52@subsection Register Names
53
54@cindex SH registers
55@cindex registers, SH
56You can use the predefined symbols @samp{r0}, @samp{r1}, @samp{r2},
57@samp{r3}, @samp{r4}, @samp{r5}, @samp{r6}, @samp{r7}, @samp{r8},
58@samp{r9}, @samp{r10}, @samp{r11}, @samp{r12}, @samp{r13}, @samp{r14},
59and @samp{r15} to refer to the SH registers.
60
61The SH also has these control registers:
62
63@table @code
64@item pr
65procedure register (holds return address)
66
67@item pc
68program counter
69
70@item mach
71@itemx macl
72high and low multiply accumulator registers
73
74@item sr
75status register
76
77@item gbr
78global base register
79
80@item vbr
81vector base register (for interrupt vectors)
82@end table
83
84@node SH-Addressing
85@subsection Addressing Modes
86
87@cindex addressing modes, SH
88@cindex SH addressing modes
89@code{@value{AS}} understands the following addressing modes for the SH.
90@code{R@var{n}} in the following refers to any of the numbered
91registers, but @emph{not} the control registers.
92
93@table @code
94@item R@var{n}
95Register direct
96
97@item @@R@var{n}
98Register indirect
99
100@item @@-R@var{n}
101Register indirect with pre-decrement
102
103@item @@R@var{n}+
104Register indirect with post-increment
105
106@item @@(@var{disp}, R@var{n})
107Register indirect with displacement
108
109@item @@(R0, R@var{n})
110Register indexed
111
112@item @@(@var{disp}, GBR)
113@code{GBR} offset
114
115@item @@(R0, GBR)
116GBR indexed
117
118@item @var{addr}
119@itemx @@(@var{disp}, PC)
120PC relative address (for branch or for addressing memory). The
121@code{@value{AS}} implementation allows you to use the simpler form
122@var{addr} anywhere a PC relative address is called for; the alternate
123form is supported for compatibility with other assemblers.
124
125@item #@var{imm}
126Immediate data
127@end table
128
129@node SH Floating Point
130@section Floating Point
131
132@cindex floating point, SH (@sc{ieee})
133@cindex SH floating point (@sc{ieee})
134The SH family has no hardware floating point, but the @code{.float}
135directive generates @sc{ieee} floating-point numbers for compatibility
136with other development tools.
137
138@node SH Directives
139@section SH Machine Directives
140
141@cindex SH machine directives
142@cindex machine directives, SH
143@cindex @code{uaword} directive, SH
144@cindex @code{ualong} directive, SH
145
146@table @code
147@item uaword
148@itemx ualong
149@code{@value{AS}} will issue a warning when a misaligned @code{.word} or
150@code{.long} directive is used. You may use @code{.uaword} or
151@code{.ualong} to indicate that the value is intentionally misaligned.
152@end table
153
154@node SH Opcodes
155@section Opcodes
156
157@cindex SH opcode summary
158@cindex opcode summary, SH
159@cindex mnemonics, SH
160@cindex instruction summary, SH
161For detailed information on the SH machine instruction set, see
162@cite{SH-Microcomputer User's Manual} (Hitachi Micro Systems, Inc.).
163
164@code{@value{AS}} implements all the standard SH opcodes. No additional
165pseudo-instructions are needed on this family. Note, however, that
166because @code{@value{AS}} supports a simpler form of PC-relative
167addressing, you may simply write (for example)
168
169@example
170mov.l bar,r0
171@end example
172
173@noindent
174where other assemblers might require an explicit displacement to
175@code{bar} from the program counter:
176
177@example
178mov.l @@(@var{disp}, PC)
179@end example
180
181@ifset SMALL
182@c this table, due to the multi-col faking and hardcoded order, looks silly
183@c except in smallbook. See comments below "@set SMALL" near top of this file.
184
185Here is a summary of SH opcodes:
186
187@page
188@smallexample
189@i{Legend:}
190Rn @r{a numbered register}
191Rm @r{another numbered register}
192#imm @r{immediate data}
193disp @r{displacement}
194disp8 @r{8-bit displacement}
195disp12 @r{12-bit displacement}
196
197add #imm,Rn lds.l @@Rn+,PR
198add Rm,Rn mac.w @@Rm+,@@Rn+
199addc Rm,Rn mov #imm,Rn
200addv Rm,Rn mov Rm,Rn
201and #imm,R0 mov.b Rm,@@(R0,Rn)
202and Rm,Rn mov.b Rm,@@-Rn
203and.b #imm,@@(R0,GBR) mov.b Rm,@@Rn
204bf disp8 mov.b @@(disp,Rm),R0
205bra disp12 mov.b @@(disp,GBR),R0
206bsr disp12 mov.b @@(R0,Rm),Rn
207bt disp8 mov.b @@Rm+,Rn
208clrmac mov.b @@Rm,Rn
209clrt mov.b R0,@@(disp,Rm)
210cmp/eq #imm,R0 mov.b R0,@@(disp,GBR)
211cmp/eq Rm,Rn mov.l Rm,@@(disp,Rn)
212cmp/ge Rm,Rn mov.l Rm,@@(R0,Rn)
213cmp/gt Rm,Rn mov.l Rm,@@-Rn
214cmp/hi Rm,Rn mov.l Rm,@@Rn
215cmp/hs Rm,Rn mov.l @@(disp,Rn),Rm
216cmp/pl Rn mov.l @@(disp,GBR),R0
217cmp/pz Rn mov.l @@(disp,PC),Rn
218cmp/str Rm,Rn mov.l @@(R0,Rm),Rn
219div0s Rm,Rn mov.l @@Rm+,Rn
220div0u mov.l @@Rm,Rn
221div1 Rm,Rn mov.l R0,@@(disp,GBR)
222exts.b Rm,Rn mov.w Rm,@@(R0,Rn)
223exts.w Rm,Rn mov.w Rm,@@-Rn
224extu.b Rm,Rn mov.w Rm,@@Rn
225extu.w Rm,Rn mov.w @@(disp,Rm),R0
226jmp @@Rn mov.w @@(disp,GBR),R0
227jsr @@Rn mov.w @@(disp,PC),Rn
228ldc Rn,GBR mov.w @@(R0,Rm),Rn
229ldc Rn,SR mov.w @@Rm+,Rn
230ldc Rn,VBR mov.w @@Rm,Rn
231ldc.l @@Rn+,GBR mov.w R0,@@(disp,Rm)
232ldc.l @@Rn+,SR mov.w R0,@@(disp,GBR)
233ldc.l @@Rn+,VBR mova @@(disp,PC),R0
234lds Rn,MACH movt Rn
235lds Rn,MACL muls Rm,Rn
236lds Rn,PR mulu Rm,Rn
237lds.l @@Rn+,MACH neg Rm,Rn
238lds.l @@Rn+,MACL negc Rm,Rn
239@page
240nop stc VBR,Rn
241not Rm,Rn stc.l GBR,@@-Rn
242or #imm,R0 stc.l SR,@@-Rn
243or Rm,Rn stc.l VBR,@@-Rn
244or.b #imm,@@(R0,GBR) sts MACH,Rn
245rotcl Rn sts MACL,Rn
246rotcr Rn sts PR,Rn
247rotl Rn sts.l MACH,@@-Rn
248rotr Rn sts.l MACL,@@-Rn
249rte sts.l PR,@@-Rn
250rts sub Rm,Rn
251sett subc Rm,Rn
252shal Rn subv Rm,Rn
253shar Rn swap.b Rm,Rn
254shll Rn swap.w Rm,Rn
255shll16 Rn tas.b @@Rn
256shll2 Rn trapa #imm
257shll8 Rn tst #imm,R0
258shlr Rn tst Rm,Rn
259shlr16 Rn tst.b #imm,@@(R0,GBR)
260shlr2 Rn xor #imm,R0
261shlr8 Rn xor Rm,Rn
262sleep xor.b #imm,@@(R0,GBR)
263stc GBR,Rn xtrct Rm,Rn
264stc SR,Rn
265@end smallexample
266@end ifset
267
268@ifset Hitachi-all
269@ifclear GENERIC
270@raisesections
271@end ifclear
272@end ifset
273