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.
7 @chapter IBM S/390 Dependent Features
10 @node Machine Dependencies
11 @chapter IBM S/390 Dependent Features
16 The s390 version of @code{@value{AS}} supports two architectures modes
17 and eleven chip levels. The architecture modes are the Enterprise System
18 Architecture (ESA) and the newer z/Architecture mode. The chip levels
19 are 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), z16 (or arch14), or arch15.
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.
33 @cindex options for s390
36 The following table lists all available s390 specific options:
39 @cindex @samp{-m31} option, s390
40 @cindex @samp{-m64} option, s390
42 Select 31- or 64-bit ABI implying a word size of 32- or 64-bit.
44 These options are only available with the ELF object file format, and
45 require that the necessary BFD support has been included (on a 31-bit
46 platform you must add --enable-64-bit-bfd on the call to the configure
47 script to enable 64-bit usage and use s390x as target platform).
49 @cindex @samp{-mesa} option, s390
50 @cindex @samp{-mzarch} option, s390
52 Select the architecture mode, either the Enterprise System Architecture
53 (esa) mode or the z/Architecture mode (zarch).
55 The 64-bit instructions are only available with the z/Architecture mode.
56 The combination of @samp{-m64} and @samp{-mesa} results in a warning
59 @cindex @samp{-march=} option, s390
60 @item -march=@var{CPU}
61 This option specifies the target processor. The following processor names
63 @code{g5} (or @code{arch3}),
65 @code{z900} (or @code{arch5}),
66 @code{z990} (or @code{arch6}),
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}),
75 @code{z16} (or @code{arch14}), and
78 Assembling an instruction that is not supported on the target
79 processor results in an error message.
81 The processor names starting with @code{arch} refer to the edition
82 number in the Principle of Operations manual. They can be used as
83 alternate processor names and have been added for compatibility with
86 @code{arch3}, @code{g5} and @code{g6} cannot be used with the
87 @samp{-mzarch} option since the z/Architecture mode is not supported
88 on these processor levels.
90 There is no @code{arch4} option supported. @code{arch4} matches
91 @code{-march=arch5 -mesa}.
93 @cindex @samp{-mregnames} option, s390
95 Allow symbolic names for registers.
97 @cindex @samp{-mno-regnames} option, s390
99 Do not allow symbolic names for registers.
101 @cindex @samp{-mwarn-areg-zero} option, s390
102 @item -mwarn-areg-zero
103 Warn whenever the operand for a base or index register has been specified
104 but evaluates to zero. This can indicate the misuse of general purpose
105 register 0 as an address register.
109 @node s390 Characters
110 @section Special Characters
111 @cindex line comment character, s390
112 @cindex s390 line comment character
114 @samp{#} is the line comment character.
116 If a @samp{#} appears as the first character of a line then the whole
117 line is treated as a comment, but in this case the line could also be
118 a logical line number directive (@pxref{Comments}) or a preprocessor
119 control command (@pxref{Preprocessing}).
121 @cindex line separator, s390
122 @cindex statement separator, s390
123 @cindex s390 line separator
124 The @samp{;} character can be used instead of a newline to separate
128 @section Instruction syntax
129 @cindex instruction syntax, s390
130 @cindex s390 instruction syntax
132 The assembler syntax closely follows the syntax outlined in
133 Enterprise Systems Architecture/390 Principles of Operation (SA22-7201)
134 and the z/Architecture Principles of Operation (SA22-7832).
136 Each instruction has two major parts, the instruction mnemonic
137 and the instruction operands. The instruction format varies.
140 * s390 Register:: Register Naming
141 * s390 Mnemonics:: Instruction Mnemonics
142 * s390 Operands:: Instruction Operands
143 * s390 Formats:: Instruction Formats
144 * s390 Aliases:: Instruction Aliases
145 * s390 Operand Modifier:: Instruction Operand Modifier
146 * s390 Instruction Marker:: Instruction Marker
147 * s390 Literal Pool Entries:: Literal Pool Entries
151 @subsection Register naming
152 @cindex register naming, s390
153 @cindex s390 register naming
155 The @code{@value{AS}} recognizes a number of predefined symbols for the
156 various processor registers. A register specification in one of the
157 instruction formats is an unsigned integer between 0 and 15. The specific
158 instruction and the position of the register in the instruction format
159 denotes the type of the register. The register symbols are prefixed with
163 @multitable {%rN} {the 16 general purpose registers, 0 <= N <= 15}
164 @item %rN @tab the 16 general purpose registers, 0 <= N <= 15
165 @item %fN @tab the 16 floating point registers, 0 <= N <= 15
166 @item %aN @tab the 16 access registers, 0 <= N <= 15
167 @item %cN @tab the 16 control registers, 0 <= N <= 15
168 @item %lit @tab an alias for the general purpose register %r13
169 @item %sp @tab an alias for the general purpose register %r15
174 @subsection Instruction Mnemonics
175 @cindex instruction mnemonics, s390
176 @cindex s390 instruction mnemonics
178 All instructions documented in the Principles of Operation are supported
179 with the mnemonic and order of operands as described.
180 The instruction mnemonic identifies the instruction format
181 (@ref{s390 Formats}) and the specific operation code for the instruction.
182 For example, the @samp{lr} mnemonic denotes the instruction format @samp{RR}
183 with the operation code @samp{0x18}.
185 The definition of the various mnemonics follows a scheme, where the first
186 character usually hint at the type of the instruction:
189 @multitable {sla, sll} {if r is the last character the instruction operates on registers}
190 @item a @tab add instruction, for example @samp{al} for add logical 32-bit
191 @item b @tab branch instruction, for example @samp{bc} for branch on condition
192 @item c @tab compare or convert instruction, for example @samp{cr} for compare
194 @item d @tab divide instruction, for example @samp{dlr} divide logical register
196 @item i @tab insert instruction, for example @samp{ic} insert character
197 @item l @tab load instruction, for example @samp{ltr} load and test register
198 @item mv @tab move instruction, for example @samp{mvc} move character
199 @item m @tab multiply instruction, for example @samp{mh} multiply halfword
200 @item n @tab and instruction, for example @samp{ni} and immediate
201 @item o @tab or instruction, for example @samp{oc} or character
202 @item sla, sll @tab shift left single instruction
203 @item sra, srl @tab shift right single instruction
204 @item st @tab store instruction, for example @samp{stm} store multiple
205 @item s @tab subtract instruction, for example @samp{slr} subtract
207 @item t @tab test or translate instruction, of example @samp{tm} test under mask
208 @item x @tab exclusive or instruction, for example @samp{xc} exclusive or
213 Certain characters at the end of the mnemonic may describe a property
217 @multitable {c} {if r is the last character the instruction operates on registers}
218 @item c @tab the instruction uses a 8-bit character operand
219 @item f @tab the instruction extends a 32-bit operand to 64 bit
220 @item g @tab the operands are treated as 64-bit values
221 @item h @tab the operand uses a 16-bit halfword operand
222 @item i @tab the instruction uses an immediate operand
223 @item l @tab the instruction uses unsigned, logical operands
224 @item m @tab the instruction uses a mask or operates on multiple values
225 @item r @tab if r is the last character, the instruction operates on registers
226 @item y @tab the instruction uses 20-bit displacements
230 There are many exceptions to the scheme outlined in the above lists, in
231 particular for the privileged instructions. For non-privileged
232 instruction it works quite well, for example the instruction @samp{clgfr}
233 c: compare instruction, l: unsigned operands, g: 64-bit operands,
234 f: 32- to 64-bit extension, r: register operands. The instruction compares
235 an 64-bit value in a register with the zero extended 32-bit value from
237 For a complete list of all mnemonics see appendix B in the Principles
241 @subsection Instruction Operands
242 @cindex instruction operands, s390
243 @cindex s390 instruction operands
245 Instruction operands can be grouped into three classes, operands located
246 in registers, immediate operands, and operands in storage.
248 A register operand can be located in general, floating-point, access,
249 or control register. The register is identified by a four-bit field.
250 The field containing the register operand is called the R field.
252 Immediate operands are contained within the instruction and can have
253 8, 16 or 32 bits. The field containing the immediate operand is called
254 the I field. Dependent on the instruction the I field is either signed
257 A storage operand consists of an address and a length. The address of a
258 storage operands can be specified in any of these ways:
261 @item The content of a single general R
262 @item The sum of the content of a general register called the base
263 register B plus the content of a displacement field D
264 @item The sum of the contents of two general registers called the
265 index register X and the base register B plus the content of a
267 @item The sum of the current instruction address and a 32-bit signed
268 immediate field multiplied by two.
271 The length of a storage operand can be:
274 @item Implied by the instruction
275 @item Specified by a bitmask
276 @item Specified by a four-bit or eight-bit length field L
277 @item Specified by the content of a general register
280 The notation for storage operand addresses formed from multiple fields is
285 the address for operand number n is formed from the content of general
286 register Bn called the base register and the displacement field Dn.
288 the address for operand number n is formed from the content of general
289 register Xn called the index register, general register Bn called the
290 base register and the displacement field Dn.
292 the address for operand number n is formed from the content of general
293 register Bn called the base register and the displacement field Dn.
294 The length of the operand n is specified by the field Ln.
297 The base registers Bn and the index registers Xn of a storage operand can
298 be skipped. If Bn and Xn are skipped, a zero will be stored to the operand
299 field. The notation changes as follows:
302 @multitable @columnfractions 0.30 0.30
303 @headitem full notation @tab short notation
304 @item Dn(Xn,0) @tab Dn(Xn,)
305 @item Dn(0,Bn) @tab Dn(,Bn) or Dn(Bn)
306 @item Dn(0,0) @tab Dn
308 @item Dn(Ln,0) @tab Dn(Ln,) or Dn(Ln)
314 @subsection Instruction Formats
315 @cindex instruction formats, s390
316 @cindex s390 instruction formats
318 The Principles of Operation manuals lists 35 instruction formats where
319 some of the formats have multiple variants. For the @samp{.insn}
320 pseudo directive the assembler recognizes some of the formats.
321 Typically, the most general variant of the instruction format is used
322 by the @samp{.insn} directive.
324 The following table lists the abbreviations used in the table of
328 @multitable {OpCode / OpCd} {Displacement lower 12 bits for operand x.}
329 @item OpCode / OpCd @tab Part of the op code.
330 @item Bx @tab Base register number for operand x.
331 @item Dx @tab Displacement for operand x.
332 @item DLx @tab Displacement lower 12 bits for operand x.
333 @item DHx @tab Displacement higher 8-bits for operand x.
334 @item Rx @tab Register number for operand x.
335 @item Xx @tab Index register number for operand x.
336 @item Ix @tab Signed immediate for operand x.
337 @item Ux @tab Unsigned immediate for operand x.
341 An instruction is two, four, or six bytes in length and must be aligned
342 on a 2 byte boundary. The first two bits of the instruction specify the
343 length of the instruction, 00 indicates a two byte instruction, 01 and 10
344 indicates a four byte instruction, and 11 indicates a six byte instruction.
346 The following table lists the s390 instruction formats that are available
347 with the @samp{.insn} pseudo directive:
358 @item RI format: <insn> R1,I2
360 +--------+----+----+------------------+
361 | OpCode | R1 |OpCd| I2 |
362 +--------+----+----+------------------+
366 @item RIE format: <insn> R1,R3,I2
368 +--------+----+----+------------------+--------+--------+
369 | OpCode | R1 | R3 | I2 |////////| OpCode |
370 +--------+----+----+------------------+--------+--------+
374 @item RIL format: <insn> R1,I2
376 +--------+----+----+------------------------------------+
377 | OpCode | R1 |OpCd| I2 |
378 +--------+----+----+------------------------------------+
382 @item RILU format: <insn> R1,U2
384 +--------+----+----+------------------------------------+
385 | OpCode | R1 |OpCd| U2 |
386 +--------+----+----+------------------------------------+
390 @item RIS format: <insn> R1,I2,M3,D4(B4)
392 +--------+----+----+----+-------------+--------+--------+
393 | OpCode | R1 | M3 | B4 | D4 | I2 | Opcode |
394 +--------+----+----+----+-------------+--------+--------+
395 0 8 12 16 20 32 36 47
398 @item RR format: <insn> R1,R2
406 @item RRE format: <insn> R1,R2
408 +------------------+--------+----+----+
409 | OpCode |////////| R1 | R2 |
410 +------------------+--------+----+----+
414 @item RRF format: <insn> R1,R2,R3,M4
416 +------------------+----+----+----+----+
417 | OpCode | R3 | M4 | R1 | R2 |
418 +------------------+----+----+----+----+
422 @item RRS format: <insn> R1,R2,M3,D4(B4)
424 +--------+----+----+----+-------------+----+----+--------+
425 | OpCode | R1 | R3 | B4 | D4 | M3 |////| OpCode |
426 +--------+----+----+----+-------------+----+----+--------+
427 0 8 12 16 20 32 36 40 47
430 @item RS format: <insn> R1,R3,D2(B2)
432 +--------+----+----+----+-------------+
433 | OpCode | R1 | R3 | B2 | D2 |
434 +--------+----+----+----+-------------+
438 @item RSE format: <insn> R1,R3,D2(B2)
440 +--------+----+----+----+-------------+--------+--------+
441 | OpCode | R1 | R3 | B2 | D2 |////////| OpCode |
442 +--------+----+----+----+-------------+--------+--------+
443 0 8 12 16 20 32 40 47
446 @item RSI format: <insn> R1,R3,I2
448 +--------+----+----+------------------------------------+
449 | OpCode | R1 | R3 | I2 |
450 +--------+----+----+------------------------------------+
454 @item RSY format: <insn> R1,R3,D2(B2)
456 +--------+----+----+----+-------------+--------+--------+
457 | OpCode | R1 | R3 | B2 | DL2 | DH2 | OpCode |
458 +--------+----+----+----+-------------+--------+--------+
459 0 8 12 16 20 32 40 47
462 @item RX format: <insn> R1,D2(X2,B2)
464 +--------+----+----+----+-------------+
465 | OpCode | R1 | X2 | B2 | D2 |
466 +--------+----+----+----+-------------+
470 @item RXE format: <insn> R1,D2(X2,B2)
472 +--------+----+----+----+-------------+--------+--------+
473 | OpCode | R1 | X2 | B2 | D2 |////////| OpCode |
474 +--------+----+----+----+-------------+--------+--------+
475 0 8 12 16 20 32 40 47
478 @item RXF format: <insn> R1,R3,D2(X2,B2)
480 +--------+----+----+----+-------------+----+---+--------+
481 | OpCode | R3 | X2 | B2 | D2 | R1 |///| OpCode |
482 +--------+----+----+----+-------------+----+---+--------+
483 0 8 12 16 20 32 36 40 47
486 @item RXY format: <insn> R1,D2(X2,B2)
488 +--------+----+----+----+-------------+--------+--------+
489 | OpCode | R1 | X2 | B2 | DL2 | DH2 | OpCode |
490 +--------+----+----+----+-------------+--------+--------+
491 0 8 12 16 20 32 36 40 47
494 @item S format: <insn> D2(B2)
496 +------------------+----+-------------+
498 +------------------+----+-------------+
502 @item SI format: <insn> D1(B1),I2
504 +--------+---------+----+-------------+
505 | OpCode | I2 | B1 | D1 |
506 +--------+---------+----+-------------+
510 @item SIY format: <insn> D1(B1),U2
512 +--------+---------+----+-------------+--------+--------+
513 | OpCode | I2 | B1 | DL1 | DH1 | OpCode |
514 +--------+---------+----+-------------+--------+--------+
515 0 8 16 20 32 36 40 47
518 @item SIL format: <insn> D1(B1),I2
520 +------------------+----+-------------+-----------------+
521 | OpCode | B1 | D1 | I2 |
522 +------------------+----+-------------+-----------------+
526 @item SS format: <insn> D1(R1,B1),D2(B3),R3
528 +--------+----+----+----+-------------+----+------------+
529 | OpCode | R1 | R3 | B1 | D1 | B2 | D2 |
530 +--------+----+----+----+-------------+----+------------+
531 0 8 12 16 20 32 36 47
534 @item SSE format: <insn> D1(B1),D2(B2)
536 +------------------+----+-------------+----+------------+
537 | OpCode | B1 | D1 | B2 | D2 |
538 +------------------+----+-------------+----+------------+
539 0 8 12 16 20 32 36 47
542 @item SSF format: <insn> D1(B1),D2(B2),R3
544 +--------+----+----+----+-------------+----+------------+
545 | OpCode | R3 |OpCd| B1 | D1 | B2 | D2 |
546 +--------+----+----+----+-------------+----+------------+
547 0 8 12 16 20 32 36 47
550 @item VRV format: <insn> V1,D2(V2,B2),M3
552 +--------+----+----+----+-------------+----+------------+
553 | OpCode | V1 | V2 | B2 | D2 | M3 | Opcode |
554 +--------+----+----+----+-------------+----+------------+
555 0 8 12 16 20 32 36 47
558 @item VRI format: <insn> V1,V2,I3,M4,M5
560 +--------+----+----+-------------+----+----+------------+
561 | OpCode | V1 | V2 | I3 | M5 | M4 | Opcode |
562 +--------+----+----+-------------+----+----+------------+
563 0 8 12 16 28 32 36 47
566 @item VRX format: <insn> V1,D2(R2,B2),M3
568 +--------+----+----+----+-------------+----+------------+
569 | OpCode | V1 | R2 | B2 | D2 | M3 | Opcode |
570 +--------+----+----+----+-------------+----+------------+
571 0 8 12 16 20 32 36 47
574 @item VRS format: <insn> R1,V3,D2(B2),M4
576 +--------+----+----+----+-------------+----+------------+
577 | OpCode | R1 | V3 | B2 | D2 | M4 | Opcode |
578 +--------+----+----+----+-------------+----+------------+
579 0 8 12 16 20 32 36 47
582 @item VRR format: <insn> V1,V2,V3,M4,M5,M6
584 +--------+----+----+----+---+----+----+----+------------+
585 | OpCode | V1 | V2 | V3 |///| M6 | M5 | M4 | Opcode |
586 +--------+----+----+----+---+----+----+----+------------+
587 0 8 12 16 24 28 32 36 47
590 @item VSI format: <insn> V1,D2(B2),I3
592 +--------+---------+----+-------------+----+------------+
593 | OpCode | I3 | B2 | D2 | V1 | Opcode |
594 +--------+---------+----+-------------+----+------------+
600 For the complete list of all instruction format variants see the
601 Principles of Operation manuals.
604 @subsection Instruction Aliases
605 @cindex instruction aliases, s390
606 @cindex s390 instruction aliases
608 A specific bit pattern can have multiple mnemonics, for example
609 the bit pattern @samp{0xa7000000} has the mnemonics @samp{tmh} and
610 @samp{tmlh}. In addition, there are a number of mnemonics recognized by
611 @code{@value{AS}} that are not present in the Principles of Operation.
612 These are the short forms of the branch instructions, where the condition
613 code mask operand is encoded in the mnemonic. This is relevant for the
614 branch instructions, the compare and branch instructions, and the
615 compare and trap instructions.
617 For the branch instructions there are 20 condition code strings that can
618 be used as part of the mnemonic in place of a mask operand in the instruction
622 @multitable @columnfractions .30 .30
623 @headitem instruction @tab short form
624 @item bcr M1,R2 @tab b<m>r R2
625 @item bc M1,D2(X2,B2) @tab b<m> D2(X2,B2)
626 @item brc M1,I2 @tab j<m> I2
627 @item brcl M1,I2 @tab jg<m> I2
631 In the mnemonic for a branch instruction the condition code string <m>
632 can be any of the following:
635 @multitable {nle} {jump on not zero / if not zeros}
636 @item o @tab jump on overflow / if ones
637 @item h @tab jump on A high
638 @item p @tab jump on plus
639 @item nle @tab jump on not low or equal
640 @item l @tab jump on A low
641 @item m @tab jump on minus
642 @item nhe @tab jump on not high or equal
643 @item lh @tab jump on low or high
644 @item ne @tab jump on A not equal B
645 @item nz @tab jump on not zero / if not zeros
646 @item e @tab jump on A equal B
647 @item z @tab jump on zero / if zeroes
648 @item nlh @tab jump on not low or high
649 @item he @tab jump on high or equal
650 @item nl @tab jump on A not low
651 @item nm @tab jump on not minus / if not mixed
652 @item le @tab jump on low or equal
653 @item nh @tab jump on A not high
654 @item np @tab jump on not plus
655 @item no @tab jump on not overflow / if not ones
659 For the compare and branch, and compare and trap instructions there
660 are 12 condition code strings that can be used as part of the mnemonic in
661 place of a mask operand in the instruction format:
664 @multitable @columnfractions .40 .40
665 @headitem instruction @tab short form
666 @item crb R1,R2,M3,D4(B4) @tab crb<m> R1,R2,D4(B4)
667 @item cgrb R1,R2,M3,D4(B4) @tab cgrb<m> R1,R2,D4(B4)
668 @item crj R1,R2,M3,I4 @tab crj<m> R1,R2,I4
669 @item cgrj R1,R2,M3,I4 @tab cgrj<m> R1,R2,I4
670 @item cib R1,I2,M3,D4(B4) @tab cib<m> R1,I2,D4(B4)
671 @item cgib R1,I2,M3,D4(B4) @tab cgib<m> R1,I2,D4(B4)
672 @item cij R1,I2,M3,I4 @tab cij<m> R1,I2,I4
673 @item cgij R1,I2,M3,I4 @tab cgij<m> R1,I2,I4
674 @item crt R1,R2,M3 @tab crt<m> R1,R2
675 @item cgrt R1,R2,M3 @tab cgrt<m> R1,R2
676 @item cit R1,I2,M3 @tab cit<m> R1,I2
677 @item cgit R1,I2,M3 @tab cgit<m> R1,I2
678 @item clrb R1,R2,M3,D4(B4) @tab clrb<m> R1,R2,D4(B4)
679 @item clgrb R1,R2,M3,D4(B4) @tab clgrb<m> R1,R2,D4(B4)
680 @item clrj R1,R2,M3,I4 @tab clrj<m> R1,R2,I4
681 @item clgrj R1,R2,M3,I4 @tab clgrj<m> R1,R2,I4
682 @item clib R1,I2,M3,D4(B4) @tab clib<m> R1,I2,D4(B4)
683 @item clgib R1,I2,M3,D4(B4) @tab clgib<m> R1,I2,D4(B4)
684 @item clij R1,I2,M3,I4 @tab clij<m> R1,I2,I4
685 @item clgij R1,I2,M3,I4 @tab clgij<m> R1,I2,I4
686 @item clrt R1,R2,M3 @tab clrt<m> R1,R2
687 @item clgrt R1,R2,M3 @tab clgrt<m> R1,R2
688 @item clfit R1,I2,M3 @tab clfit<m> R1,I2
689 @item clgit R1,I2,M3 @tab clgit<m> R1,I2
693 In the mnemonic for a compare and branch and compare and trap instruction
694 the condition code string <m> can be any of the following:
697 @multitable {nle} {jump on not zero / if not zeros}
698 @item h @tab jump on A high
699 @item nle @tab jump on not low or equal
700 @item l @tab jump on A low
701 @item nhe @tab jump on not high or equal
702 @item ne @tab jump on A not equal B
703 @item lh @tab jump on low or high
704 @item e @tab jump on A equal B
705 @item nlh @tab jump on not low or high
706 @item nl @tab jump on A not low
707 @item he @tab jump on high or equal
708 @item nh @tab jump on A not high
709 @item le @tab jump on low or equal
713 @node s390 Operand Modifier
714 @subsection Instruction Operand Modifier
715 @cindex instruction operand modifier, s390
716 @cindex s390 instruction operand modifier
718 If a symbol modifier is attached to a symbol in an expression for an
719 instruction operand field, the symbol term is replaced with a reference
720 to an object in the global offset table (GOT) or the procedure linkage
721 table (PLT). The following expressions are allowed:
722 @samp{symbol@@modifier + constant},
723 @samp{symbol@@modifier + label + constant}, and
724 @samp{symbol@@modifier - label + constant}.
725 The term @samp{symbol} is the symbol that will be entered into the GOT or
726 PLT, @samp{label} is a local label, and @samp{constant} is an arbitrary
727 expression that the assembler can evaluate to a constant value.
729 The term @samp{(symbol + constant1)@@modifier +/- label + constant2}
730 is also accepted but a warning message is printed and the term is
731 converted to @samp{symbol@@modifier +/- label + constant1 + constant2}.
736 The @@got modifier can be used for displacement fields, 16-bit immediate
737 fields and 32-bit pc-relative immediate fields. The @@got12 modifier is
738 synonym to @@got. The symbol is added to the GOT. For displacement
739 fields and 16-bit immediate fields the symbol term is replaced with
740 the offset from the start of the GOT to the GOT slot for the symbol.
741 For a 32-bit pc-relative field the pc-relative offset to the GOT
742 slot from the current instruction address is used.
744 The @@gotent modifier can be used for 32-bit pc-relative immediate fields.
745 The symbol is added to the GOT and the symbol term is replaced with
746 the pc-relative offset from the current instruction to the GOT slot for the
749 The @@gotoff modifier can be used for 16-bit immediate fields. The symbol
750 term is replaced with the offset from the start of the GOT to the
751 address of the symbol.
753 The @@gotplt modifier can be used for displacement fields, 16-bit immediate
754 fields, and 32-bit pc-relative immediate fields. A procedure linkage
755 table entry is generated for the symbol and a jump slot for the symbol
756 is added to the GOT. For displacement fields and 16-bit immediate
757 fields the symbol term is replaced with the offset from the start of the
758 GOT to the jump slot for the symbol. For a 32-bit pc-relative field
759 the pc-relative offset to the jump slot from the current instruction
762 The @@plt modifier can be used for 16-bit and 32-bit pc-relative immediate
763 fields. A procedure linkage table entry is generated for the symbol.
764 The symbol term is replaced with the relative offset from the current
765 instruction to the PLT entry for the symbol.
767 The @@pltoff modifier can be used for 16-bit immediate fields. The symbol
768 term is replaced with the offset from the start of the PLT to the address
771 The @@gotntpoff modifier can be used for displacement fields. The symbol
772 is added to the static TLS block and the negated offset to the symbol
773 in the static TLS block is added to the GOT. The symbol term is replaced
774 with the offset to the GOT slot from the start of the GOT.
776 The @@indntpoff modifier can be used for 32-bit pc-relative immediate
777 fields. The symbol is added to the static TLS block and the negated offset
778 to the symbol in the static TLS block is added to the GOT. The symbol term
779 is replaced with the pc-relative offset to the GOT slot from the current
783 For more information about the thread local storage modifiers
784 @samp{gotntpoff} and @samp{indntpoff} see the ELF extension documentation
785 @samp{ELF Handling For Thread-Local Storage}.
787 @node s390 Instruction Marker
788 @subsection Instruction Marker
789 @cindex instruction marker, s390
790 @cindex s390 instruction marker
792 The thread local storage instruction markers are used by the linker to
793 perform code optimization.
797 The :tls_load marker is used to flag the load instruction in the initial
798 exec TLS model that retrieves the offset from the thread pointer to a
799 thread local storage variable from the GOT.
801 The :tls_gdcall marker is used to flag the branch-and-save instruction to
802 the __tls_get_offset function in the global dynamic TLS model.
804 The :tls_ldcall marker is used to flag the branch-and-save instruction to
805 the __tls_get_offset function in the local dynamic TLS model.
808 For more information about the thread local storage instruction marker
809 and the linker optimizations see the ELF extension documentation
810 @samp{ELF Handling For Thread-Local Storage}.
812 @node s390 Literal Pool Entries
813 @subsection Literal Pool Entries
814 @cindex literal pool entries, s390
815 @cindex s390 literal pool entries
817 A literal pool is a collection of values. To access the values a pointer
818 to the literal pool is loaded to a register, the literal pool register.
819 Usually, register %r13 is used as the literal pool register
820 (@ref{s390 Register}). Literal pool entries are created by adding the
821 suffix :lit1, :lit2, :lit4, or :lit8 to the end of an expression for an
822 instruction operand. The expression is added to the literal pool and the
823 operand is replaced with the offset to the literal in the literal pool.
827 The literal pool entry is created as an 8-bit value. An operand modifier
828 must not be used for the original expression.
830 The literal pool entry is created as a 16 bit value. The operand modifier
831 @@got may be used in the original expression. The term @samp{x@@got:lit2}
832 will put the got offset for the global symbol x to the literal pool as
835 The literal pool entry is created as a 32-bit value. The operand modifier
836 @@got and @@plt may be used in the original expression. The term
837 @samp{x@@got:lit4} will put the got offset for the global symbol x to the
838 literal pool as a 32-bit value. The term @samp{x@@plt:lit4} will put the
839 plt offset for the global symbol x to the literal pool as a 32-bit value.
841 The literal pool entry is created as a 64-bit value. The operand modifier
842 @@got and @@plt may be used in the original expression. The term
843 @samp{x@@got:lit8} will put the got offset for the global symbol x to the
844 literal pool as a 64-bit value. The term @samp{x@@plt:lit8} will put the
845 plt offset for the global symbol x to the literal pool as a 64-bit value.
848 The assembler directive @samp{.ltorg} is used to emit all literal pool
849 entries to the current position.
851 @node s390 Directives
852 @section Assembler Directives
854 @code{@value{AS}} for s390 supports all of the standard ELF
855 assembler directives as outlined in the main part of this document.
856 Some directives have been extended and there are some additional
857 directives, which are only available for the s390 @code{@value{AS}}.
860 @cindex @code{.insn} directive, s390
862 This directive permits the numeric representation of an instructions
863 and makes the assembler insert the operands according to one of the
864 instructions formats for @samp{.insn} (@ref{s390 Formats}).
865 For example, the instruction @samp{l %r1,24(%r15)} could be written as
866 @samp{.insn rx,0x58000000,%r1,24(%r15)}.
867 @cindex @code{.short} directive, s390
868 @cindex @code{.long} directive, s390
869 @cindex @code{.quad} directive, s390
873 This directive places one or more 16-bit (.short), 32-bit (.long), or
874 64-bit (.quad) values into the current section. If an ELF or TLS modifier
875 is used only the following expressions are allowed:
876 @samp{symbol@@modifier + constant},
877 @samp{symbol@@modifier + label + constant}, and
878 @samp{symbol@@modifier - label + constant}.
879 The following modifiers are available:
883 The @@got modifier can be used for .short, .long and .quad. The @@got12
884 modifier is synonym to @@got. The symbol is added to the GOT. The symbol
885 term is replaced with offset from the start of the GOT to the GOT slot for
888 The @@gotoff modifier can be used for .short, .long and .quad. The symbol
889 term is replaced with the offset from the start of the GOT to the address
892 The @@gotplt modifier can be used for .long and .quad. A procedure linkage
893 table entry is generated for the symbol and a jump slot for the symbol
894 is added to the GOT. The symbol term is replaced with the offset from the
895 start of the GOT to the jump slot for the symbol.
897 The @@plt modifier can be used for .long and .quad. A procedure linkage
898 table entry us generated for the symbol. The symbol term is replaced with
899 the address of the PLT entry for the symbol.
901 The @@pltoff modifier can be used for .short, .long and .quad. The symbol
902 term is replaced with the offset from the start of the PLT to the address
906 The @@tlsgd and @@tlsldm modifier can be used for .long and .quad. A
907 tls_index structure for the symbol is added to the GOT. The symbol term is
908 replaced with the offset from the start of the GOT to the tls_index structure.
911 The @@gotntpoff and @@indntpoff modifier can be used for .long and .quad.
912 The symbol is added to the static TLS block and the negated offset to the
913 symbol in the static TLS block is added to the GOT. For @@gotntpoff the
914 symbol term is replaced with the offset from the start of the GOT to the
915 GOT slot, for @@indntpoff the symbol term is replaced with the address
918 The @@dtpoff modifier can be used for .long and .quad. The symbol term
919 is replaced with the offset of the symbol relative to the start of the
920 TLS block it is contained in.
922 The @@ntpoff modifier can be used for .long and .quad. The symbol term
923 is replaced with the offset of the symbol relative to the TCB pointer.
926 For more information about the thread local storage modifiers see the
927 ELF extension documentation @samp{ELF Handling For Thread-Local Storage}.
929 @cindex @code{.ltorg} directive, s390
931 This directive causes the current contents of the literal pool to be
932 dumped to the current location (@ref{s390 Literal Pool Entries}).
934 @cindex @code{.machine} directive, s390
935 @item .machine @var{STRING}[+@var{EXTENSION}]@dots{}
937 This directive allows changing the machine for which code is
938 generated. @code{string} may be any of the @code{-march=}
939 selection options, or @code{push}, or @code{pop}. @code{.machine
940 push} saves the currently selected cpu, which may be restored with
941 @code{.machine pop}. Be aware that the cpu string has to be put
942 into double quotes in case it contains characters not appropriate
943 for identifiers. So you have to write @code{"z9-109"} instead of
944 just @code{z9-109}. Extensions can be specified after the cpu
945 name, separated by plus characters. Valid extensions are:
950 They extend the basic instruction set with features from a higher
951 cpu level, or remove support for a feature from the given cpu
954 Example: @code{z13+nohtm} allows all instructions of the z13 cpu
955 except instructions from the HTM facility.
957 @cindex @code{.machinemode} directive, s390
958 @item .machinemode string
959 This directive allows one to change the architecture mode for which code
960 is being generated. @code{string} may be @code{esa}, @code{zarch},
961 @code{zarch_nohighgprs}, @code{push}, or @code{pop}.
962 @code{.machinemode zarch_nohighgprs} can be used to prevent the
963 @code{highgprs} flag from being set in the ELF header of the output
964 file. This is useful in situations where the code is gated with a
965 runtime check which makes sure that the code is only executed on
966 kernels providing the @code{highgprs} feature.
967 @code{.machinemode push} saves the currently selected mode, which may
968 be restored with @code{.machinemode pop}.
971 @node s390 Floating Point
972 @section Floating Point
973 @cindex floating point, s390
974 @cindex s390 floating point
976 The assembler recognizes both the @sc{ieee} floating-point instruction and
977 the hexadecimal floating-point instructions. The floating-point constructors
978 @samp{.float}, @samp{.single}, and @samp{.double} always emit the
979 @sc{ieee} format. To assemble hexadecimal floating-point constants the
980 @samp{.long} and @samp{.quad} directives must be used.