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