Adds support for following CPUs to the ARM and Aarch64 assemblers: Cortex-A77, Cortex...
[deliverable/binutils-gdb.git] / gas / doc / c-aarch64.texi
CommitLineData
82704155 1@c Copyright (C) 2009-2019 Free Software Foundation, Inc.
a06ea964
NC
2@c Contributed by ARM Ltd.
3@c This is part of the GAS manual.
4@c For copying conditions, see the file as.texinfo.
5@c man end
6
7@ifset GENERIC
8@page
9@node AArch64-Dependent
10@chapter AArch64 Dependent Features
11@end ifset
12
13@ifclear GENERIC
14@node Machine Dependencies
15@chapter AArch64 Dependent Features
16@end ifclear
17
18@cindex AArch64 support
a06ea964
NC
19@menu
20* AArch64 Options:: Options
df359aa7 21* AArch64 Extensions:: Extensions
a06ea964
NC
22* AArch64 Syntax:: Syntax
23* AArch64 Floating Point:: Floating Point
24* AArch64 Directives:: AArch64 Machine Directives
25* AArch64 Opcodes:: Opcodes
26* AArch64 Mapping Symbols:: Mapping Symbols
27@end menu
28
29@node AArch64 Options
30@section Options
31@cindex AArch64 options (none)
32@cindex options for AArch64 (none)
33
34@c man begin OPTIONS
35@table @gcctabopt
36
a05a5b64 37@cindex @option{-EB} command-line option, AArch64
a06ea964
NC
38@item -EB
39This option specifies that the output generated by the assembler should
40be marked as being encoded for a big-endian processor.
41
a05a5b64 42@cindex @option{-EL} command-line option, AArch64
a06ea964
NC
43@item -EL
44This option specifies that the output generated by the assembler should
45be marked as being encoded for a little-endian processor.
46
a05a5b64 47@cindex @option{-mabi=} command-line option, AArch64
69091a2c
YZ
48@item -mabi=@var{abi}
49Specify which ABI the source code uses. The recognized arguments
50are: @code{ilp32} and @code{lp64}, which decides the generated object
51file in ELF32 and ELF64 format respectively. The default is @code{lp64}.
52
a05a5b64 53@cindex @option{-mcpu=} command-line option, AArch64
df359aa7
RE
54@item -mcpu=@var{processor}[+@var{extension}@dots{}]
55This option specifies the target processor. The assembler will issue an error
56message if an attempt is made to assemble an instruction which will not execute
57on the target processor. The following processor names are recognized:
546053ac 58@code{cortex-a34},
9c352f1c 59@code{cortex-a35},
df359aa7 60@code{cortex-a53},
1e292627 61@code{cortex-a55},
df359aa7 62@code{cortex-a57},
546053ac
DZ
63@code{cortex-a65},
64@code{cortex-a65ae},
2abdd192 65@code{cortex-a72},
1aa70332 66@code{cortex-a73},
1e292627 67@code{cortex-a75},
c2a0f929 68@code{cortex-a76},
546053ac
DZ
69@code{cortex-a76ae},
70@code{cortex-a77},
c8fcc360 71@code{ares},
2412d878 72@code{exynos-m1},
2fe9c2a0 73@code{falkor},
38e75bf2 74@code{neoverse-n1},
516dbc44 75@code{neoverse-e1},
6b21c2bf 76@code{qdf24xx},
7605d944 77@code{saphira},
55fbd992 78@code{thunderx},
0a8be2fe 79@code{vulcan},
0a9ce86d 80@code{xgene1}
df359aa7 81and
0a9ce86d 82@code{xgene2}.
df359aa7
RE
83The special name @code{all} may be used to allow the assembler to accept
84instructions valid for any supported processor, including all optional
85extensions.
86
87In addition to the basic instruction set, the assembler can be told to
88accept, or restrict, various extension mnemonics that extend the
89processor. @xref{AArch64 Extensions}.
90
91If some implementations of a particular processor can have an
92extension, then then those extensions are automatically enabled.
93Consequently, you will not normally have to specify any additional
94extensions.
95
a05a5b64 96@cindex @option{-march=} command-line option, AArch64
df359aa7
RE
97@item -march=@var{architecture}[+@var{extension}@dots{}]
98This option specifies the target architecture. The assembler will
99issue an error message if an attempt is made to assemble an
100instruction which will not execute on the target architecture. The
acb787b0 101following architecture names are recognized: @code{armv8-a},
70d56181
SD
102@code{armv8.1-a}, @code{armv8.2-a}, @code{armv8.3-a}, @code{armv8.4-a}
103and @code{armv8.5-a}.
df359aa7
RE
104
105If both @option{-mcpu} and @option{-march} are specified, the
106assembler will use the setting for @option{-mcpu}. If neither are
107specified, the assembler will default to @option{-mcpu=all}.
108
109The architecture option can be extended with the same instruction set
110extension options as the @option{-mcpu} option. Unlike
111@option{-mcpu}, extensions are not always enabled by default,
112@xref{AArch64 Extensions}.
113
a05a5b64 114@cindex @code{-mverbose-error} command-line option, AArch64
a52e6fd3
YZ
115@item -mverbose-error
116This option enables verbose error messages for AArch64 gas. This option
117is enabled by default.
118
a05a5b64 119@cindex @code{-mno-verbose-error} command-line option, AArch64
a52e6fd3
YZ
120@item -mno-verbose-error
121This option disables verbose error messages in AArch64 gas.
122
a06ea964
NC
123@end table
124@c man end
125
df359aa7
RE
126@node AArch64 Extensions
127@section Architecture Extensions
128
129The table below lists the permitted architecture extensions that are
130supported by the assembler and the conditions under which they are
131automatically enabled.
132
133Multiple extensions may be specified, separated by a @code{+}.
134Extension mnemonics may also be removed from those the assembler
135accepts. This is done by prepending @code{no} to the option that adds
136the extension. Extensions that are removed must be listed after all
137extensions that have been added.
138
139Enabling an extension that requires other extensions will
140automatically cause those extensions to be enabled. Similarly,
141disabling an extension that is required by other extensions will
142automatically cause those extensions to be disabled.
143
144@multitable @columnfractions .12 .17 .17 .54
145@headitem Extension @tab Minimum Architecture @tab Enabled by default
146 @tab Description
f482d304
RS
147@item @code{compnum} @tab ARMv8.2-A @tab ARMv8.3-A or later
148 @tab Enable the complex number SIMD extensions. This implies
149 @code{fp16} and @code{simd}.
af117b3c 150@item @code{crc} @tab ARMv8-A @tab ARMv8.1-A or later
df359aa7
RE
151 @tab Enable CRC instructions.
152@item @code{crypto} @tab ARMv8-A @tab No
68ffd936
TC
153 @tab Enable cryptographic extensions. This implies @code{fp}, @code{simd}, @code{aes} and @code{sha2}.
154@item @code{aes} @tab ARMv8-A @tab No
155 @tab Enable the AES cryptographic extensions. This implies @code{fp} and @code{simd}.
156@item @code{sha2} @tab ARMv8-A @tab No
157 @tab Enable the SHA2 cryptographic extensions. This implies @code{fp} and @code{simd}.
158@item @code{sha3} @tab ARMv8.2-A @tab No
159 @tab Enable the ARMv8.2-A SHA2 and SHA3 cryptographic extensions. This implies @code{fp}, @code{simd} and @code{sha2}.
160@item @code{sm4} @tab ARMv8.2-A @tab No
161 @tab Enable the ARMv8.2-A SM3 and SM4 cryptographic extensions. This implies @code{fp} and @code{simd}.
df359aa7
RE
162@item @code{fp} @tab ARMv8-A @tab ARMv8-A or later
163 @tab Enable floating-point extensions.
87018195
MW
164@item @code{fp16} @tab ARMv8.2-A @tab ARMv8.2-A or later
165 @tab Enable ARMv8.2 16-bit floating-point support. This implies
166 @code{fp}.
b607cde1
JG
167@item @code{lor} @tab ARMv8-A @tab ARMv8.1-A or later
168 @tab Enable Limited Ordering Regions extensions.
169@item @code{lse} @tab ARMv8-A @tab ARMv8.1-A or later
170 @tab Enable Large System extensions.
171@item @code{pan} @tab ARMv8-A @tab ARMv8.1-A or later
172 @tab Enable Privileged Access Never support.
73af8ed6
MW
173@item @code{profile} @tab ARMv8.2-A @tab No
174 @tab Enable statistical profiling extensions.
50cc854c
MW
175@item @code{ras} @tab ARMv8-A @tab ARMv8.2-A or later
176 @tab Enable the Reliability, Availability and Serviceability
177 extension.
01cca2f9
SN
178@item @code{rcpc} @tab ARMv8.2-A @tab ARMv8.3-A or later
179 @tab Enable the weak release consistency extension.
b607cde1
JG
180@item @code{rdma} @tab ARMv8-A @tab ARMv8.1-A or later
181 @tab Enable ARMv8.1 Advanced SIMD extensions. This implies @code{simd}.
182@item @code{simd} @tab ARMv8-A @tab ARMv8-A or later
183 @tab Enable Advanced SIMD extensions. This implies @code{fp}.
582e12bf
RS
184@item @code{sve} @tab ARMv8.2-A @tab No
185 @tab Enable the Scalable Vector Extensions. This implies @code{fp16},
186 @code{simd} and @code{compnum}.
68ffd936 187@item @code{dotprod} @tab ARMv8.2-A @tab ARMv8.4-A or later
65a55fbb 188 @tab Enable the Dot Product extension. This implies @code{simd}.
d0f7791c
TC
189@item @code{fp16fml} @tab ARMv8.2-A @tab ARMv8.4-A or later
190 @tab Enable ARMv8.2 16-bit floating-point multiplication variant support.
191 This implies @code{fp16}.
68dfbb92
SD
192@item @code{sb} @tab ARMv8-A @tab ARMv8.5-A or later
193 @tab Enable the speculation barrier instruction sb.
2ac435d4
SD
194@item @code{predres} @tab ARMv8-A @tab ARMv8.5-A or later
195 @tab Enable the Execution and Data and Prediction instructions.
af4bcb4c
SD
196@item @code{rng} @tab ARMv8.5-A @tab No
197 @tab Enable ARMv8.5-A random number instructions.
104fefee
SD
198@item @code{ssbs} @tab ARMv8-A @tab ARMv8.5-A or later
199 @tab Enable Speculative Store Bypassing Safe state read and write.
73b605ec
SD
200@item @code{memtag} @tab ARMv8.5-A @tab No
201 @tab Enable ARMv8.5-A Memory Tagging Extensions.
b83b4b13
SD
202@item @code{tme} @tab ARMv8-A @tab No
203 @tab Enable Transactional Memory Extensions.
7ce2460a
MM
204@item @code{sve2} @tab ARMv8-A @tab No
205 @tab Enable the SVE2 Extension.
ccbdd22f 206@item @code{sve2-bitperm} @tab ARMv8-A @tab No
7ce2460a
MM
207 @tab Enable SVE2 BITPERM Extension.
208@item @code{sve2-sm4} @tab ARMv8-A @tab No
209 @tab Enable SVE2 SM4 Extension.
210@item @code{sve2-aes} @tab ARMv8-A @tab No
41be57ca
MM
211 @tab Enable SVE2 AES Extension. This also enables the .Q->.B form of the
212 @code{pmullt} and @code{pmullb} instructions.
7ce2460a
MM
213@item @code{sve2-sha3} @tab ARMv8-A @tab No
214 @tab Enable SVE2 SHA3 Extension.
df359aa7
RE
215@end multitable
216
a06ea964
NC
217@node AArch64 Syntax
218@section Syntax
219@menu
220* AArch64-Chars:: Special Characters
221* AArch64-Regs:: Register Names
222* AArch64-Relocations:: Relocations
223@end menu
224
225@node AArch64-Chars
226@subsection Special Characters
227
228@cindex line comment character, AArch64
229@cindex AArch64 line comment character
230The presence of a @samp{//} on a line indicates the start of a comment
231that extends to the end of the current line. If a @samp{#} appears as
232the first character of a line, the whole line is treated as a comment.
233
234@cindex line separator, AArch64
235@cindex statement separator, AArch64
236@cindex AArch64 line separator
237The @samp{;} character can be used instead of a newline to separate
238statements.
239
240@cindex immediate character, AArch64
241@cindex AArch64 immediate character
242The @samp{#} can be optionally used to indicate immediate operands.
243
244@node AArch64-Regs
245@subsection Register Names
246
247@cindex AArch64 register names
248@cindex register names, AArch64
249Please refer to the section @samp{4.4 Register Names} of
250@samp{ARMv8 Instruction Set Overview}, which is available at
251@uref{http://infocenter.arm.com}.
252
253@node AArch64-Relocations
254@subsection Relocations
255
256@cindex relocations, AArch64
257@cindex AArch64 relocations
258@cindex MOVN, MOVZ and MOVK group relocations, AArch64
259Relocations for @samp{MOVZ} and @samp{MOVK} instructions can be generated
260by prefixing the label with @samp{#:abs_g2:} etc.
261For example to load the 48-bit absolute address of @var{foo} into x0:
262
263@smallexample
264 movz x0, #:abs_g2:foo // bits 32-47, overflow check
265 movk x0, #:abs_g1_nc:foo // bits 16-31, no overflow check
266 movk x0, #:abs_g0_nc:foo // bits 0-15, no overflow check
267@end smallexample
268
269@cindex ADRP, ADD, LDR/STR group relocations, AArch64
270Relocations for @samp{ADRP}, and @samp{ADD}, @samp{LDR} or @samp{STR}
271instructions can be generated by prefixing the label with
34fd659b 272@samp{:pg_hi21:} and @samp{#:lo12:} respectively.
a06ea964 273
34bca508 274For example to use 33-bit (+/-4GB) pc-relative addressing to
a06ea964
NC
275load the address of @var{foo} into x0:
276
277@smallexample
34fd659b 278 adrp x0, :pg_hi21:foo
a06ea964
NC
279 add x0, x0, #:lo12:foo
280@end smallexample
281
282Or to load the value of @var{foo} into x0:
283
284@smallexample
34fd659b 285 adrp x0, :pg_hi21:foo
a06ea964
NC
286 ldr x0, [x0, #:lo12:foo]
287@end smallexample
288
34fd659b 289Note that @samp{:pg_hi21:} is optional.
a06ea964
NC
290
291@smallexample
292 adrp x0, foo
293@end smallexample
294
295is equivalent to
296
297@smallexample
34fd659b 298 adrp x0, :pg_hi21:foo
a06ea964
NC
299@end smallexample
300
301@node AArch64 Floating Point
302@section Floating Point
303
304@cindex floating point, AArch64 (@sc{ieee})
305@cindex AArch64 floating point (@sc{ieee})
306The AArch64 architecture uses @sc{ieee} floating-point numbers.
307
308@node AArch64 Directives
309@section AArch64 Machine Directives
310
311@cindex machine directives, AArch64
312@cindex AArch64 machine directives
313@table @code
314
315@c AAAAAAAAAAAAAAAAAAAAAAAAA
8e02d7f5
JW
316
317@cindex @code{.arch} directive, AArch64
318@item .arch @var{name}
319Select the target architecture. Valid values for @var{name} are the same as
a05a5b64 320for the @option{-march} command-line option.
8e02d7f5
JW
321
322Specifying @code{.arch} clears any previously selected architecture
323extensions.
324
325@cindex @code{.arch_extension} directive, AArch64
326@item .arch_extension @var{name}
327Add or remove an architecture extension to the target architecture. Valid
328values for @var{name} are the same as those accepted as architectural
a05a5b64 329extensions by the @option{-mcpu} command-line option.
8e02d7f5
JW
330
331@code{.arch_extension} may be used multiple times to add or remove extensions
332incrementally to the architecture being compiled for.
333
a06ea964
NC
334@c BBBBBBBBBBBBBBBBBBBBBBBBBB
335
336@cindex @code{.bss} directive, AArch64
337@item .bss
338This directive switches to the @code{.bss} section.
339
340@c CCCCCCCCCCCCCCCCCCCCCCCCCC
30fab421
NC
341
342@cindex @code{.cpu} directive, AArch64
343@item .cpu @var{name}
344Set the target processor. Valid values for @var{name} are the same as
a05a5b64 345those accepted by the @option{-mcpu=} command-line option.
30fab421 346
a06ea964 347@c DDDDDDDDDDDDDDDDDDDDDDDDDD
30fab421
NC
348
349@cindex @code{.dword} directive, AArch64
350@item .dword @var{expressions}
351The @code{.dword} directive produces 64 bit values.
352
a06ea964 353@c EEEEEEEEEEEEEEEEEEEEEEEEEE
30fab421
NC
354
355@cindex @code{.even} directive, AArch64
356@item .even
357The @code{.even} directive aligns the output on the next even byte
358boundary.
359
a06ea964
NC
360@c FFFFFFFFFFFFFFFFFFFFFFFFFF
361@c GGGGGGGGGGGGGGGGGGGGGGGGGG
362@c HHHHHHHHHHHHHHHHHHHHHHHHHH
363@c IIIIIIIIIIIIIIIIIIIIIIIIII
30fab421
NC
364
365@cindex @code{.inst} directive, AArch64
366@item .inst @var{expressions}
367Inserts the expressions into the output as if they were instructions,
368rather than data.
369
a06ea964
NC
370@c JJJJJJJJJJJJJJJJJJJJJJJJJJ
371@c KKKKKKKKKKKKKKKKKKKKKKKKKK
372@c LLLLLLLLLLLLLLLLLLLLLLLLLL
373
374@cindex @code{.ltorg} directive, AArch64
375@item .ltorg
376This directive causes the current contents of the literal pool to be
377dumped into the current section (which is assumed to be the .text
378section) at the current location (aligned to a word boundary).
df359aa7 379GAS maintains a separate literal pool for each section and each
a06ea964
NC
380sub-section. The @code{.ltorg} directive will only affect the literal
381pool of the current section and sub-section. At the end of assembly
382all remaining, un-empty literal pools will automatically be dumped.
383
df359aa7 384Note - older versions of GAS would dump the current literal
a06ea964
NC
385pool any time a section change occurred. This is no longer done, since
386it prevents accurate control of the placement of literal pools.
387
388@c MMMMMMMMMMMMMMMMMMMMMMMMMM
389
390@c NNNNNNNNNNNNNNNNNNNNNNNNNN
391@c OOOOOOOOOOOOOOOOOOOOOOOOOO
392
393@c PPPPPPPPPPPPPPPPPPPPPPPPPP
394
395@cindex @code{.pool} directive, AArch64
396@item .pool
397This is a synonym for .ltorg.
398
399@c QQQQQQQQQQQQQQQQQQQQQQQQQQ
400@c RRRRRRRRRRRRRRRRRRRRRRRRRR
401
402@cindex @code{.req} directive, AArch64
403@item @var{name} .req @var{register name}
404This creates an alias for @var{register name} called @var{name}. For
405example:
406
407@smallexample
408 foo .req w0
409@end smallexample
410
8975f864
RR
411ip0, ip1, lr and fp are automatically defined to
412alias to X16, X17, X30 and X29 respectively.
413
a06ea964
NC
414@c SSSSSSSSSSSSSSSSSSSSSSSSSS
415
416@c TTTTTTTTTTTTTTTTTTTTTTTTTT
417
30fab421
NC
418@cindex @code{.tlsdescadd} directive, AArch64
419@item @code{.tlsdescadd}
420Emits a TLSDESC_ADD reloc on the next instruction.
421
422@cindex @code{.tlsdesccall} directive, AArch64
423@item @code{.tlsdesccall}
424Emits a TLSDESC_CALL reloc on the next instruction.
425
426@cindex @code{.tlsdescldr} directive, AArch64
427@item @code{.tlsdescldr}
428Emits a TLSDESC_LDR reloc on the next instruction.
429
a06ea964
NC
430@c UUUUUUUUUUUUUUUUUUUUUUUUUU
431
432@cindex @code{.unreq} directive, AArch64
433@item .unreq @var{alias-name}
434This undefines a register alias which was previously defined using the
435@code{req} directive. For example:
436
437@smallexample
438 foo .req w0
439 .unreq foo
440@end smallexample
441
442An error occurs if the name is undefined. Note - this pseudo op can
443be used to delete builtin in register name aliases (eg 'w0'). This
444should only be done if it is really necessary.
445
446@c VVVVVVVVVVVVVVVVVVVVVVVVVV
447
f166ae01
SN
448@cindex @code{.variant_pcs} directive, AArch64
449@item .variant_pcs @var{symbol}
450This directive marks @var{symbol} referencing a function that may
451follow a variant procedure call standard with different register
452usage convention from the base procedure call standard.
453
a06ea964
NC
454@c WWWWWWWWWWWWWWWWWWWWWWWWWW
455@c XXXXXXXXXXXXXXXXXXXXXXXXXX
a06ea964 456
edc66de9 457@cindex @code{.xword} directive, AArch64
30fab421
NC
458@item .xword @var{expressions}
459The @code{.xword} directive produces 64 bit values. This is the same
460as the @code{.dword} directive.
461
462@c YYYYYYYYYYYYYYYYYYYYYYYYYY
463@c ZZZZZZZZZZZZZZZZZZZZZZZZZZ
edc66de9 464
3a67e1a6
ST
465@cindex @code{.cfi_b_key_frame} directive, AArch64
466@item @code{.cfi_b_key_frame}
467The @code{.cfi_b_key_frame} directive inserts a 'B' character into the CIE
468corresponding to the current frame's FDE, meaning that its return address has
469been signed with the B-key. If two frames are signed with differing keys then
470they will not share the same CIE. This information is intended to be used by
471the stack unwinder in order to properly authenticate return addresses.
472
a06ea964
NC
473@end table
474
475@node AArch64 Opcodes
476@section Opcodes
477
478@cindex AArch64 opcodes
479@cindex opcodes for AArch64
df359aa7 480GAS implements all the standard AArch64 opcodes. It also
a06ea964 481implements several pseudo opcodes, including several synthetic load
34bca508 482instructions.
a06ea964
NC
483
484@table @code
485
486@cindex @code{LDR reg,=<expr>} pseudo op, AArch64
487@item LDR =
488@smallexample
489 ldr <register> , =<expression>
490@end smallexample
491
492The constant expression will be placed into the nearest literal pool (if it not
493already there) and a PC-relative LDR instruction will be generated.
494
495@end table
496
497For more information on the AArch64 instruction set and assembly language
498notation, see @samp{ARMv8 Instruction Set Overview} available at
499@uref{http://infocenter.arm.com}.
500
501
502@node AArch64 Mapping Symbols
503@section Mapping Symbols
504
505The AArch64 ELF specification requires that special symbols be inserted
506into object files to mark certain features:
507
508@table @code
509
510@cindex @code{$x}
511@item $x
512At the start of a region of code containing AArch64 instructions.
513
514@cindex @code{$d}
515@item $d
516At the start of a region of data.
517
518@end table
This page took 0.327382 seconds and 4 git commands to generate.