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