c-s390.texi 35 KB

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