1 |
38 |
julius |
@c Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
2 |
|
|
@c This is part of the GAS manual.
|
3 |
|
|
@c For copying conditions, see the file as.texinfo.
|
4 |
|
|
@page
|
5 |
|
|
@node SH64-Dependent
|
6 |
|
|
@chapter SuperH SH64 Dependent Features
|
7 |
|
|
|
8 |
|
|
@cindex SH64 support
|
9 |
|
|
@menu
|
10 |
|
|
* SH64 Options:: Options
|
11 |
|
|
* SH64 Syntax:: Syntax
|
12 |
|
|
* SH64 Directives:: SH64 Machine Directives
|
13 |
|
|
* SH64 Opcodes:: Opcodes
|
14 |
|
|
@end menu
|
15 |
|
|
|
16 |
|
|
@node SH64 Options
|
17 |
|
|
@section Options
|
18 |
|
|
|
19 |
|
|
@cindex SH64 options
|
20 |
|
|
@cindex options, SH64
|
21 |
|
|
@table @code
|
22 |
|
|
|
23 |
|
|
@cindex SH64 ISA options
|
24 |
|
|
@cindex ISA options, SH64
|
25 |
|
|
@item -isa=sh4 | sh4a
|
26 |
|
|
Specify the sh4 or sh4a instruction set.
|
27 |
|
|
@item -isa=dsp
|
28 |
|
|
Enable sh-dsp insns, and disable sh3e / sh4 insns.
|
29 |
|
|
@item -isa=fp
|
30 |
|
|
Enable sh2e, sh3e, sh4, and sh4a insn sets.
|
31 |
|
|
@item -isa=all
|
32 |
|
|
Enable sh1, sh2, sh2e, sh3, sh3e, sh4, sh4a, and sh-dsp insn sets.
|
33 |
|
|
@item -isa=shmedia | -isa=shcompact
|
34 |
|
|
Specify the default instruction set. @code{SHmedia} specifies the
|
35 |
|
|
32-bit opcodes, and @code{SHcompact} specifies the 16-bit opcodes
|
36 |
|
|
compatible with previous SH families. The default depends on the ABI
|
37 |
|
|
selected; the default for the 64-bit ABI is SHmedia, and the default for
|
38 |
|
|
the 32-bit ABI is SHcompact. If neither the ABI nor the ISA is
|
39 |
|
|
specified, the default is 32-bit SHcompact.
|
40 |
|
|
|
41 |
|
|
Note that the @code{.mode} pseudo-op is not permitted if the ISA is not
|
42 |
|
|
specified on the command line.
|
43 |
|
|
|
44 |
|
|
@cindex SH64 ABI options
|
45 |
|
|
@cindex ABI options, SH64
|
46 |
|
|
@item -abi=32 | -abi=64
|
47 |
|
|
Specify the default ABI. If the ISA is specified and the ABI is not,
|
48 |
|
|
the default ABI depends on the ISA, with SHmedia defaulting to 64-bit
|
49 |
|
|
and SHcompact defaulting to 32-bit.
|
50 |
|
|
|
51 |
|
|
Note that the @code{.abi} pseudo-op is not permitted if the ABI is not
|
52 |
|
|
specified on the command line. When the ABI is specified on the command
|
53 |
|
|
line, any @code{.abi} pseudo-ops in the source must match it.
|
54 |
|
|
|
55 |
|
|
@item -shcompact-const-crange
|
56 |
|
|
Emit code-range descriptors for constants in SHcompact code sections.
|
57 |
|
|
|
58 |
|
|
@item -no-mix
|
59 |
|
|
Disallow SHmedia code in the same section as constants and SHcompact
|
60 |
|
|
code.
|
61 |
|
|
|
62 |
|
|
@item -no-expand
|
63 |
|
|
Do not expand MOVI, PT, PTA or PTB instructions.
|
64 |
|
|
|
65 |
|
|
@item -expand-pt32
|
66 |
|
|
With -abi=64, expand PT, PTA and PTB instructions to 32 bits only.
|
67 |
|
|
|
68 |
|
|
@end table
|
69 |
|
|
|
70 |
|
|
@node SH64 Syntax
|
71 |
|
|
@section Syntax
|
72 |
|
|
|
73 |
|
|
@menu
|
74 |
|
|
* SH64-Chars:: Special Characters
|
75 |
|
|
* SH64-Regs:: Register Names
|
76 |
|
|
* SH64-Addressing:: Addressing Modes
|
77 |
|
|
@end menu
|
78 |
|
|
|
79 |
|
|
@node SH64-Chars
|
80 |
|
|
@subsection Special Characters
|
81 |
|
|
|
82 |
|
|
@cindex line comment character, SH64
|
83 |
|
|
@cindex SH64 line comment character
|
84 |
|
|
@samp{!} is the line comment character.
|
85 |
|
|
|
86 |
|
|
@cindex line separator, SH64
|
87 |
|
|
@cindex statement separator, SH64
|
88 |
|
|
@cindex SH64 line separator
|
89 |
|
|
You can use @samp{;} instead of a newline to separate statements.
|
90 |
|
|
|
91 |
|
|
@cindex symbol names, @samp{$} in
|
92 |
|
|
@cindex @code{$} in symbol names
|
93 |
|
|
Since @samp{$} has no special meaning, you may use it in symbol names.
|
94 |
|
|
|
95 |
|
|
@node SH64-Regs
|
96 |
|
|
@subsection Register Names
|
97 |
|
|
|
98 |
|
|
@cindex SH64 registers
|
99 |
|
|
@cindex registers, SH64
|
100 |
|
|
You can use the predefined symbols @samp{r0} through @samp{r63} to refer
|
101 |
|
|
to the SH64 general registers, @samp{cr0} through @code{cr63} for
|
102 |
|
|
control registers, @samp{tr0} through @samp{tr7} for target address
|
103 |
|
|
registers, @samp{fr0} through @samp{fr63} for single-precision floating
|
104 |
|
|
point registers, @samp{dr0} through @samp{dr62} (even numbered registers
|
105 |
|
|
only) for double-precision floating point registers, @samp{fv0} through
|
106 |
|
|
@samp{fv60} (multiples of four only) for single-precision floating point
|
107 |
|
|
vectors, @samp{fp0} through @samp{fp62} (even numbered registers only)
|
108 |
|
|
for single-precision floating point pairs, @samp{mtrx0} through
|
109 |
|
|
@samp{mtrx48} (multiples of 16 only) for 4x4 matrices of
|
110 |
|
|
single-precision floating point registers, @samp{pc} for the program
|
111 |
|
|
counter, and @samp{fpscr} for the floating point status and control
|
112 |
|
|
register.
|
113 |
|
|
|
114 |
|
|
You can also refer to the control registers by the mnemonics @samp{sr},
|
115 |
|
|
@samp{ssr}, @samp{pssr}, @samp{intevt}, @samp{expevt}, @samp{pexpevt},
|
116 |
|
|
@samp{tra}, @samp{spc}, @samp{pspc}, @samp{resvec}, @samp{vbr},
|
117 |
|
|
@samp{tea}, @samp{dcr}, @samp{kcr0}, @samp{kcr1}, @samp{ctc}, and
|
118 |
|
|
@samp{usr}.
|
119 |
|
|
|
120 |
|
|
@node SH64-Addressing
|
121 |
|
|
@subsection Addressing Modes
|
122 |
|
|
|
123 |
|
|
@cindex addressing modes, SH64
|
124 |
|
|
@cindex SH64 addressing modes
|
125 |
|
|
|
126 |
|
|
SH64 operands consist of either a register or immediate value. The
|
127 |
|
|
immediate value can be a constant or label reference (or portion of a
|
128 |
|
|
label reference), as in this example:
|
129 |
|
|
|
130 |
|
|
@example
|
131 |
|
|
movi 4,r2
|
132 |
|
|
pt function, tr4
|
133 |
|
|
movi (function >> 16) & 65535,r0
|
134 |
|
|
shori function & 65535, r0
|
135 |
|
|
ld.l r0,4,r0
|
136 |
|
|
@end example
|
137 |
|
|
|
138 |
|
|
@cindex datalabel, SH64
|
139 |
|
|
Instruction label references can reference labels in either SHmedia or
|
140 |
|
|
SHcompact. To differentiate between the two, labels in SHmedia sections
|
141 |
|
|
will always have the least significant bit set (i.e. they will be odd),
|
142 |
|
|
which SHcompact labels will have the least significant bit reset
|
143 |
|
|
(i.e. they will be even). If you need to reference the actual address
|
144 |
|
|
of a label, you can use the @code{datalabel} modifier, as in this
|
145 |
|
|
example:
|
146 |
|
|
|
147 |
|
|
@example
|
148 |
|
|
.long function
|
149 |
|
|
.long datalabel function
|
150 |
|
|
@end example
|
151 |
|
|
|
152 |
|
|
In that example, the first longword may or may not have the least
|
153 |
|
|
significant bit set depending on whether the label is an SHmedia label
|
154 |
|
|
or an SHcompact label. The second longword will be the actual address
|
155 |
|
|
of the label, regardless of what type of label it is.
|
156 |
|
|
|
157 |
|
|
@node SH64 Directives
|
158 |
|
|
@section SH64 Machine Directives
|
159 |
|
|
|
160 |
|
|
In addition to the SH directives, the SH64 provides the following
|
161 |
|
|
directives:
|
162 |
|
|
|
163 |
|
|
@cindex SH64 machine directives
|
164 |
|
|
@cindex machine directives, SH64
|
165 |
|
|
|
166 |
|
|
@table @code
|
167 |
|
|
|
168 |
|
|
@item .mode [shmedia|shcompact]
|
169 |
|
|
@itemx .isa [shmedia|shcompact]
|
170 |
|
|
Specify the ISA for the following instructions (the two directives are
|
171 |
|
|
equivalent). Note that programs such as @code{objdump} rely on symbolic
|
172 |
|
|
labels to determine when such mode switches occur (by checking the least
|
173 |
|
|
significant bit of the label's address), so such mode/isa changes should
|
174 |
|
|
always be followed by a label (in practice, this is true anyway). Note
|
175 |
|
|
that you cannot use these directives if you didn't specify an ISA on the
|
176 |
|
|
command line.
|
177 |
|
|
|
178 |
|
|
@item .abi [32|64]
|
179 |
|
|
Specify the ABI for the following instructions. Note that you cannot use
|
180 |
|
|
this directive unless you specified an ABI on the command line, and the
|
181 |
|
|
ABIs specified must match.
|
182 |
|
|
|
183 |
|
|
@item .uaquad
|
184 |
|
|
Like .uaword and .ualong, this allows you to specify an intentionally
|
185 |
|
|
unaligned quadword (64 bit word).
|
186 |
|
|
|
187 |
|
|
@end table
|
188 |
|
|
|
189 |
|
|
@node SH64 Opcodes
|
190 |
|
|
@section Opcodes
|
191 |
|
|
|
192 |
|
|
@cindex SH64 opcode summary
|
193 |
|
|
@cindex opcode summary, SH64
|
194 |
|
|
@cindex mnemonics, SH64
|
195 |
|
|
@cindex instruction summary, SH64
|
196 |
|
|
For detailed information on the SH64 machine instruction set, see
|
197 |
|
|
@cite{SuperH 64 bit RISC Series Architecture Manual} (SuperH, Inc.).
|
198 |
|
|
|
199 |
|
|
@code{@value{AS}} implements all the standard SH64 opcodes. In
|
200 |
|
|
addition, the following pseudo-opcodes may be expanded into one or more
|
201 |
|
|
alternate opcodes:
|
202 |
|
|
|
203 |
|
|
@table @code
|
204 |
|
|
|
205 |
|
|
@item movi
|
206 |
|
|
If the value doesn't fit into a standard @code{movi} opcode,
|
207 |
|
|
@code{@value{AS}} will replace the @code{movi} with a sequence of
|
208 |
|
|
@code{movi} and @code{shori} opcodes.
|
209 |
|
|
|
210 |
|
|
@item pt
|
211 |
|
|
This expands to a sequence of @code{movi} and @code{shori} opcode,
|
212 |
|
|
followed by a @code{ptrel} opcode, or to a @code{pta} or @code{ptb}
|
213 |
|
|
opcode, depending on the label referenced.
|
214 |
|
|
|
215 |
|
|
@end table
|