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