1@c Copyright 2009 2@c Free Software Foundation, Inc. 3@c This is part of the GAS manual. 4@c For copying conditions, see the file as.texinfo. 5@ifset GENERIC 6@page 7@node S/390-Dependent 8@chapter IBM S/390 Dependent Features 9@end ifset 10@ifclear GENERIC 11@node Machine Dependencies 12@chapter IBM S/390 Dependent Features 13@end ifclear 14 15@cindex s390 support 16 17The s390 version of @code{@value{AS}} supports two architectures modes 18and seven chip levels. The architecture modes are the Enterprise System 19Architecture (ESA) and the newer z/Architecture mode. The chip levels 20are g5, g6, z900, z990, z9-109, z9-ec, z10 and z196. 21 22@menu 23* s390 Options:: Command-line Options. 24* s390 Characters:: Special Characters. 25* s390 Syntax:: Assembler Instruction syntax. 26* s390 Directives:: Assembler Directives. 27* s390 Floating Point:: Floating Point. 28@end menu 29 30@node s390 Options 31@section Options 32@cindex options for s390 33@cindex s390 options 34 35The following table lists all available s390 specific options: 36 37@table @code 38@cindex @samp{-m31} option, s390 39@cindex @samp{-m64} option, s390 40@item -m31 | -m64 41Select 31- or 64-bit ABI implying a word size of 32- or 64-bit. 42 43These options are only available with the ELF object file format, and 44require that the necessary BFD support has been included (on a 31-bit 45platform you must add --enable-64-bit-bfd on the call to the configure 46script to enable 64-bit usage and use s390x as target platform). 47 48@cindex @samp{-mesa} option, s390 49@cindex @samp{-mzarch} option, s390 50@item -mesa | -mzarch 51Select the architecture mode, either the Enterprise System Architecture 52(esa) mode or the z/Architecture mode (zarch). 53 54The 64-bit instructions are only available with the z/Architecture mode. 55The combination of @samp{-m64} and @samp{-mesa} results in a warning 56message. 57 58@cindex @samp{-march=} option, s390 59@item -march=@var{CPU} 60This option specifies the target processor. The following processor names 61are recognized: 62@code{g5}, 63@code{g6}, 64@code{z900}, 65@code{z990}, 66@code{z9-109}, 67@code{z9-ec}, 68@code{z10} and 69@code{z196}. 70Assembling an instruction that is not supported on the target processor 71results in an error message. Do not specify @code{g5} or @code{g6} 72with @samp{-mzarch}. 73 74@cindex @samp{-mregnames} option, s390 75@item -mregnames 76Allow symbolic names for registers. 77 78@cindex @samp{-mno-regnames} option, s390 79@item -mno-regnames 80Do not allow symbolic names for registers. 81 82@cindex @samp{-mwarn-areg-zero} option, s390 83@item -mwarn-areg-zero 84Warn whenever the operand for a base or index register has been specified 85but evaluates to zero. This can indicate the misuse of general purpose 86register 0 as an address register. 87 88@end table 89 90@node s390 Characters 91@section Special Characters 92@cindex line comment character, s390 93@cindex s390 line comment character 94 95@samp{#} is the line comment character. 96 97@node s390 Syntax 98@section Instruction syntax 99@cindex instruction syntax, s390 100@cindex s390 instruction syntax 101 102The assembler syntax closely follows the syntax outlined in 103Enterprise Systems Architecture/390 Principles of Operation (SA22-7201) 104and the z/Architecture Principles of Operation (SA22-7832). 105 106Each instruction has two major parts, the instruction mnemonic 107and the instruction operands. The instruction format varies. 108 109@menu 110* s390 Register:: Register Naming 111* s390 Mnemonics:: Instruction Mnemonics 112* s390 Operands:: Instruction Operands 113* s390 Formats:: Instruction Formats 114* s390 Aliases:: Instruction Aliases 115* s390 Operand Modifier:: Instruction Operand Modifier 116* s390 Instruction Marker:: Instruction Marker 117* s390 Literal Pool Entries:: Literal Pool Entries 118@end menu 119 120@node s390 Register 121@subsection Register naming 122@cindex register naming, s390 123@cindex s390 register naming 124 125The @code{@value{AS}} recognizes a number of predefined symbols for the 126various processor registers. A register specification in one of the 127instruction formats is an unsigned integer between 0 and 15. The specific 128instruction and the position of the register in the instruction format 129denotes the type of the register. The register symbols are prefixed with 130@samp{%}: 131 132@display 133@multitable {%rN} {the 16 general purpose registers, 0 <= N <= 15} 134@item %rN @tab the 16 general purpose registers, 0 <= N <= 15 135@item %fN @tab the 16 floating point registers, 0 <= N <= 15 136@item %aN @tab the 16 access registers, 0 <= N <= 15 137@item %cN @tab the 16 control registers, 0 <= N <= 15 138@item %lit @tab an alias for the general purpose register %r13 139@item %sp @tab an alias for the general purpose register %r15 140@end multitable 141@end display 142 143@node s390 Mnemonics 144@subsection Instruction Mnemonics 145@cindex instruction mnemonics, s390 146@cindex s390 instruction mnemonics 147 148All instructions documented in the Principles of Operation are supported 149with the mnemonic and order of operands as described. 150The instruction mnemonic identifies the instruction format 151(@ref{s390 Formats}) and the specific operation code for the instruction. 152For example, the @samp{lr} mnemonic denotes the instruction format @samp{RR} 153with the operation code @samp{0x18}. 154 155The definition of the various mnemonics follows a scheme, where the first 156character usually hint at the type of the instruction: 157 158@display 159@multitable {sla, sll} {if r is the last character the instruction operates on registers} 160@item a @tab add instruction, for example @samp{al} for add logical 32-bit 161@item b @tab branch instruction, for example @samp{bc} for branch on condition 162@item c @tab compare or convert instruction, for example @samp{cr} for compare 163register 32-bit 164@item d @tab divide instruction, for example @samp{dlr} devide logical register 16564-bit to 32-bit 166@item i @tab insert instruction, for example @samp{ic} insert character 167@item l @tab load instruction, for example @samp{ltr} load and test register 168@item mv @tab move instruction, for example @samp{mvc} move character 169@item m @tab multiply instruction, for example @samp{mh} multiply halfword 170@item n @tab and instruction, for example @samp{ni} and immediate 171@item o @tab or instruction, for example @samp{oc} or character 172@item sla, sll @tab shift left single instruction 173@item sra, srl @tab shift right single instruction 174@item st @tab store instruction, for example @samp{stm} store multiple 175@item s @tab subtract instruction, for example @samp{slr} subtract 176logical 32-bit 177@item t @tab test or translate instruction, of example @samp{tm} test under mask 178@item x @tab exclusive or instruction, for example @samp{xc} exclusive or 179character 180@end multitable 181@end display 182 183Certain characters at the end of the mnemonic may describe a property 184of the instruction: 185 186@display 187@multitable {c} {if r is the last character the instruction operates on registers} 188@item c @tab the instruction uses a 8-bit character operand 189@item f @tab the instruction extends a 32-bit operand to 64 bit 190@item g @tab the operands are treated as 64-bit values 191@item h @tab the operand uses a 16-bit halfword operand 192@item i @tab the instruction uses an immediate operand 193@item l @tab the instruction uses unsigned, logical operands 194@item m @tab the instruction uses a mask or operates on multiple values 195@item r @tab if r is the last character, the instruction operates on registers 196@item y @tab the instruction uses 20-bit displacements 197@end multitable 198@end display 199 200There are many exceptions to the scheme outlined in the above lists, in 201particular for the priviledged instructions. For non-priviledged 202instruction it works quite well, for example the instruction @samp{clgfr} 203c: compare instruction, l: unsigned operands, g: 64-bit operands, 204f: 32- to 64-bit extension, r: register operands. The instruction compares 205an 64-bit value in a register with the zero extended 32-bit value from 206a second register. 207For a complete list of all mnemonics see appendix B in the Principles 208of Operation. 209 210@node s390 Operands 211@subsection Instruction Operands 212@cindex instruction operands, s390 213@cindex s390 instruction operands 214 215Instruction operands can be grouped into three classes, operands located 216in registers, immediate operands, and operands in storage. 217 218A register operand can be located in general, floating-point, access, 219or control register. The register is identified by a four-bit field. 220The field containing the register operand is called the R field. 221 222Immediate operands are contained within the instruction and can have 2238, 16 or 32 bits. The field containing the immediate operand is called 224the I field. Dependent on the instruction the I field is either signed 225or unsigned. 226 227A storage operand consists of an address and a length. The address of a 228storage operands can be specified in any of these ways: 229 230@itemize 231@item The content of a single general R 232@item The sum of the content of a general register called the base 233register B plus the content of a displacement field D 234@item The sum of the contents of two general registers called the 235index register X and the base register B plus the content of a 236displacement field 237@item The sum of the current instruction address and a 32-bit signed 238immediate field multiplied by two. 239@end itemize 240 241The length of a storage operand can be: 242 243@itemize 244@item Implied by the instruction 245@item Specified by a bitmask 246@item Specified by a four-bit or eight-bit length field L 247@item Specified by the content of a general register 248@end itemize 249 250The notation for storage operand addresses formed from multiple fields is 251as follows: 252 253@table @code 254@item Dn(Bn) 255the address for operand number n is formed from the content of general 256register Bn called the base register and the displacement field Dn. 257@item Dn(Xn,Bn) 258the address for operand number n is formed from the content of general 259register Xn called the index register, general register Bn called the 260base register and the displacement field Dn. 261@item Dn(Ln,Bn) 262the address for operand number n is formed from the content of general 263regiser Bn called the base register and the displacement field Dn. 264The length of the operand n is specified by the field Ln. 265@end table 266 267The base registers Bn and the index registers Xn of a storage operand can 268be skipped. If Bn and Xn are skipped, a zero will be stored to the operand 269field. The notation changes as follows: 270 271@display 272@multitable @columnfractions 0.30 0.30 273@headitem full notation @tab short notation 274@item Dn(0,Bn) @tab Dn(Bn) 275@item Dn(0,0) @tab Dn 276@item Dn(0) @tab Dn 277@item Dn(Ln,0) @tab Dn(Ln) 278@end multitable 279@end display 280 281 282@node s390 Formats 283@subsection Instruction Formats 284@cindex instruction formats, s390 285@cindex s390 instruction formats 286 287The Principles of Operation manuals lists 26 instruction formats where 288some of the formats have multiple variants. For the @samp{.insn} 289pseudo directive the assembler recognizes some of the formats. 290Typically, the most general variant of the instruction format is used 291by the @samp{.insn} directive. 292 293The following table lists the abbreviations used in the table of 294instruction formats: 295 296@display 297@multitable {OpCode / OpCd} {Displacement lower 12 bits for operand x.} 298@item OpCode / OpCd @tab Part of the op code. 299@item Bx @tab Base register number for operand x. 300@item Dx @tab Displacement for operand x. 301@item DLx @tab Displacement lower 12 bits for operand x. 302@item DHx @tab Displacement higher 8-bits for operand x. 303@item Rx @tab Register number for operand x. 304@item Xx @tab Index register number for operand x. 305@item Ix @tab Signed immediate for operand x. 306@item Ux @tab Unsigned immediate for operand x. 307@end multitable 308@end display 309 310An instruction is two, four, or six bytes in length and must be aligned 311on a 2 byte boundary. The first two bits of the instruction specify the 312length of the instruction, 00 indicates a two byte instruction, 01 and 10 313indicates a four byte instruction, and 11 indicates a six byte instruction. 314 315The following table lists the s390 instruction formats that are available 316with the @samp{.insn} pseudo directive: 317 318@table @code 319@item E format 320@verbatim 321+-------------+ 322| OpCode | 323+-------------+ 3240 15 325@end verbatim 326 327@item RI format: <insn> R1,I2 328@verbatim 329+--------+----+----+------------------+ 330| OpCode | R1 |OpCd| I2 | 331+--------+----+----+------------------+ 3320 8 12 16 31 333@end verbatim 334 335@item RIE format: <insn> R1,R3,I2 336@verbatim 337+--------+----+----+------------------+--------+--------+ 338| OpCode | R1 | R3 | I2 |////////| OpCode | 339+--------+----+----+------------------+--------+--------+ 3400 8 12 16 32 40 47 341@end verbatim 342 343@item RIL format: <insn> R1,I2 344@verbatim 345+--------+----+----+------------------------------------+ 346| OpCode | R1 |OpCd| I2 | 347+--------+----+----+------------------------------------+ 3480 8 12 16 47 349@end verbatim 350 351@item RILU format: <insn> R1,U2 352@verbatim 353+--------+----+----+------------------------------------+ 354| OpCode | R1 |OpCd| U2 | 355+--------+----+----+------------------------------------+ 3560 8 12 16 47 357@end verbatim 358 359@item RIS format: <insn> R1,I2,M3,D4(B4) 360@verbatim 361+--------+----+----+----+-------------+--------+--------+ 362| OpCode | R1 | M3 | B4 | D4 | I2 | Opcode | 363+--------+----+----+----+-------------+--------+--------+ 3640 8 12 16 20 32 36 47 365@end verbatim 366 367@item RR format: <insn> R1,R2 368@verbatim 369+--------+----+----+ 370| OpCode | R1 | R2 | 371+--------+----+----+ 3720 8 12 15 373@end verbatim 374 375@item RRE format: <insn> R1,R2 376@verbatim 377+------------------+--------+----+----+ 378| OpCode |////////| R1 | R2 | 379+------------------+--------+----+----+ 3800 16 24 28 31 381@end verbatim 382 383@item RRF format: <insn> R1,R2,R3,M4 384@verbatim 385+------------------+----+----+----+----+ 386| OpCode | R3 | M4 | R1 | R2 | 387+------------------+----+----+----+----+ 3880 16 20 24 28 31 389@end verbatim 390 391@item RRS format: <insn> R1,R2,M3,D4(B4) 392@verbatim 393+--------+----+----+----+-------------+----+----+--------+ 394| OpCode | R1 | R3 | B4 | D4 | M3 |////| OpCode | 395+--------+----+----+----+-------------+----+----+--------+ 3960 8 12 16 20 32 36 40 47 397@end verbatim 398 399@item RS format: <insn> R1,R3,D2(B2) 400@verbatim 401+--------+----+----+----+-------------+ 402| OpCode | R1 | R3 | B2 | D2 | 403+--------+----+----+----+-------------+ 4040 8 12 16 20 31 405@end verbatim 406 407@item RSE format: <insn> R1,R3,D2(B2) 408@verbatim 409+--------+----+----+----+-------------+--------+--------+ 410| OpCode | R1 | R3 | B2 | D2 |////////| OpCode | 411+--------+----+----+----+-------------+--------+--------+ 4120 8 12 16 20 32 40 47 413@end verbatim 414 415@item RSI format: <insn> R1,R3,I2 416@verbatim 417+--------+----+----+------------------------------------+ 418| OpCode | R1 | R3 | I2 | 419+--------+----+----+------------------------------------+ 4200 8 12 16 47 421@end verbatim 422 423@item RSY format: <insn> R1,R3,D2(B2) 424@verbatim 425+--------+----+----+----+-------------+--------+--------+ 426| OpCode | R1 | R3 | B2 | DL2 | DH2 | OpCode | 427+--------+----+----+----+-------------+--------+--------+ 4280 8 12 16 20 32 40 47 429@end verbatim 430 431@item RX format: <insn> R1,D2(X2,B2) 432@verbatim 433+--------+----+----+----+-------------+ 434| OpCode | R1 | X2 | B2 | D2 | 435+--------+----+----+----+-------------+ 4360 8 12 16 20 31 437@end verbatim 438 439@item RXE format: <insn> R1,D2(X2,B2) 440@verbatim 441+--------+----+----+----+-------------+--------+--------+ 442| OpCode | R1 | X2 | B2 | D2 |////////| OpCode | 443+--------+----+----+----+-------------+--------+--------+ 4440 8 12 16 20 32 40 47 445@end verbatim 446 447@item RXF format: <insn> R1,R3,D2(X2,B2) 448@verbatim 449+--------+----+----+----+-------------+----+---+--------+ 450| OpCode | R3 | X2 | B2 | D2 | R1 |///| OpCode | 451+--------+----+----+----+-------------+----+---+--------+ 4520 8 12 16 20 32 36 40 47 453@end verbatim 454 455@item RXY format: <insn> R1,D2(X2,B2) 456@verbatim 457+--------+----+----+----+-------------+--------+--------+ 458| OpCode | R1 | X2 | B2 | DL2 | DH2 | OpCode | 459+--------+----+----+----+-------------+--------+--------+ 4600 8 12 16 20 32 36 40 47 461@end verbatim 462 463@item S format: <insn> D2(B2) 464@verbatim 465+------------------+----+-------------+ 466| OpCode | B2 | D2 | 467+------------------+----+-------------+ 4680 16 20 31 469@end verbatim 470 471@item SI format: <insn> D1(B1),I2 472@verbatim 473+--------+---------+----+-------------+ 474| OpCode | I2 | B1 | D1 | 475+--------+---------+----+-------------+ 4760 8 16 20 31 477@end verbatim 478 479@item SIY format: <insn> D1(B1),U2 480@verbatim 481+--------+---------+----+-------------+--------+--------+ 482| OpCode | I2 | B1 | DL1 | DH1 | OpCode | 483+--------+---------+----+-------------+--------+--------+ 4840 8 16 20 32 36 40 47 485@end verbatim 486 487@item SIL format: <insn> D1(B1),I2 488@verbatim 489+------------------+----+-------------+-----------------+ 490| OpCode | B1 | D1 | I2 | 491+------------------+----+-------------+-----------------+ 4920 16 20 32 47 493@end verbatim 494 495@item SS format: <insn> D1(R1,B1),D2(B3),R3 496@verbatim 497+--------+----+----+----+-------------+----+------------+ 498| OpCode | R1 | R3 | B1 | D1 | B2 | D2 | 499+--------+----+----+----+-------------+----+------------+ 5000 8 12 16 20 32 36 47 501@end verbatim 502 503@item SSE format: <insn> D1(B1),D2(B2) 504@verbatim 505+------------------+----+-------------+----+------------+ 506| OpCode | B1 | D1 | B2 | D2 | 507+------------------+----+-------------+----+------------+ 5080 8 12 16 20 32 36 47 509@end verbatim 510 511@item SSF format: <insn> D1(B1),D2(B2),R3 512@verbatim 513+--------+----+----+----+-------------+----+------------+ 514| OpCode | R3 |OpCd| B1 | D1 | B2 | D2 | 515+--------+----+----+----+-------------+----+------------+ 5160 8 12 16 20 32 36 47 517@end verbatim 518 519@end table 520 521For the complete list of all instruction format variants see the 522Principles of Operation manuals. 523 524@node s390 Aliases 525@subsection Instruction Aliases 526@cindex instruction aliases, s390 527@cindex s390 instruction aliases 528 529A specific bit pattern can have multiple mnemonics, for example 530the bit pattern @samp{0xa7000000} has the mnemonics @samp{tmh} and 531@samp{tmlh}. In addition, there are a number of mnemonics recognized by 532@code{@value{AS}} that are not present in the Principles of Operation. 533These are the short forms of the branch instructions, where the condition 534code mask operand is encoded in the mnemonic. This is relevant for the 535branch instructions, the compare and branch instructions, and the 536compare and trap instructions. 537 538For the branch instructions there are 20 condition code strings that can 539be used as part of the mnemonic in place of a mask operand in the instruction 540format: 541 542@display 543@multitable @columnfractions .30 .30 544@headitem instruction @tab short form 545@item bcr M1,R2 @tab b<m>r R2 546@item bc M1,D2(X2,B2) @tab b<m> D2(X2,B2) 547@item brc M1,I2 @tab j<m> I2 548@item brcl M1,I2 @tab jg<m> I2 549@end multitable 550@end display 551 552In the mnemonic for a branch instruction the condition code string <m> 553can be any of the following: 554 555@display 556@multitable {nle} {jump on not zero / if not zeros} 557@item o @tab jump on overflow / if ones 558@item h @tab jump on A high 559@item p @tab jump on plus 560@item nle @tab jump on not low or equal 561@item l @tab jump on A low 562@item m @tab jump on minus 563@item nhe @tab jump on not high or equal 564@item lh @tab jump on low or high 565@item ne @tab jump on A not equal B 566@item nz @tab jump on not zero / if not zeros 567@item e @tab jump on A equal B 568@item z @tab jump on zero / if zeroes 569@item nlh @tab jump on not low or high 570@item he @tab jump on high or equal 571@item nl @tab jump on A not low 572@item nm @tab jump on not minus / if not mixed 573@item le @tab jump on low or equal 574@item nh @tab jump on A not high 575@item np @tab jump on not plus 576@item no @tab jump on not overflow / if not ones 577@end multitable 578@end display 579 580For the compare and branch, and compare and trap instructions there 581are 12 condition code strings that can be used as part of the mnemonic in 582place of a mask operand in the instruction format: 583 584@display 585@multitable @columnfractions .40 .40 586@headitem instruction @tab short form 587@item crb R1,R2,M3,D4(B4) @tab crb<m> R1,R2,D4(B4) 588@item cgrb R1,R2,M3,D4(B4) @tab cgrb<m> R1,R2,D4(B4) 589@item crj R1,R2,M3,I4 @tab crj<m> R1,R2,I4 590@item cgrj R1,R2,M3,I4 @tab cgrj<m> R1,R2,I4 591@item cib R1,I2,M3,D4(B4) @tab cib<m> R1,I2,D4(B4) 592@item cgib R1,I2,M3,D4(B4) @tab cgib<m> R1,I2,D4(B4) 593@item cij R1,I2,M3,I4 @tab cij<m> R1,I2,I4 594@item cgij R1,I2,M3,I4 @tab cgij<m> R1,I2,I4 595@item crt R1,R2,M3 @tab crt<m> R1,R2 596@item cgrt R1,R2,M3 @tab cgrt<m> R1,R2 597@item cit R1,I2,M3 @tab cit<m> R1,I2 598@item cgit R1,I2,M3 @tab cgit<m> R1,I2 599@item clrb R1,R2,M3,D4(B4) @tab clrb<m> R1,R2,D4(B4) 600@item clgrb R1,R2,M3,D4(B4) @tab clgrb<m> R1,R2,D4(B4) 601@item clrj R1,R2,M3,I4 @tab clrj<m> R1,R2,I4 602@item clgrj R1,R2,M3,I4 @tab clgrj<m> R1,R2,I4 603@item clib R1,I2,M3,D4(B4) @tab clib<m> R1,I2,D4(B4) 604@item clgib R1,I2,M3,D4(B4) @tab clgib<m> R1,I2,D4(B4) 605@item clij R1,I2,M3,I4 @tab clij<m> R1,I2,I4 606@item clgij R1,I2,M3,I4 @tab clgij<m> R1,I2,I4 607@item clrt R1,R2,M3 @tab clrt<m> R1,R2 608@item clgrt R1,R2,M3 @tab clgrt<m> R1,R2 609@item clfit R1,I2,M3 @tab clfit<m> R1,I2 610@item clgit R1,I2,M3 @tab clgit<m> R1,I2 611@end multitable 612@end display 613 614In the mnemonic for a compare and branch and compare and trap instruction 615the condition code string <m> can be any of the following: 616 617@display 618@multitable {nle} {jump on not zero / if not zeros} 619@item h @tab jump on A high 620@item nle @tab jump on not low or equal 621@item l @tab jump on A low 622@item nhe @tab jump on not high or equal 623@item ne @tab jump on A not equal B 624@item lh @tab jump on low or high 625@item e @tab jump on A equal B 626@item nlh @tab jump on not low or high 627@item nl @tab jump on A not low 628@item he @tab jump on high or equal 629@item nh @tab jump on A not high 630@item le @tab jump on low or equal 631@end multitable 632@end display 633 634@node s390 Operand Modifier 635@subsection Instruction Operand Modifier 636@cindex instruction operand modifier, s390 637@cindex s390 instruction operand modifier 638 639If a symbol modifier is attached to a symbol in an expression for an 640instruction operand field, the symbol term is replaced with a reference 641to an object in the global offset table (GOT) or the procedure linkage 642table (PLT). The following expressions are allowed: 643@samp{symbol@@modifier + constant}, 644@samp{symbol@@modifier + label + constant}, and 645@samp{symbol@@modifier - label + constant}. 646The term @samp{symbol} is the symbol that will be entered into the GOT or 647PLT, @samp{label} is a local label, and @samp{constant} is an arbitrary 648expression that the assembler can evaluate to a constant value. 649 650The term @samp{(symbol + constant1)@@modifier +/- label + constant2} 651is also accepted but a warning message is printed and the term is 652converted to @samp{symbol@@modifier +/- label + constant1 + constant2}. 653 654@table @code 655@item @@got 656@itemx @@got12 657The @@got modifier can be used for displacement fields, 16-bit immediate 658fields and 32-bit pc-relative immediate fields. The @@got12 modifier is 659synonym to @@got. The symbol is added to the GOT. For displacement 660fields and 16-bit immediate fields the symbol term is replaced with 661the offset from the start of the GOT to the GOT slot for the symbol. 662For a 32-bit pc-relative field the pc-relative offset to the GOT 663slot from the current instruction address is used. 664@item @@gotent 665The @@gotent modifier can be used for 32-bit pc-relative immediate fields. 666The symbol is added to the GOT and the symbol term is replaced with 667the pc-relative offset from the current instruction to the GOT slot for the 668symbol. 669@item @@gotoff 670The @@gotoff modifier can be used for 16-bit immediate fields. The symbol 671term is replaced with the offset from the start of the GOT to the 672address of the symbol. 673@item @@gotplt 674The @@gotplt modifier can be used for displacement fields, 16-bit immediate 675fields, and 32-bit pc-relative immediate fields. A procedure linkage 676table entry is generated for the symbol and a jump slot for the symbol 677is added to the GOT. For displacement fields and 16-bit immediate 678fields the symbol term is replaced with the offset from the start of the 679GOT to the jump slot for the symbol. For a 32-bit pc-relative field 680the pc-relative offset to the jump slot from the current instruction 681address is used. 682@item @@plt 683The @@plt modifier can be used for 16-bit and 32-bit pc-relative immediate 684fields. A procedure linkage table entry is generated for the symbol. 685The symbol term is replaced with the relative offset from the current 686instruction to the PLT entry for the symbol. 687@item @@pltoff 688The @@pltoff modifier can be used for 16-bit immediate fields. The symbol 689term is replaced with the offset from the start of the PLT to the address 690of the symbol. 691@item @@gotntpoff 692The @@gotntpoff modifier can be used for displacement fields. The symbol 693is added to the static TLS block and the negated offset to the symbol 694in the static TLS block is added to the GOT. The symbol term is replaced 695with the offset to the GOT slot from the start of the GOT. 696@item @@indntpoff 697The @@indntpoff modifier can be used for 32-bit pc-relative immediate 698fields. The symbol is added to the static TLS block and the negated offset 699to the symbol in the static TLS block is added to the GOT. The symbol term 700is replaced with the pc-relative offset to the GOT slot from the current 701instruction address. 702@end table 703 704For more information about the thread local storage modifiers 705@samp{gotntpoff} and @samp{indntpoff} see the ELF extension documentation 706@samp{ELF Handling For Thread-Local Storage}. 707 708@node s390 Instruction Marker 709@subsection Instruction Marker 710@cindex instruction marker, s390 711@cindex s390 instruction marker 712 713The thread local storage instruction markers are used by the linker to 714perform code optimization. 715 716@table @code 717@item :tls_load 718The :tls_load marker is used to flag the load instruction in the initial 719exec TLS model that retrieves the offset from the thread pointer to a 720thread local storage variable from the GOT. 721@item :tls_gdcall 722The :tls_gdcall marker is used to flag the branch-and-save instruction to 723the __tls_get_offset function in the global dynamic TLS model. 724@item :tls_ldcall 725The :tls_ldcall marker is used to flag the branch-and-save instruction to 726the __tls_get_offset function in the local dynamic TLS model. 727@end table 728 729For more information about the thread local storage instruction marker 730and the linker optimizations see the ELF extension documentation 731@samp{ELF Handling For Thread-Local Storage}. 732 733@node s390 Literal Pool Entries 734@subsection Literal Pool Entries 735@cindex literal pool entries, s390 736@cindex s390 literal pool entries 737 738A literal pool is a collection of values. To access the values a pointer 739to the literal pool is loaded to a register, the literal pool register. 740Usually, register %r13 is used as the literal pool register 741(@ref{s390 Register}). Literal pool entries are created by adding the 742suffix :lit1, :lit2, :lit4, or :lit8 to the end of an expression for an 743instruction operand. The expression is added to the literal pool and the 744operand is replaced with the offset to the literal in the literal pool. 745 746@table @code 747@item :lit1 748The literal pool entry is created as an 8-bit value. An operand modifier 749must not be used for the original expression. 750@item :lit2 751The literal pool entry is created as a 16 bit value. The operand modifier 752@@got may be used in the original expression. The term @samp{x@@got:lit2} 753will put the got offset for the global symbol x to the literal pool as 75416 bit value. 755@item :lit4 756The literal pool entry is created as a 32-bit value. The operand modifier 757@@got and @@plt may be used in the original expression. The term 758@samp{x@@got:lit4} will put the got offset for the global symbol x to the 759literal pool as a 32-bit value. The term @samp{x@@plt:lit4} will put the 760plt offset for the global symbol x to the literal pool as a 32-bit value. 761@item :lit8 762The literal pool entry is created as a 64-bit value. The operand modifier 763@@got and @@plt may be used in the original expression. The term 764@samp{x@@got:lit8} will put the got offset for the global symbol x to the 765literal pool as a 64-bit value. The term @samp{x@@plt:lit8} will put the 766plt offset for the global symbol x to the literal pool as a 64-bit value. 767@end table 768 769The assembler directive @samp{.ltorg} is used to emit all literal pool 770entries to the current position. 771 772@node s390 Directives 773@section Assembler Directives 774 775@code{@value{AS}} for s390 supports all of the standard ELF 776assembler directives as outlined in the main part of this document. 777Some directives have been extended and there are some additional 778directives, which are only available for the s390 @code{@value{AS}}. 779 780@table @code 781@cindex @code{.insn} directive, s390 782@item .insn 783This directive permits the numeric representation of an instructions 784and makes the assembler insert the operands according to one of the 785instructions formats for @samp{.insn} (@ref{s390 Formats}). 786For example, the instruction @samp{l %r1,24(%r15)} could be written as 787@samp{.insn rx,0x58000000,%r1,24(%r15)}. 788@cindex @code{.short} directive, s390 789@cindex @code{.long} directive, s390 790@cindex @code{.quad} directive, s390 791@item .short 792@itemx .long 793@itemx .quad 794This directive places one or more 16-bit (.short), 32-bit (.long), or 79564-bit (.quad) values into the current section. If an ELF or TLS modifier 796is used only the following expressions are allowed: 797@samp{symbol@@modifier + constant}, 798@samp{symbol@@modifier + label + constant}, and 799@samp{symbol@@modifier - label + constant}. 800The following modifiers are available: 801@table @code 802@item @@got 803@itemx @@got12 804The @@got modifier can be used for .short, .long and .quad. The @@got12 805modifier is synonym to @@got. The symbol is added to the GOT. The symbol 806term is replaced with offset from the start of the GOT to the GOT slot for 807the symbol. 808@item @@gotoff 809The @@gotoff modifier can be used for .short, .long and .quad. The symbol 810term is replaced with the offset from the start of the GOT to the address 811of the symbol. 812@item @@gotplt 813The @@gotplt modifier can be used for .long and .quad. A procedure linkage 814table entry is generated for the symbol and a jump slot for the symbol 815is added to the GOT. The symbol term is replaced with the offset from the 816start of the GOT to the jump slot for the symbol. 817@item @@plt 818The @@plt modifier can be used for .long and .quad. A procedure linkage 819table entry us generated for the symbol. The symbol term is replaced with 820the address of the PLT entry for the symbol. 821@item @@pltoff 822The @@pltoff modifier can be used for .short, .long and .quad. The symbol 823term is replaced with the offset from the start of the PLT to the address 824of the symbol. 825@item @@tlsgd 826@itemx @@tlsldm 827The @@tlsgd and @@tlsldm modifier can be used for .long and .quad. A 828tls_index structure for the symbol is added to the GOT. The symbol term is 829replaced with the offset from the start of the GOT to the tls_index structure. 830@item @@gotntpoff 831@itemx @@indntpoff 832The @@gotntpoff and @@indntpoff modifier can be used for .long and .quad. 833The symbol is added to the static TLS block and the negated offset to the 834symbol in the static TLS block is added to the GOT. For @@gotntpoff the 835symbol term is replaced with the offset from the start of the GOT to the 836GOT slot, for @@indntpoff the symbol term is replaced with the address 837of the GOT slot. 838@item @@dtpoff 839The @@dtpoff modifier can be used for .long and .quad. The symbol term 840is replaced with the offset of the symbol relative to the start of the 841TLS block it is contained in. 842@item @@ntpoff 843The @@ntpoff modifier can be used for .long and .quad. The symbol term 844is replaced with the offset of the symbol relative to the TCB pointer. 845@end table 846 847For more information about the thread local storage modifiers see the 848ELF extension documentation @samp{ELF Handling For Thread-Local Storage}. 849 850@cindex @code{.ltorg} directive, s390 851@item .ltorg 852This directive causes the current contents of the literal pool to be 853dumped to the current location (@ref{s390 Literal Pool Entries}). 854 855@cindex @code{.machine} directive, s390 856@item .machine string 857This directive allows you to change the machine for which code is 858generated. @code{string} may be any of the @code{-march=} selection 859options (without the -march=), @code{push}, or @code{pop}. 860@code{.machine push} saves the currently selected cpu, which may be 861restored with @code{.machine pop}. Be aware that the cpu string has 862to be put into double quotes in case it contains characters not 863appropriate for identifiers. So you have to write @code{"z9-109"} 864instead of just @code{z9-109}. 865@end table 866 867@node s390 Floating Point 868@section Floating Point 869@cindex floating point, s390 870@cindex s390 floating point 871 872The assembler recognizes both the @sc{ieee} floating-point instruction and 873the hexadecimal floating-point instructions. The floating-point constructors 874@samp{.float}, @samp{.single}, and @samp{.double} always emit the 875@sc{ieee} format. To assemble hexadecimal floating-point constants the 876@samp{.long} and @samp{.quad} directives must be used. 877