xref: /dflybsd-src/contrib/binutils-2.27/gas/doc/c-i370.texi (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj@c Copyright (C) 2000-2016 Free Software Foundation, Inc.
2*a9fa9459Szrj@c This is part of the GAS manual.
3*a9fa9459Szrj@c For copying conditions, see the file as.texinfo.
4*a9fa9459Szrj@ifset GENERIC
5*a9fa9459Szrj@page
6*a9fa9459Szrj@node ESA/390-Dependent
7*a9fa9459Szrj@chapter ESA/390 Dependent Features
8*a9fa9459Szrj@end ifset
9*a9fa9459Szrj@ifclear GENERIC
10*a9fa9459Szrj@node Machine Dependencies
11*a9fa9459Szrj@chapter ESA/390 Dependent Features
12*a9fa9459Szrj@end ifclear
13*a9fa9459Szrj
14*a9fa9459Szrj@cindex i370 support
15*a9fa9459Szrj@cindex ESA/390 support
16*a9fa9459Szrj
17*a9fa9459Szrj@menu
18*a9fa9459Szrj* ESA/390 Notes::                Notes
19*a9fa9459Szrj* ESA/390 Options::              Options
20*a9fa9459Szrj* ESA/390 Syntax::               Syntax
21*a9fa9459Szrj* ESA/390 Floating Point::       Floating Point
22*a9fa9459Szrj* ESA/390 Directives::           ESA/390 Machine Directives
23*a9fa9459Szrj* ESA/390 Opcodes::              Opcodes
24*a9fa9459Szrj@end menu
25*a9fa9459Szrj
26*a9fa9459Szrj@node ESA/390 Notes
27*a9fa9459Szrj@section Notes
28*a9fa9459SzrjThe ESA/390 @code{@value{AS}} port is currently intended to be a back-end
29*a9fa9459Szrjfor the @sc{gnu} @sc{cc} compiler.  It is not HLASM compatible, although
30*a9fa9459Szrjit does support a subset of some of the HLASM directives.  The only
31*a9fa9459Szrjsupported binary file format is ELF; none of the usual MVS/VM/OE/USS
32*a9fa9459Szrjobject file formats, such as ESD or XSD, are supported.
33*a9fa9459Szrj
34*a9fa9459SzrjWhen used with the @sc{gnu} @sc{cc} compiler, the ESA/390 @code{@value{AS}}
35*a9fa9459Szrjwill produce correct, fully relocated, functional binaries, and has been
36*a9fa9459Szrjused to compile and execute large projects.  However, many aspects should
37*a9fa9459Szrjstill be considered experimental; these include shared library support,
38*a9fa9459Szrjdynamically loadable objects, and any relocation other than the 31-bit
39*a9fa9459Szrjrelocation.
40*a9fa9459Szrj
41*a9fa9459Szrj@node ESA/390 Options
42*a9fa9459Szrj@section Options
43*a9fa9459Szrj@code{@value{AS}} has no machine-dependent command-line options for the ESA/390.
44*a9fa9459Szrj
45*a9fa9459Szrj@cindex ESA/390 Syntax
46*a9fa9459Szrj@node ESA/390 Syntax
47*a9fa9459Szrj@section Syntax
48*a9fa9459SzrjThe opcode/operand syntax follows the ESA/390 Principles of Operation
49*a9fa9459Szrjmanual; assembler directives and general syntax are loosely based on the
50*a9fa9459Szrjprevailing AT&T/SVR4/ELF/Solaris style notation.  HLASM-style directives
51*a9fa9459Szrjare @emph{not} supported for the most part, with the exception of those
52*a9fa9459Szrjdescribed herein.
53*a9fa9459Szrj
54*a9fa9459SzrjA leading dot in front of directives is optional, and the case of
55*a9fa9459Szrjdirectives is ignored; thus for example, .using and USING have the same
56*a9fa9459Szrjeffect.
57*a9fa9459Szrj
58*a9fa9459SzrjA colon may immediately follow a label definition.  This is
59*a9fa9459Szrjsimply for compatibility with how most assembly language programmers
60*a9fa9459Szrjwrite code.
61*a9fa9459Szrj
62*a9fa9459Szrj@samp{#} is the line comment character.
63*a9fa9459Szrj
64*a9fa9459Szrj@samp{;} can be used instead of a newline to separate statements.
65*a9fa9459Szrj
66*a9fa9459SzrjSince @samp{$} has no special meaning, you may use it in symbol names.
67*a9fa9459Szrj
68*a9fa9459SzrjRegisters can be given the symbolic names r0..r15, fp0, fp2, fp4, fp6.
69*a9fa9459SzrjBy using thesse symbolic names, @code{@value{AS}} can detect simple
70*a9fa9459Szrjsyntax errors. The name rarg or r.arg is a synonym for r11, rtca or r.tca
71*a9fa9459Szrjfor r12, sp, r.sp, dsa r.dsa for r13, lr or r.lr for r14, rbase or r.base
72*a9fa9459Szrjfor r3 and rpgt or r.pgt for r4.
73*a9fa9459Szrj
74*a9fa9459Szrj@samp{*} is the current location counter.  Unlike @samp{.} it is always
75*a9fa9459Szrjrelative to the last USING directive.  Note that this means that
76*a9fa9459Szrjexpressions cannot use multiplication, as any occurrence of @samp{*}
77*a9fa9459Szrjwill be interpreted as a location counter.
78*a9fa9459Szrj
79*a9fa9459SzrjAll labels are relative to the last USING.  Thus, branches to a label
80*a9fa9459Szrjalways imply the use of base+displacement.
81*a9fa9459Szrj
82*a9fa9459SzrjMany of the usual forms of address constants / address literals
83*a9fa9459Szrjare supported.  Thus,
84*a9fa9459Szrj@example
85*a9fa9459Szrj	.using	*,r3
86*a9fa9459Szrj	L	r15,=A(some_routine)
87*a9fa9459Szrj	LM	r6,r7,=V(some_longlong_extern)
88*a9fa9459Szrj	A	r1,=F'12'
89*a9fa9459Szrj	AH	r0,=H'42'
90*a9fa9459Szrj	ME	r6,=E'3.1416'
91*a9fa9459Szrj	MD	r6,=D'3.14159265358979'
92*a9fa9459Szrj	O	r6,=XL4'cacad0d0'
93*a9fa9459Szrj	.ltorg
94*a9fa9459Szrj@end example
95*a9fa9459Szrjshould all behave as expected: that is, an entry in the literal
96*a9fa9459Szrjpool will be created (or reused if it already exists), and the
97*a9fa9459Szrjinstruction operands will be the displacement into the literal pool
98*a9fa9459Szrjusing the current base register (as last declared with the @code{.using}
99*a9fa9459Szrjdirective).
100*a9fa9459Szrj
101*a9fa9459Szrj@node ESA/390 Floating Point
102*a9fa9459Szrj@section Floating Point
103*a9fa9459Szrj@cindex floating point, ESA/390 (@sc{ieee})
104*a9fa9459Szrj@cindex ESA/390 floating point (@sc{ieee})
105*a9fa9459SzrjThe assembler generates only @sc{ieee} floating-point numbers.  The older
106*a9fa9459Szrjfloating point formats are not supported.
107*a9fa9459Szrj
108*a9fa9459Szrj
109*a9fa9459Szrj@node ESA/390 Directives
110*a9fa9459Szrj@section ESA/390 Assembler Directives
111*a9fa9459Szrj
112*a9fa9459Szrj@code{@value{AS}} for the ESA/390 supports all of the standard ELF/SVR4
113*a9fa9459Szrjassembler directives that are documented in the main part of this
114*a9fa9459Szrjdocumentation.  Several additional directives are supported in order
115*a9fa9459Szrjto implement the ESA/390 addressing model.  The most important of these
116*a9fa9459Szrjare @code{.using} and @code{.ltorg}
117*a9fa9459Szrj
118*a9fa9459Szrj@cindex ESA/390-only directives
119*a9fa9459SzrjThese are the additional directives in @code{@value{AS}} for the ESA/390:
120*a9fa9459Szrj
121*a9fa9459Szrj@table @code
122*a9fa9459Szrj@item .dc
123*a9fa9459SzrjA small subset of the usual DC directive is supported.
124*a9fa9459Szrj
125*a9fa9459Szrj@item .drop @var{regno}
126*a9fa9459SzrjStop using @var{regno} as the base register.  The @var{regno} must
127*a9fa9459Szrjhave been previously declared with a @code{.using} directive in the
128*a9fa9459Szrjsame section as the current section.
129*a9fa9459Szrj
130*a9fa9459Szrj@item .ebcdic @var{string}
131*a9fa9459SzrjEmit the EBCDIC equivalent of the indicated string.  The emitted string
132*a9fa9459Szrjwill be null terminated.  Note that the directives @code{.string} etc. emit
133*a9fa9459Szrjascii strings by default.
134*a9fa9459Szrj
135*a9fa9459Szrj@item EQU
136*a9fa9459SzrjThe standard HLASM-style EQU directive is not supported; however, the
137*a9fa9459Szrjstandard @code{@value{AS}} directive .equ can be used to the same effect.
138*a9fa9459Szrj
139*a9fa9459Szrj@item .ltorg
140*a9fa9459SzrjDump the literal pool accumulated so far; begin a new literal pool.
141*a9fa9459SzrjThe literal pool will be written in the current section; in order to
142*a9fa9459Szrjgenerate correct assembly, a @code{.using} must have been previously
143*a9fa9459Szrjspecified in the same section.
144*a9fa9459Szrj
145*a9fa9459Szrj@item .using @var{expr},@var{regno}
146*a9fa9459SzrjUse @var{regno} as the base register for all subsequent RX, RS, and SS form
147*a9fa9459Szrjinstructions. The @var{expr} will be evaluated to obtain the base address;
148*a9fa9459Szrjusually, @var{expr} will merely be @samp{*}.
149*a9fa9459Szrj
150*a9fa9459SzrjThis assembler allows two @code{.using} directives to be simultaneously
151*a9fa9459Szrjoutstanding, one in the @code{.text} section, and one in another section
152*a9fa9459Szrj(typically, the @code{.data} section).  This feature allows
153*a9fa9459Szrjdynamically loaded objects to be implemented in a relatively
154*a9fa9459Szrjstraightforward way.  A @code{.using} directive must always be specified
155*a9fa9459Szrjin the @code{.text} section; this will specify the base register that
156*a9fa9459Szrjwill be used for branches in the @code{.text} section.  A second
157*a9fa9459Szrj@code{.using} may be specified in another section; this will specify
158*a9fa9459Szrjthe base register that is used for non-label address literals.
159*a9fa9459SzrjWhen a second @code{.using} is specified, then the subsequent
160*a9fa9459Szrj@code{.ltorg} must be put in the same section; otherwise an error will
161*a9fa9459Szrjresult.
162*a9fa9459Szrj
163*a9fa9459SzrjThus, for example, the following code uses @code{r3} to address branch
164*a9fa9459Szrjtargets and @code{r4} to address the literal pool, which has been written
165*a9fa9459Szrjto the @code{.data} section.  The is, the constants @code{=A(some_routine)},
166*a9fa9459Szrj@code{=H'42'} and @code{=E'3.1416'} will all appear in the @code{.data}
167*a9fa9459Szrjsection.
168*a9fa9459Szrj
169*a9fa9459Szrj@example
170*a9fa9459Szrj.data
171*a9fa9459Szrj	.using  LITPOOL,r4
172*a9fa9459Szrj.text
173*a9fa9459Szrj	BASR	r3,0
174*a9fa9459Szrj	.using	*,r3
175*a9fa9459Szrj        B       START
176*a9fa9459Szrj	.long	LITPOOL
177*a9fa9459SzrjSTART:
178*a9fa9459Szrj	L	r4,4(,r3)
179*a9fa9459Szrj	L	r15,=A(some_routine)
180*a9fa9459Szrj	LTR	r15,r15
181*a9fa9459Szrj	BNE	LABEL
182*a9fa9459Szrj	AH	r0,=H'42'
183*a9fa9459SzrjLABEL:
184*a9fa9459Szrj	ME	r6,=E'3.1416'
185*a9fa9459Szrj.data
186*a9fa9459SzrjLITPOOL:
187*a9fa9459Szrj	.ltorg
188*a9fa9459Szrj@end example
189*a9fa9459Szrj
190*a9fa9459Szrj
191*a9fa9459SzrjNote that this dual-@code{.using} directive semantics extends
192*a9fa9459Szrjand is not compatible with HLASM semantics.  Note that this assembler
193*a9fa9459Szrjdirective does not support the full range of HLASM semantics.
194*a9fa9459Szrj
195*a9fa9459Szrj@end table
196*a9fa9459Szrj
197*a9fa9459Szrj@node ESA/390 Opcodes
198*a9fa9459Szrj@section Opcodes
199*a9fa9459SzrjFor detailed information on the ESA/390 machine instruction set, see
200*a9fa9459Szrj@cite{ESA/390 Principles of Operation} (IBM Publication Number DZ9AR004).
201