]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/doc/c-s390.texi
Fix spelling mistakes and typos in the GAS sources.
[thirdparty/binutils-gdb.git] / gas / doc / c-s390.texi
CommitLineData
2571583a 1@c Copyright (C) 2009-2017 Free Software Foundation, Inc.
11c19e16
MS
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
952c3f51 17and ten chip levels. The architecture modes are the Enterprise System
11c19e16 18Architecture (ESA) and the newer z/Architecture mode. The chip levels
952c3f51
AK
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), and
21z13 (or arch11).
11c19e16
MS
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:
34bca508 37
11c19e16
MS
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
34bca508 62are recognized:
952c3f51 63@code{g5} (or @code{arch3}),
11c19e16 64@code{g6},
952c3f51
AK
65@code{z900} (or @code{arch5}),
66@code{z990} (or @code{arch6}),
11c19e16 67@code{z9-109},
952c3f51
AK
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
74Assembling an instruction that is not supported on the target
75processor results in an error message.
76
77The processor names starting with @code{arch} refer to the edition
78number in the Principle of Operations manual. They can be used as
79alternate processor names and have been added for compatibility with
80the 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
84on these processor levels.
85
86There is no @code{arch4} option supported. @code{arch4} matches
87@code{-march=arch5 -mesa}.
11c19e16
MS
88
89@cindex @samp{-mregnames} option, s390
90@item -mregnames
91Allow symbolic names for registers.
92
93@cindex @samp{-mno-regnames} option, s390
94@item -mno-regnames
95Do not allow symbolic names for registers.
96
97@cindex @samp{-mwarn-areg-zero} option, s390
98@item -mwarn-areg-zero
99Warn whenever the operand for a base or index register has been specified
100but evaluates to zero. This can indicate the misuse of general purpose
101register 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
7c31ae13
NC
112If a @samp{#} appears as the first character of a line then the whole
113line is treated as a comment, but in this case the line could also be
114a logical line number directive (@pxref{Comments}) or a preprocessor
115control command (@pxref{Preprocessing}).
116
117@cindex line separator, s390
118@cindex statement separator, s390
119@cindex s390 line separator
120The @samp{;} character can be used instead of a newline to separate
121statements.
122
11c19e16
MS
123@node s390 Syntax
124@section Instruction syntax
125@cindex instruction syntax, s390
126@cindex s390 instruction syntax
127
34bca508
L
128The assembler syntax closely follows the syntax outlined in
129Enterprise Systems Architecture/390 Principles of Operation (SA22-7201)
130and the z/Architecture Principles of Operation (SA22-7832).
11c19e16
MS
131
132Each instruction has two major parts, the instruction mnemonic
133and 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
151The @code{@value{AS}} recognizes a number of predefined symbols for the
152various processor registers. A register specification in one of the
153instruction formats is an unsigned integer between 0 and 15. The specific
154instruction and the position of the register in the instruction format
155denotes 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
174All instructions documented in the Principles of Operation are supported
175with the mnemonic and order of operands as described.
176The instruction mnemonic identifies the instruction format
177(@ref{s390 Formats}) and the specific operation code for the instruction.
178For example, the @samp{lr} mnemonic denotes the instruction format @samp{RR}
179with the operation code @samp{0x18}.
180
181The definition of the various mnemonics follows a scheme, where the first
182character 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
189register 32-bit
190@item d @tab divide instruction, for example @samp{dlr} devide logical register
19164-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
202logical 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
205character
206@end multitable
207@end display
208
209Certain characters at the end of the mnemonic may describe a property
210of 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
226There are many exceptions to the scheme outlined in the above lists, in
33eaf5de 227particular for the privileged instructions. For non-privileged
11c19e16
MS
228instruction it works quite well, for example the instruction @samp{clgfr}
229c: compare instruction, l: unsigned operands, g: 64-bit operands,
230f: 32- to 64-bit extension, r: register operands. The instruction compares
231an 64-bit value in a register with the zero extended 32-bit value from
232a second register.
233For a complete list of all mnemonics see appendix B in the Principles
234of Operation.
235
236@node s390 Operands
237@subsection Instruction Operands
238@cindex instruction operands, s390
239@cindex s390 instruction operands
240
241Instruction operands can be grouped into three classes, operands located
242in registers, immediate operands, and operands in storage.
243
244A register operand can be located in general, floating-point, access,
245or control register. The register is identified by a four-bit field.
246The field containing the register operand is called the R field.
247
248Immediate operands are contained within the instruction and can have
2498, 16 or 32 bits. The field containing the immediate operand is called
250the I field. Dependent on the instruction the I field is either signed
251or unsigned.
252
253A storage operand consists of an address and a length. The address of a
254storage 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
259register B plus the content of a displacement field D
260@item The sum of the contents of two general registers called the
261index register X and the base register B plus the content of a
262displacement field
263@item The sum of the current instruction address and a 32-bit signed
264immediate field multiplied by two.
265@end itemize
266
267The 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
276The notation for storage operand addresses formed from multiple fields is
277as follows:
278
279@table @code
280@item Dn(Bn)
281the address for operand number n is formed from the content of general
282register Bn called the base register and the displacement field Dn.
283@item Dn(Xn,Bn)
284the address for operand number n is formed from the content of general
285register Xn called the index register, general register Bn called the
286base register and the displacement field Dn.
287@item Dn(Ln,Bn)
288the address for operand number n is formed from the content of general
33eaf5de 289register Bn called the base register and the displacement field Dn.
11c19e16
MS
290The length of the operand n is specified by the field Ln.
291@end table
292
293The base registers Bn and the index registers Xn of a storage operand can
294be skipped. If Bn and Xn are skipped, a zero will be stored to the operand
295field. 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
313The Principles of Operation manuals lists 26 instruction formats where
314some of the formats have multiple variants. For the @samp{.insn}
34bca508 315pseudo directive the assembler recognizes some of the formats.
11c19e16
MS
316Typically, the most general variant of the instruction format is used
317by the @samp{.insn} directive.
318
319The following table lists the abbreviations used in the table of
320instruction 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
336An instruction is two, four, or six bytes in length and must be aligned
337on a 2 byte boundary. The first two bits of the instruction specify the
338length of the instruction, 00 indicates a two byte instruction, 01 and 10
339indicates a four byte instruction, and 11 indicates a six byte instruction.
340
341The following table lists the s390 instruction formats that are available
342with the @samp{.insn} pseudo directive:
343
344@table @code
345@item E format
346@verbatim
347+-------------+
348| OpCode |
349+-------------+
3500 15
351@end verbatim
352
353@item RI format: <insn> R1,I2
354@verbatim
355+--------+----+----+------------------+
356| OpCode | R1 |OpCd| I2 |
357+--------+----+----+------------------+
3580 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+--------+----+----+------------------+--------+--------+
3660 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+--------+----+----+------------------------------------+
3740 8 12 16 47
375@end verbatim
376
377@item RILU format: <insn> R1,U2
378@verbatim
379+--------+----+----+------------------------------------+
380| OpCode | R1 |OpCd| U2 |
381+--------+----+----+------------------------------------+
3820 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+--------+----+----+----+-------------+--------+--------+
3900 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+--------+----+----+
34bca508 3980 8 12 15
11c19e16
MS
399@end verbatim
400
401@item RRE format: <insn> R1,R2
402@verbatim
403+------------------+--------+----+----+
404| OpCode |////////| R1 | R2 |
405+------------------+--------+----+----+
4060 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+------------------+----+----+----+----+
4140 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+--------+----+----+----+-------------+----+----+--------+
4220 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+--------+----+----+----+-------------+
4300 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+--------+----+----+----+-------------+--------+--------+
4380 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+--------+----+----+------------------------------------+
4460 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+--------+----+----+----+-------------+--------+--------+
4540 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+--------+----+----+----+-------------+
4620 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+--------+----+----+----+-------------+--------+--------+
4700 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+--------+----+----+----+-------------+----+---+--------+
4780 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+--------+----+----+----+-------------+--------+--------+
4860 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+------------------+----+-------------+
4940 16 20 31
495@end verbatim
496
497@item SI format: <insn> D1(B1),I2
498@verbatim
499+--------+---------+----+-------------+
500| OpCode | I2 | B1 | D1 |
501+--------+---------+----+-------------+
5020 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+--------+---------+----+-------------+--------+--------+
5100 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+------------------+----+-------------+-----------------+
5180 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+--------+----+----+----+-------------+----+------------+
5260 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+------------------+----+-------------+----+------------+
5340 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+--------+----+----+----+-------------+----+------------+
5420 8 12 16 20 32 36 47
543@end verbatim
544
545@end table
546
547For the complete list of all instruction format variants see the
548Principles of Operation manuals.
549
550@node s390 Aliases
551@subsection Instruction Aliases
552@cindex instruction aliases, s390
553@cindex s390 instruction aliases
554
555A specific bit pattern can have multiple mnemonics, for example
556the 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.
559These are the short forms of the branch instructions, where the condition
560code mask operand is encoded in the mnemonic. This is relevant for the
561branch instructions, the compare and branch instructions, and the
562compare and trap instructions.
563
564For the branch instructions there are 20 condition code strings that can
565be used as part of the mnemonic in place of a mask operand in the instruction
566format:
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
578In the mnemonic for a branch instruction the condition code string <m>
579can 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
606For the compare and branch, and compare and trap instructions there
607are 12 condition code strings that can be used as part of the mnemonic in
608place 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
640In the mnemonic for a compare and branch and compare and trap instruction
641the 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
665If a symbol modifier is attached to a symbol in an expression for an
666instruction operand field, the symbol term is replaced with a reference
667to an object in the global offset table (GOT) or the procedure linkage
668table (PLT). The following expressions are allowed:
669@samp{symbol@@modifier + constant},
670@samp{symbol@@modifier + label + constant}, and
671@samp{symbol@@modifier - label + constant}.
672The term @samp{symbol} is the symbol that will be entered into the GOT or
673PLT, @samp{label} is a local label, and @samp{constant} is an arbitrary
674expression that the assembler can evaluate to a constant value.
675
676The term @samp{(symbol + constant1)@@modifier +/- label + constant2}
677is also accepted but a warning message is printed and the term is
678converted to @samp{symbol@@modifier +/- label + constant1 + constant2}.
679
680@table @code
681@item @@got
682@itemx @@got12
683The @@got modifier can be used for displacement fields, 16-bit immediate
684fields and 32-bit pc-relative immediate fields. The @@got12 modifier is
685synonym to @@got. The symbol is added to the GOT. For displacement
686fields and 16-bit immediate fields the symbol term is replaced with
687the offset from the start of the GOT to the GOT slot for the symbol.
688For a 32-bit pc-relative field the pc-relative offset to the GOT
689slot from the current instruction address is used.
690@item @@gotent
691The @@gotent modifier can be used for 32-bit pc-relative immediate fields.
692The symbol is added to the GOT and the symbol term is replaced with
693the pc-relative offset from the current instruction to the GOT slot for the
694symbol.
695@item @@gotoff
696The @@gotoff modifier can be used for 16-bit immediate fields. The symbol
34bca508 697term is replaced with the offset from the start of the GOT to the
11c19e16
MS
698address of the symbol.
699@item @@gotplt
700The @@gotplt modifier can be used for displacement fields, 16-bit immediate
701fields, and 32-bit pc-relative immediate fields. A procedure linkage
702table entry is generated for the symbol and a jump slot for the symbol
703is added to the GOT. For displacement fields and 16-bit immediate
704fields the symbol term is replaced with the offset from the start of the
705GOT to the jump slot for the symbol. For a 32-bit pc-relative field
706the pc-relative offset to the jump slot from the current instruction
707address is used.
708@item @@plt
709The @@plt modifier can be used for 16-bit and 32-bit pc-relative immediate
710fields. A procedure linkage table entry is generated for the symbol.
711The symbol term is replaced with the relative offset from the current
712instruction to the PLT entry for the symbol.
713@item @@pltoff
714The @@pltoff modifier can be used for 16-bit immediate fields. The symbol
715term is replaced with the offset from the start of the PLT to the address
716of the symbol.
717@item @@gotntpoff
718The @@gotntpoff modifier can be used for displacement fields. The symbol
719is added to the static TLS block and the negated offset to the symbol
720in the static TLS block is added to the GOT. The symbol term is replaced
34bca508 721with the offset to the GOT slot from the start of the GOT.
11c19e16
MS
722@item @@indntpoff
723The @@indntpoff modifier can be used for 32-bit pc-relative immediate
724fields. The symbol is added to the static TLS block and the negated offset
725to the symbol in the static TLS block is added to the GOT. The symbol term
726is replaced with the pc-relative offset to the GOT slot from the current
727instruction address.
728@end table
729
730For 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
739The thread local storage instruction markers are used by the linker to
740perform code optimization.
741
742@table @code
743@item :tls_load
744The :tls_load marker is used to flag the load instruction in the initial
745exec TLS model that retrieves the offset from the thread pointer to a
34bca508 746thread local storage variable from the GOT.
11c19e16
MS
747@item :tls_gdcall
748The :tls_gdcall marker is used to flag the branch-and-save instruction to
749the __tls_get_offset function in the global dynamic TLS model.
750@item :tls_ldcall
751The :tls_ldcall marker is used to flag the branch-and-save instruction to
752the __tls_get_offset function in the local dynamic TLS model.
753@end table
754
755For more information about the thread local storage instruction marker
756and 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
764A literal pool is a collection of values. To access the values a pointer
765to the literal pool is loaded to a register, the literal pool register.
766Usually, register %r13 is used as the literal pool register
767(@ref{s390 Register}). Literal pool entries are created by adding the
768suffix :lit1, :lit2, :lit4, or :lit8 to the end of an expression for an
769instruction operand. The expression is added to the literal pool and the
770operand is replaced with the offset to the literal in the literal pool.
771
772@table @code
773@item :lit1
774The literal pool entry is created as an 8-bit value. An operand modifier
775must not be used for the original expression.
776@item :lit2
777The 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}
779will put the got offset for the global symbol x to the literal pool as
78016 bit value.
781@item :lit4
782The 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
785literal pool as a 32-bit value. The term @samp{x@@plt:lit4} will put the
786plt offset for the global symbol x to the literal pool as a 32-bit value.
787@item :lit8
788The 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
791literal pool as a 64-bit value. The term @samp{x@@plt:lit8} will put the
792plt offset for the global symbol x to the literal pool as a 64-bit value.
793@end table
794
795The assembler directive @samp{.ltorg} is used to emit all literal pool
796entries to the current position.
797
798@node s390 Directives
799@section Assembler Directives
800
34bca508 801@code{@value{AS}} for s390 supports all of the standard ELF
11c19e16
MS
802assembler directives as outlined in the main part of this document.
803Some directives have been extended and there are some additional
804directives, which are only available for the s390 @code{@value{AS}}.
805
806@table @code
807@cindex @code{.insn} directive, s390
808@item .insn
809This directive permits the numeric representation of an instructions
810and makes the assembler insert the operands according to one of the
811instructions formats for @samp{.insn} (@ref{s390 Formats}).
812For 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
820This directive places one or more 16-bit (.short), 32-bit (.long), or
82164-bit (.quad) values into the current section. If an ELF or TLS modifier
34bca508 822is used only the following expressions are allowed:
11c19e16
MS
823@samp{symbol@@modifier + constant},
824@samp{symbol@@modifier + label + constant}, and
825@samp{symbol@@modifier - label + constant}.
826The following modifiers are available:
827@table @code
828@item @@got
829@itemx @@got12
830The @@got modifier can be used for .short, .long and .quad. The @@got12
831modifier is synonym to @@got. The symbol is added to the GOT. The symbol
832term is replaced with offset from the start of the GOT to the GOT slot for
833the symbol.
834@item @@gotoff
835The @@gotoff modifier can be used for .short, .long and .quad. The symbol
836term is replaced with the offset from the start of the GOT to the address
837of the symbol.
838@item @@gotplt
839The @@gotplt modifier can be used for .long and .quad. A procedure linkage
840table entry is generated for the symbol and a jump slot for the symbol
841is added to the GOT. The symbol term is replaced with the offset from the
842start of the GOT to the jump slot for the symbol.
843@item @@plt
844The @@plt modifier can be used for .long and .quad. A procedure linkage
845table entry us generated for the symbol. The symbol term is replaced with
846the address of the PLT entry for the symbol.
847@item @@pltoff
848The @@pltoff modifier can be used for .short, .long and .quad. The symbol
849term is replaced with the offset from the start of the PLT to the address
850of the symbol.
851@item @@tlsgd
852@itemx @@tlsldm
853The @@tlsgd and @@tlsldm modifier can be used for .long and .quad. A
854tls_index structure for the symbol is added to the GOT. The symbol term is
855replaced with the offset from the start of the GOT to the tls_index structure.
856@item @@gotntpoff
857@itemx @@indntpoff
858The @@gotntpoff and @@indntpoff modifier can be used for .long and .quad.
859The symbol is added to the static TLS block and the negated offset to the
860symbol in the static TLS block is added to the GOT. For @@gotntpoff the
861symbol term is replaced with the offset from the start of the GOT to the
862GOT slot, for @@indntpoff the symbol term is replaced with the address
863of the GOT slot.
864@item @@dtpoff
865The @@dtpoff modifier can be used for .long and .quad. The symbol term
866is replaced with the offset of the symbol relative to the start of the
867TLS block it is contained in.
868@item @@ntpoff
869The @@ntpoff modifier can be used for .long and .quad. The symbol term
870is replaced with the offset of the symbol relative to the TCB pointer.
871@end table
872
873For more information about the thread local storage modifiers see the
874ELF extension documentation @samp{ELF Handling For Thread-Local Storage}.
875
876@cindex @code{.ltorg} directive, s390
877@item .ltorg
878This directive causes the current contents of the literal pool to be
879dumped to the current location (@ref{s390 Literal Pool Entries}).
902cc293
AK
880
881@cindex @code{.machine} directive, s390
7ecc513a
DV
882@item .machine @var{STRING}[+@var{EXTENSION}]@dots{}
883
884This directive allows changing the machine for which code is
885generated. @code{string} may be any of the @code{-march=}
886selection options, or @code{push}, or @code{pop}. @code{.machine
887push} saves the currently selected cpu, which may be restored with
888@code{.machine pop}. Be aware that the cpu string has to be put
889into double quotes in case it contains characters not appropriate
890for identifiers. So you have to write @code{"z9-109"} instead of
891just @code{z9-109}. Extensions can be specified after the cpu
33eaf5de 892name, separated by plus characters. Valid extensions are:
7ecc513a
DV
893@code{htm},
894@code{nohtm},
895@code{vx},
896@code{novx}.
897They extend the basic instruction set with features from a higher
898cpu level, or remove support for a feature from the given cpu
899level.
900
901Example: @code{z13+nohtm} allows all instructions of the z13 cpu
902except instructions from the HTM facility.
1dd53816
AK
903
904@cindex @code{.machinemode} directive, s390
905@item .machinemode string
906This directive allows to change the architecture mode for which code
907is 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
911file. This is useful in situations where the code is gated with a
912runtime check which makes sure that the code is only executed on
913kernels providing the @code{highgprs} feature.
914@code{.machinemode push} saves the currently selected mode, which may
915be restored with @code{.machinemode pop}.
11c19e16
MS
916@end table
917
918@node s390 Floating Point
919@section Floating Point
920@cindex floating point, s390
921@cindex s390 floating point
922
923The assembler recognizes both the @sc{ieee} floating-point instruction and
924the 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.