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