Debian Codegraph @

gcc/config/aarch64/aarch64-protos.h

raw
1 /* Machine description for AArch64 architecture.
2 Copyright (C) 2009-2025 Free Software Foundation, Inc.
3 Contributed by ARM Ltd.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21
22 #ifndef GCC_AARCH64_PROTOS_H
23 #define GCC_AARCH64_PROTOS_H
24
25 #include "input.h"
26 #include "config/arm/aarch-common.h"
27
28 /* SYMBOL_SMALL_ABSOLUTE: Generate symbol accesses through
29 high and lo relocs that calculate the base address using a PC
30 relative reloc.
31 So to get the address of foo, we generate
32 adrp x0, foo
33 add x0, x0, :lo12:foo
34
35 To load or store something to foo, we could use the corresponding
36 load store variants that generate an
37 ldr x0, [x0,:lo12:foo]
38 or
39 str x1, [x0, :lo12:foo]
40
41 This corresponds to the small code model of the compiler.
42
43 SYMBOL_SMALL_GOT_4G: Similar to the one above but this
44 gives us the GOT entry of the symbol being referred to :
45 Thus calculating the GOT entry for foo is done using the
46 following sequence of instructions. The ADRP instruction
47 gets us to the page containing the GOT entry of the symbol
48 and the got_lo12 gets us the actual offset in it, together
49 the base and offset, we can address 4G size GOT table.
50
51 adrp x0, :got:foo
52 ldr x0, [x0, :gotoff_lo12:foo]
53
54 This corresponds to the small PIC model of the compiler.
55
56 SYMBOL_SMALL_GOT_28K: Similar to SYMBOL_SMALL_GOT_4G, but used for symbol
57 restricted within 28K GOT table size.
58
59 ldr reg, [gp, #:gotpage_lo15:sym]
60
61 This corresponds to -fpic model for small memory model of the compiler.
62
63 SYMBOL_SMALL_TLSGD
64 SYMBOL_SMALL_TLSDESC
65 SYMBOL_SMALL_TLSIE
66 SYMBOL_TINY_TLSIE
67 SYMBOL_TLSLE12
68 SYMBOL_TLSLE24
69 SYMBOL_TLSLE32
70 SYMBOL_TLSLE48
71 Each of these represents a thread-local symbol, and corresponds to the
72 thread local storage relocation operator for the symbol being referred to.
73
74 SYMBOL_TINY_ABSOLUTE
75
76 Generate symbol accesses as a PC relative address using a single
77 instruction. To compute the address of symbol foo, we generate:
78
79 ADR x0, foo
80
81 SYMBOL_TINY_GOT
82
83 Generate symbol accesses via the GOT using a single PC relative
84 instruction. To compute the address of symbol foo, we generate:
85
86 ldr t0, :got:foo
87
88 The value of foo can subsequently read using:
89
90 ldrb t0, [t0]
91
92 SYMBOL_FORCE_TO_MEM : Global variables are addressed using
93 constant pool. All variable addresses are spilled into constant
94 pools. The constant pools themselves are addressed using PC
95 relative accesses. This only works for the large code model.
96 */
97 enum aarch64_symbol_type
98 {
99 SYMBOL_SMALL_ABSOLUTE,
100 SYMBOL_SMALL_GOT_28K,
101 SYMBOL_SMALL_GOT_4G,
102 SYMBOL_SMALL_TLSGD,
103 SYMBOL_SMALL_TLSDESC,
104 SYMBOL_SMALL_TLSIE,
105 SYMBOL_TINY_ABSOLUTE,
106 SYMBOL_TINY_GOT,
107 SYMBOL_TINY_TLSIE,
108 SYMBOL_TLSLE12,
109 SYMBOL_TLSLE24,
110 SYMBOL_TLSLE32,
111 SYMBOL_TLSLE48,
112 SYMBOL_FORCE_TO_MEM
113 };
114
115 /* Classifies the type of an address query.
116
117 ADDR_QUERY_M
118 Query what is valid for an "m" constraint and a memory_operand
119 (the rules are the same for both).
120
121 ADDR_QUERY_LDP_STP
122 Query what is valid for a load/store pair.
123
124 ADDR_QUERY_LDP_STP_N
125 Query what is valid for a load/store pair, but narrow the incoming mode
126 for address checking. This is used for the store_pair_lanes patterns.
127
128 ADDR_QUERY_ANY
129 Query what is valid for at least one memory constraint, which may
130 allow things that "m" doesn't. For example, the SVE LDR and STR
131 addressing modes allow a wider range of immediate offsets than "m"
132 does. */
133 enum aarch64_addr_query_type {
134 ADDR_QUERY_M,
135 ADDR_QUERY_LDP_STP,
136 ADDR_QUERY_LDP_STP_N,
137 ADDR_QUERY_ANY
138 };
139
140 /* Enumerates values that can be arbitrarily mixed into a calculation
141 in order to make the result of the calculation unique to its use case.
142
143 AARCH64_SALT_SSP_SET
144 AARCH64_SALT_SSP_TEST
145 Used when calculating the address of the stack protection canary value.
146 There is a separate value for setting and testing the canary, meaning
147 that these two operations produce unique addresses: they are different
148 from each other, and from all other address calculations.
149
150 The main purpose of this is to prevent the SET address being spilled
151 to the stack and reloaded for the TEST, since that would give an
152 attacker the opportunity to change the address of the expected
153 canary value. */
154 enum aarch64_salt_type {
155 AARCH64_SALT_SSP_SET,
156 AARCH64_SALT_SSP_TEST
157 };
158
159 /* A set of tuning parameters contains references to size and time
160 cost models and vectors for address cost calculations, register
161 move costs and memory move costs. */
162
163 /* Scaled addressing modes can vary cost depending on the mode of the
164 value to be loaded/stored. QImode values cannot use scaled
165 addressing modes. */
166
167 struct scale_addr_mode_cost
168 {
169 const int hi;
170 const int si;
171 const int di;
172 const int ti;
173 };
174
175 /* Additional cost for addresses. */
176 struct cpu_addrcost_table
177 {
178 const struct scale_addr_mode_cost addr_scale_costs;
179 const int pre_modify;
180 const int post_modify;
181 const int post_modify_ld3_st3;
182 const int post_modify_ld4_st4;
183 const int register_offset;
184 const int register_sextend;
185 const int register_zextend;
186 const int imm_offset;
187 };
188
189 /* Additional costs for register copies. Cost is for one register. */
190 struct cpu_regmove_cost
191 {
192 const int GP2GP;
193 const int GP2FP;
194 const int FP2GP;
195 const int FP2FP;
196 };
197
198 struct simd_vec_cost
199 {
200 /* Cost of any integer vector operation, excluding the ones handled
201 specially below. */
202 const int int_stmt_cost;
203
204 /* Cost of any fp vector operation, excluding the ones handled
205 specially below. */
206 const int fp_stmt_cost;
207
208 /* Per-vector cost of permuting vectors after an LD2, LD3 or LD4,
209 as well as the per-vector cost of permuting vectors before
210 an ST2, ST3 or ST4. */
211 const int ld2_st2_permute_cost;
212 const int ld3_st3_permute_cost;
213 const int ld4_st4_permute_cost;
214
215 /* Cost of a permute operation. */
216 const int permute_cost;
217
218 /* Cost of reductions for various vector types: iN is for N-bit
219 integer elements and fN is for N-bit floating-point elements.
220 We need to single out the element type because it affects the
221 depth of the reduction. */
222 const int reduc_i8_cost;
223 const int reduc_i16_cost;
224 const int reduc_i32_cost;
225 const int reduc_i64_cost;
226 const int reduc_f16_cost;
227 const int reduc_f32_cost;
228 const int reduc_f64_cost;
229
230 /* Additional cost of storing a single vector element, on top of the
231 normal cost of a scalar store. */
232 const int store_elt_extra_cost;
233
234 /* Cost of a vector-to-scalar operation. */
235 const int vec_to_scalar_cost;
236
237 /* Cost of a scalar-to-vector operation. */
238 const int scalar_to_vec_cost;
239
240 /* Cost of an aligned vector load. */
241 const int align_load_cost;
242
243 /* Cost of an unaligned vector load. */
244 const int unalign_load_cost;
245
246 /* Cost of an unaligned vector store. */
247 const int unalign_store_cost;
248
249 /* Cost of a vector store. */
250 const int store_cost;
251 };
252
253 typedef struct simd_vec_cost advsimd_vec_cost;
254
255 /* SVE-specific extensions to the information provided by simd_vec_cost. */
256 struct sve_vec_cost : simd_vec_cost
257 {
258 CONSTEXPR sve_vec_cost (const simd_vec_cost &base,
259 unsigned int clast_cost,
260 unsigned int fadda_f16_cost,
261 unsigned int fadda_f32_cost,
262 unsigned int fadda_f64_cost,
263 unsigned int gather_load_x32_cost,
264 unsigned int gather_load_x64_cost,
265 unsigned int gather_load_x32_init_cost,
266 unsigned int gather_load_x64_init_cost,
267 unsigned int scatter_store_elt_cost)
268 : simd_vec_cost (base),
269 clast_cost (clast_cost),
270 fadda_f16_cost (fadda_f16_cost),
271 fadda_f32_cost (fadda_f32_cost),
272 fadda_f64_cost (fadda_f64_cost),
273 gather_load_x32_cost (gather_load_x32_cost),
274 gather_load_x64_cost (gather_load_x64_cost),
275 gather_load_x32_init_cost (gather_load_x32_init_cost),
276 gather_load_x64_init_cost (gather_load_x64_init_cost),
277 scatter_store_elt_cost (scatter_store_elt_cost)
278 {}
279
280 /* The cost of a vector-to-scalar CLASTA or CLASTB instruction,
281 with the scalar being stored in FP registers. This cost is
282 assumed to be a cycle latency. */
283 const int clast_cost;
284
285 /* The costs of FADDA for the three data types that it supports.
286 These costs are assumed to be cycle latencies. */
287 const int fadda_f16_cost;
288 const int fadda_f32_cost;
289 const int fadda_f64_cost;
290
291 /* The cost of a gather load instruction. The x32 value is for loads
292 of 32-bit elements and the x64 value is for loads of 64-bit elements. */
293 const int gather_load_x32_cost;
294 const int gather_load_x64_cost;
295
296 /* Additional loop initialization cost of using a gather load instruction. The x32
297 value is for loads of 32-bit elements and the x64 value is for loads of
298 64-bit elements. */
299 const int gather_load_x32_init_cost;
300 const int gather_load_x64_init_cost;
301
302 /* The per-element cost of a scatter store. */
303 const int scatter_store_elt_cost;
304 };
305
306 /* Base information about how the CPU issues code, containing
307 information that is relevant to scalar, Advanced SIMD and SVE
308 operations.
309
310 The structure uses the general term "operation" to refer to
311 whichever subdivision of an instruction makes sense for the CPU.
312 These operations would typically be micro operations or macro
313 operations.
314
315 Note that this structure and the ones derived from it are only
316 as general as they need to be for the CPUs that currently use them.
317 They will probably need to be extended or refined as more CPUs are
318 added. */
319 struct aarch64_base_vec_issue_info
320 {
321 /* How many loads and stores can be issued per cycle. */
322 const unsigned int loads_stores_per_cycle;
323
324 /* How many stores can be issued per cycle. */
325 const unsigned int stores_per_cycle;
326
327 /* How many integer or FP/SIMD operations can be issued per cycle.
328
329 Currently we don't try to distinguish the two. For vector code,
330 we only really track FP/SIMD operations during vector costing;
331 we don't for example try to cost arithmetic operations like
332 address calculations, which are only decided later during ivopts.
333
334 For scalar code, we effectively assume that code operates entirely
335 on integers or entirely on floating-point values. Again, we don't
336 try to take address calculations into account.
337
338 This is not very precise, but it's only meant to be a heuristic.
339 We could certainly try to do better in future if there's an example
340 of something that would benefit. */
341 const unsigned int general_ops_per_cycle;
342
343 /* How many FP/SIMD operations to count for a floating-point or
344 vector load operation.
345
346 When constructing an Advanced SIMD vector from elements that have
347 been loaded from memory, these values apply to each individual load.
348 When using an SVE gather load, the values apply to each element of
349 the gather. */
350 const unsigned int fp_simd_load_general_ops;
351
352 /* How many FP/SIMD operations to count for a floating-point or
353 vector store operation.
354
355 When storing individual elements of an Advanced SIMD vector out to
356 memory, these values apply to each individual store. When using an
357 SVE scatter store, these values apply to each element of the scatter. */
358 const unsigned int fp_simd_store_general_ops;
359 };
360
361 using aarch64_scalar_vec_issue_info = aarch64_base_vec_issue_info;
362
363 /* Base information about the issue stage for vector operations.
364 This structure contains information that is relevant to both
365 Advanced SIMD and SVE. */
366 struct aarch64_simd_vec_issue_info : aarch64_base_vec_issue_info
367 {
368 CONSTEXPR aarch64_simd_vec_issue_info (aarch64_base_vec_issue_info base,
369 unsigned int ld2_st2_general_ops,
370 unsigned int ld3_st3_general_ops,
371 unsigned int ld4_st4_general_ops)
372 : aarch64_base_vec_issue_info (base),
373 ld2_st2_general_ops (ld2_st2_general_ops),
374 ld3_st3_general_ops (ld3_st3_general_ops),
375 ld4_st4_general_ops (ld4_st4_general_ops)
376 {}
377
378 /* How many FP/SIMD operations to count for each vector loaded or
379 stored by an LD[234] or ST[234] operation, in addition to the
380 base costs given in the parent class. For example, the full
381 number of operations for an LD3 would be:
382
383 load ops: 3
384 general ops: 3 * (fp_simd_load_general_ops + ld3_st3_general_ops). */
385 const unsigned int ld2_st2_general_ops;
386 const unsigned int ld3_st3_general_ops;
387 const unsigned int ld4_st4_general_ops;
388 };
389
390 using aarch64_advsimd_vec_issue_info = aarch64_simd_vec_issue_info;
391
392 /* Information about the issue stage for SVE. The main thing this adds
393 is a concept of "predicate operations". */
394 struct aarch64_sve_vec_issue_info : aarch64_simd_vec_issue_info
395 {
396 CONSTEXPR aarch64_sve_vec_issue_info
397 (aarch64_simd_vec_issue_info base,
398 unsigned int pred_ops_per_cycle,
399 unsigned int while_pred_ops,
400 unsigned int int_cmp_pred_ops,
401 unsigned int fp_cmp_pred_ops,
402 unsigned int gather_scatter_pair_general_ops,
403 unsigned int gather_scatter_pair_pred_ops)
404 : aarch64_simd_vec_issue_info (base),
405 pred_ops_per_cycle (pred_ops_per_cycle),
406 while_pred_ops (while_pred_ops),
407 int_cmp_pred_ops (int_cmp_pred_ops),
408 fp_cmp_pred_ops (fp_cmp_pred_ops),
409 gather_scatter_pair_general_ops (gather_scatter_pair_general_ops),
410 gather_scatter_pair_pred_ops (gather_scatter_pair_pred_ops)
411 {}
412
413 /* How many predicate operations can be issued per cycle. */
414 const unsigned int pred_ops_per_cycle;
415
416 /* How many predicate operations are generated by a WHILExx
417 instruction. */
418 const unsigned int while_pred_ops;
419
420 /* How many predicate operations are generated by an integer
421 comparison instruction. */
422 const unsigned int int_cmp_pred_ops;
423
424 /* How many predicate operations are generated by a floating-point
425 comparison instruction. */
426 const unsigned int fp_cmp_pred_ops;
427
428 /* How many general and predicate operations are generated by each pair
429 of elements in a gather load or scatter store. These values apply
430 on top of the per-element counts recorded in fp_simd_load_general_ops
431 and fp_simd_store_general_ops.
432
433 The reason for using pairs is that that is the largest possible
434 granule size for 128-bit SVE, which can load and store 2 64-bit
435 elements or 4 32-bit elements. */
436 const unsigned int gather_scatter_pair_general_ops;
437 const unsigned int gather_scatter_pair_pred_ops;
438 };
439
440 /* Information related to instruction issue for a particular CPU. */
441 struct aarch64_vec_issue_info
442 {
443 const aarch64_base_vec_issue_info *const scalar;
444 const aarch64_simd_vec_issue_info *const advsimd;
445 const aarch64_sve_vec_issue_info *const sve;
446 };
447
448 /* Cost for vector insn classes. */
449 struct cpu_vector_cost
450 {
451 /* Cost of any integer scalar operation, excluding load and store. */
452 const int scalar_int_stmt_cost;
453
454 /* Cost of any fp scalar operation, excluding load and store. */
455 const int scalar_fp_stmt_cost;
456
457 /* Cost of a scalar load. */
458 const int scalar_load_cost;
459
460 /* Cost of a scalar store. */
461 const int scalar_store_cost;
462
463 /* Cost of a taken branch. */
464 const int cond_taken_branch_cost;
465
466 /* Cost of a not-taken branch. */
467 const int cond_not_taken_branch_cost;
468
469 /* Cost of an Advanced SIMD operations. */
470 const advsimd_vec_cost *advsimd;
471
472 /* Cost of an SVE operations, or null if SVE is not implemented. */
473 const sve_vec_cost *sve;
474
475 /* Issue information, or null if none is provided. */
476 const aarch64_vec_issue_info *const issue_info;
477 };
478
479 /* Branch costs. */
480 struct cpu_branch_cost
481 {
482 const int predictable; /* Predictable branch or optimizing for size. */
483 const int unpredictable; /* Unpredictable branch or optimizing for speed. */
484 const int br_mispredict_factor; /* Scale factor for cost of misprediction on branches. */
485 };
486
487 /* Control approximate alternatives to certain FP operators. */
488 #define AARCH64_APPROX_MODE(MODE) \
489 ((MIN_MODE_FLOAT <= (MODE) && (MODE) <= MAX_MODE_FLOAT) \
490 ? ((uint64_t) 1 << ((MODE) - MIN_MODE_FLOAT)) \
491 : (MIN_MODE_VECTOR_FLOAT <= (MODE) && (MODE) <= MAX_MODE_VECTOR_FLOAT) \
492 ? ((uint64_t) 1 << ((MODE) - MIN_MODE_VECTOR_FLOAT \
493 + MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) \
494 : (0))
495 #define AARCH64_APPROX_NONE ((uint64_t) 0)
496 #define AARCH64_APPROX_ALL (~(uint64_t) 0)
497
498 /* Allowed modes for approximations. */
499 struct cpu_approx_modes
500 {
501 const uint64_t division; /* Division. */
502 const uint64_t sqrt; /* Square root. */
503 const uint64_t recip_sqrt; /* Reciprocal square root. */
504 };
505
506 /* Cache prefetch settings for prefetch-loop-arrays. */
507 struct cpu_prefetch_tune
508 {
509 const int num_slots;
510 const int l1_cache_size;
511 const int l1_cache_line_size;
512 const int l2_cache_size;
513 /* Whether software prefetch hints should be issued for non-constant
514 strides. */
515 const bool prefetch_dynamic_strides;
516 /* The minimum constant stride beyond which we should use prefetch
517 hints for. */
518 const int minimum_stride;
519 const int default_opt_level;
520 };
521
522 /* Model the costs for loads/stores for the register allocators so that it can
523 do more accurate spill heuristics. */
524 struct cpu_memmov_cost
525 {
526 int load_int;
527 int store_int;
528 int load_fp;
529 int store_fp;
530 int load_pred;
531 int store_pred;
532 };
533
534 struct tune_params
535 {
536 const struct cpu_cost_table *insn_extra_cost;
537 const struct cpu_addrcost_table *addr_cost;
538 const struct cpu_regmove_cost *regmove_cost;
539 const struct cpu_vector_cost *vec_costs;
540 const struct cpu_branch_cost *branch_costs;
541 const struct cpu_approx_modes *approx_modes;
542 /* A bitmask of the possible SVE register widths in bits,
543 or SVE_NOT_IMPLEMENTED if not applicable. Only used for tuning
544 decisions, does not disable VLA vectorization. */
545 unsigned int sve_width;
546 /* Structure used by reload to cost spills. */
547 struct cpu_memmov_cost memmov_cost;
548 int issue_rate;
549 unsigned int fusible_ops;
550 const char *function_align;
551 const char *jump_align;
552 const char *loop_align;
553 int int_reassoc_width;
554 int fp_reassoc_width;
555 int fma_reassoc_width;
556 int vec_reassoc_width;
557 int min_div_recip_mul_sf;
558 int min_div_recip_mul_df;
559 /* Value for aarch64_case_values_threshold; or 0 for the default. */
560 unsigned int max_case_values;
561 /* An enum specifying how to take into account CPU autoprefetch capabilities
562 during instruction scheduling:
563 - AUTOPREFETCHER_OFF: Do not take autoprefetch capabilities into account.
564 - AUTOPREFETCHER_WEAK: Attempt to sort sequences of loads/store in order of
565 offsets but allow the pipeline hazard recognizer to alter that order to
566 maximize multi-issue opportunities.
567 - AUTOPREFETCHER_STRONG: Attempt to sort sequences of loads/store in order of
568 offsets and prefer this even if it restricts multi-issue opportunities. */
569
570 enum aarch64_autoprefetch_model
571 {
572 AUTOPREFETCHER_OFF,
573 AUTOPREFETCHER_WEAK,
574 AUTOPREFETCHER_STRONG
575 } autoprefetcher_model;
576
577 unsigned int extra_tuning_flags;
578
579 /* Place prefetch struct pointer at the end to enable type checking
580 errors when tune_params misses elements (e.g., from erroneous merges). */
581 const struct cpu_prefetch_tune *prefetch;
582
583 /* Define models for the aarch64_ldp_stp_policy. */
584 enum aarch64_ldp_stp_policy ldp_policy_model, stp_policy_model;
585 };
586
587 /* Classifies an address.
588
589 ADDRESS_REG_IMM
590 A simple base register plus immediate offset.
591
592 ADDRESS_REG_WB
593 A base register indexed by immediate offset with writeback.
594
595 ADDRESS_REG_REG
596 A base register indexed by (optionally scaled) register.
597
598 ADDRESS_REG_UXTW
599 A base register indexed by (optionally scaled) zero-extended register.
600
601 ADDRESS_REG_SXTW
602 A base register indexed by (optionally scaled) sign-extended register.
603
604 ADDRESS_LO_SUM
605 A LO_SUM rtx with a base register and "LO12" symbol relocation.
606
607 ADDRESS_SYMBOLIC:
608 A constant symbolic address, in pc-relative literal pool. */
609
610 enum aarch64_address_type {
611 ADDRESS_REG_IMM,
612 ADDRESS_REG_WB,
613 ADDRESS_REG_REG,
614 ADDRESS_REG_UXTW,
615 ADDRESS_REG_SXTW,
616 ADDRESS_LO_SUM,
617 ADDRESS_SYMBOLIC
618 };
619
620 /* Address information. */
621 struct aarch64_address_info {
622 enum aarch64_address_type type;
623 rtx base;
624 rtx offset;
625 poly_int64 const_offset;
626 int shift;
627 enum aarch64_symbol_type symbol_type;
628 };
629
630 #define AARCH64_FUSION_PAIR(x, name) \
631 AARCH64_FUSE_##name##_index,
632 /* Supported fusion operations. */
633 enum aarch64_fusion_pairs_index
634 {
635 #include "aarch64-fusion-pairs.def"
636 AARCH64_FUSE_index_END
637 };
638
639 #define AARCH64_FUSION_PAIR(x, name) \
640 AARCH64_FUSE_##name = (1u << AARCH64_FUSE_##name##_index),
641 /* Supported fusion operations. */
642 enum aarch64_fusion_pairs
643 {
644 AARCH64_FUSE_NOTHING = 0,
645 #include "aarch64-fusion-pairs.def"
646 AARCH64_FUSE_ALL = (1u << AARCH64_FUSE_index_END) - 1
647 };
648
649 #define AARCH64_EXTRA_TUNING_OPTION(x, name) \
650 AARCH64_EXTRA_TUNE_##name##_index,
651 /* Supported tuning flags indexes. */
652 enum aarch64_extra_tuning_flags_index
653 {
654 #include "aarch64-tuning-flags.def"
655 AARCH64_EXTRA_TUNE_index_END
656 };
657
658
659 #define AARCH64_EXTRA_TUNING_OPTION(x, name) \
660 AARCH64_EXTRA_TUNE_##name = (1u << AARCH64_EXTRA_TUNE_##name##_index),
661 /* Supported tuning flags. */
662 enum aarch64_extra_tuning_flags
663 {
664 AARCH64_EXTRA_TUNE_NONE = 0,
665 #include "aarch64-tuning-flags.def"
666 AARCH64_EXTRA_TUNE_ALL = (1u << AARCH64_EXTRA_TUNE_index_END) - 1
667 };
668
669 extern struct tune_params aarch64_tune_params;
670
671 /* The available SVE predicate patterns, known in the ACLE as "svpattern". */
672 #define AARCH64_FOR_SVPATTERN(T) \
673 T (POW2, pow2, 0) \
674 T (VL1, vl1, 1) \
675 T (VL2, vl2, 2) \
676 T (VL3, vl3, 3) \
677 T (VL4, vl4, 4) \
678 T (VL5, vl5, 5) \
679 T (VL6, vl6, 6) \
680 T (VL7, vl7, 7) \
681 T (VL8, vl8, 8) \
682 T (VL16, vl16, 9) \
683 T (VL32, vl32, 10) \
684 T (VL64, vl64, 11) \
685 T (VL128, vl128, 12) \
686 T (VL256, vl256, 13) \
687 T (MUL4, mul4, 29) \
688 T (MUL3, mul3, 30) \
689 T (ALL, all, 31)
690
691 /* The available SVE prefetch operations, known in the ACLE as "svprfop". */
692 #define AARCH64_FOR_SVPRFOP(T) \
693 T (PLDL1KEEP, pldl1keep, 0) \
694 T (PLDL1STRM, pldl1strm, 1) \
695 T (PLDL2KEEP, pldl2keep, 2) \
696 T (PLDL2STRM, pldl2strm, 3) \
697 T (PLDL3KEEP, pldl3keep, 4) \
698 T (PLDL3STRM, pldl3strm, 5) \
699 T (PSTL1KEEP, pstl1keep, 8) \
700 T (PSTL1STRM, pstl1strm, 9) \
701 T (PSTL2KEEP, pstl2keep, 10) \
702 T (PSTL2STRM, pstl2strm, 11) \
703 T (PSTL3KEEP, pstl3keep, 12) \
704 T (PSTL3STRM, pstl3strm, 13)
705
706 #define AARCH64_SVENUM(UPPER, LOWER, VALUE) AARCH64_SV_##UPPER = VALUE,
707 enum aarch64_svpattern {
708 AARCH64_FOR_SVPATTERN (AARCH64_SVENUM)
709 AARCH64_NUM_SVPATTERNS
710 };
711
712 enum aarch64_svprfop {
713 AARCH64_FOR_SVPRFOP (AARCH64_SVENUM)
714 AARCH64_NUM_SVPRFOPS
715 };
716 #undef AARCH64_SVENUM
717
718 /* It's convenient to divide the built-in function codes into groups,
719 rather than having everything in a single enum. This type enumerates
720 those groups. */
721 enum aarch64_builtin_class
722 {
723 AARCH64_BUILTIN_GENERAL,
724 AARCH64_BUILTIN_SVE
725 };
726
727 /* Built-in function codes are structured so that the low
728 AARCH64_BUILTIN_SHIFT bits contain the aarch64_builtin_class
729 and the upper bits contain a group-specific subcode. */
730 const unsigned int AARCH64_BUILTIN_SHIFT = 1;
731
732 /* Mask that selects the aarch64_builtin_class part of a function code. */
733 const unsigned int AARCH64_BUILTIN_CLASS = (1 << AARCH64_BUILTIN_SHIFT) - 1;
734
735 /* RAII class for enabling enough features to define built-in types
736 and implement the arm_neon.h pragma. */
737 class aarch64_target_switcher
738 {
739 public:
740 aarch64_target_switcher (aarch64_feature_flags flags = 0);
741 ~aarch64_target_switcher ();
742
743 private:
744 aarch64_feature_flags m_old_asm_isa_flags;
745 bool m_old_general_regs_only;
746 tree m_old_target_pragma;
747 bool m_old_have_regs_of_mode[MAX_MACHINE_MODE];
748 };
749
750 /* Represents the ISA requirements of an intrinsic function, or of some
751 other similar operation. It stores separate feature flags for
752 non-streaming mode and for streaming-mode; both requirements must
753 be met in streaming-compatible mode. */
754 struct aarch64_required_extensions
755 {
756 /* Return a requirement that includes FLAGS on top of any existing
757 requirements. */
758 inline CONSTEXPR aarch64_required_extensions
759 and_also (aarch64_feature_flags flags)
760 {
761 return { sm_off ? sm_off | flags : 0,
762 sm_on ? sm_on | flags : 0 };
763 }
764
765 /* Return a requirement that is as restrictive as possible while still being
766 no more restrictive than THIS and no more restrictive than OTHER. */
767 inline CONSTEXPR aarch64_required_extensions
768 common_denominator (const aarch64_required_extensions &other)
769 {
770 return { sm_off && other.sm_off
771 ? sm_off & other.sm_off
772 : sm_off | other.sm_off,
773 sm_on && other.sm_on
774 ? sm_on & other.sm_on
775 : sm_on | other.sm_on };
776 }
777
778 /* Require non-streaming mode and the features in FLAGS. */
779 static inline CONSTEXPR aarch64_required_extensions
780 nonstreaming_only (aarch64_feature_flags flags)
781 {
782 return { AARCH64_FL_SM_OFF | flags, 0 };
783 }
784
785 /* Likewise, and also require SVE. */
786 static inline CONSTEXPR aarch64_required_extensions
787 nonstreaming_sve (aarch64_feature_flags flags)
788 {
789 return nonstreaming_only (AARCH64_FL_SVE | flags);
790 }
791
792 /* Allow both streaming and non-streaming mode, requiring the features
793 in FLAGS for both cases. */
794 static inline CONSTEXPR aarch64_required_extensions
795 streaming_compatible (aarch64_feature_flags flags)
796 {
797 return { AARCH64_FL_SM_OFF | flags, AARCH64_FL_SM_ON | flags };
798 }
799
800 /* Likewise, and also require SVE for non-streaming mode. */
801 static inline CONSTEXPR aarch64_required_extensions
802 ssve (aarch64_feature_flags flags)
803 {
804 return streaming_compatible (AARCH64_FL_SVE | flags, flags);
805 }
806
807 /* Allow both streaming and non-streaming mode, requiring the features
808 in SM_OFF for non-streaming mode and the features in SM_ON for
809 streaming mode. */
810 static inline CONSTEXPR aarch64_required_extensions
811 streaming_compatible (aarch64_feature_flags sm_off,
812 aarch64_feature_flags sm_on)
813 {
814 return { AARCH64_FL_SM_OFF | sm_off, AARCH64_FL_SM_ON | sm_on };
815 }
816
817 /* Likewise, and also require SVE for non-streaming mode. */
818 static inline CONSTEXPR aarch64_required_extensions
819 sve_and_sme (aarch64_feature_flags sm_off, aarch64_feature_flags sm_on)
820 {
821 return streaming_compatible (AARCH64_FL_SVE | sm_off, sm_on);
822 }
823
824 /* Require streaming mode and the features in FLAGS. */
825 static inline CONSTEXPR aarch64_required_extensions
826 streaming_only (aarch64_feature_flags flags)
827 {
828 return { 0, AARCH64_FL_SM_ON | flags };
829 }
830
831 /* The ISA requirements in non-streaming mode, or 0 if the operation
832 is only allowed in streaming mode. When this field is nonzero,
833 it always includes AARCH64_FL_SM_OFF. */
834 aarch64_feature_flags sm_off;
835
836 /* The ISA requirements in streaming mode, or 0 if the operation is only
837 allowed in non-streaming mode. When this field is nonzero,
838 it always includes AARCH64_FL_SM_ON.
839
840 This field should not normally include AARCH64_FL_SME, since we
841 would not be in streaming mode if SME wasn't supported. Excluding
842 AARCH64_FL_SME makes it easier to handle streaming-compatible rules
843 since (for example) svadd_x should be available in streaming-compatible
844 functions even without +sme. */
845 aarch64_feature_flags sm_on;
846 };
847
848 void aarch64_post_cfi_startproc (void);
849 poly_int64 aarch64_initial_elimination_offset (unsigned, unsigned);
850 int aarch64_get_condition_code (rtx);
851 bool aarch64_address_valid_for_prefetch_p (rtx, bool);
852 bool aarch64_bitmask_imm (unsigned HOST_WIDE_INT val, machine_mode);
853 unsigned HOST_WIDE_INT aarch64_and_split_imm1 (HOST_WIDE_INT val_in);
854 unsigned HOST_WIDE_INT aarch64_and_split_imm2 (HOST_WIDE_INT val_in);
855 bool aarch64_and_bitmask_imm (unsigned HOST_WIDE_INT val_in, machine_mode mode);
856 int aarch64_branch_cost (bool, bool);
857 enum aarch64_symbol_type aarch64_classify_symbolic_expression (rtx);
858 bool aarch64_advsimd_struct_mode_p (machine_mode mode);
859 opt_machine_mode aarch64_v64_mode (scalar_mode);
860 opt_machine_mode aarch64_v128_mode (scalar_mode);
861 opt_machine_mode aarch64_full_sve_mode (scalar_mode);
862 bool aarch64_can_const_movi_rtx_p (rtx x, machine_mode mode);
863 bool aarch64_valid_fp_move (rtx, rtx, machine_mode);
864 bool aarch64_const_vec_all_same_int_p (rtx, HOST_WIDE_INT);
865 bool aarch64_const_vec_all_same_in_range_p (rtx, HOST_WIDE_INT,
866 HOST_WIDE_INT);
867 bool aarch64_const_vec_rnd_cst_p (rtx, rtx);
868 bool aarch64_rnd_imm_p (rtx);
869 bool aarch64_constant_address_p (rtx);
870 bool aarch64_emit_approx_div (rtx, rtx, rtx);
871 bool aarch64_emit_approx_sqrt (rtx, rtx, bool);
872 bool aarch64_emit_opt_vec_rotate (rtx, rtx, rtx);
873 tree aarch64_vector_load_decl (tree);
874 rtx aarch64_gen_callee_cookie (aarch64_isa_mode, arm_pcs, bool);
875 void aarch64_expand_call (rtx, rtx, rtx, bool);
876 bool aarch64_expand_cpymem_mops (rtx *, bool);
877 bool aarch64_expand_cpymem (rtx *, bool);
878 bool aarch64_expand_setmem (rtx *);
879 bool aarch64_float_const_zero_rtx_p (rtx);
880 bool aarch64_float_const_rtx_p (rtx);
881 bool aarch64_const_zero_rtx_p (rtx);
882 bool aarch64_function_arg_regno_p (unsigned);
883 bool aarch64_fusion_enabled_p (enum aarch64_fusion_pairs);
884 bool aarch64_gen_cpymemqi (rtx *);
885 bool aarch64_is_extend_from_extract (scalar_int_mode, rtx, rtx);
886 bool aarch64_is_long_call_p (rtx);
887 bool aarch64_is_noplt_call_p (rtx);
888 bool aarch64_label_mentioned_p (rtx);
889 void aarch64_declare_function_name (FILE *, const char*, tree);
890 void aarch64_asm_output_alias (FILE *, const tree, const tree);
891 void aarch64_asm_output_external (FILE *, tree, const char*);
892 bool aarch64_legitimate_pic_operand_p (rtx);
893 bool aarch64_mask_and_shift_for_ubfiz_p (scalar_int_mode, rtx, rtx);
894 bool aarch64_masks_and_shift_for_bfi_p (scalar_int_mode, unsigned HOST_WIDE_INT,
895 unsigned HOST_WIDE_INT,
896 unsigned HOST_WIDE_INT);
897 rtx aarch64_sve_reinterpret (machine_mode, rtx);
898 bool aarch64_zero_extend_const_eq (machine_mode, rtx, machine_mode, rtx);
899 bool aarch64_move_imm (unsigned HOST_WIDE_INT, machine_mode);
900 machine_mode aarch64_sve_int_mode (machine_mode);
901 opt_machine_mode aarch64_sve_pred_mode (unsigned int);
902 machine_mode aarch64_sve_pred_mode (machine_mode);
903 opt_machine_mode aarch64_advsimd_vector_array_mode (machine_mode,
904 unsigned HOST_WIDE_INT);
905 opt_machine_mode aarch64_sve_data_mode (scalar_mode, poly_uint64);
906 bool aarch64_sve_mode_p (machine_mode);
907 HOST_WIDE_INT aarch64_fold_sve_cnt_pat (aarch64_svpattern, unsigned int);
908 bool aarch64_sve_cnt_immediate_p (rtx);
909 bool aarch64_sve_scalar_inc_dec_immediate_p (rtx);
910 bool aarch64_sve_rdvl_immediate_p (rtx);
911 bool aarch64_sve_addvl_addpl_immediate_p (rtx);
912 bool aarch64_sve_vector_inc_dec_immediate_p (rtx);
913 int aarch64_add_offset_temporaries (rtx);
914 void aarch64_split_add_offset (scalar_int_mode, rtx, rtx, rtx, rtx, rtx);
915 bool aarch64_rdsvl_immediate_p (const_rtx);
916 rtx aarch64_sme_vq_immediate (machine_mode mode, HOST_WIDE_INT,
917 aarch64_isa_mode);
918 char *aarch64_output_rdsvl (const_rtx);
919 bool aarch64_addsvl_addspl_immediate_p (const_rtx);
920 char *aarch64_output_addsvl_addspl (rtx);
921 bool aarch64_mov_operand_p (rtx, machine_mode);
922 rtx aarch64_reverse_mask (machine_mode, unsigned int);
923 bool aarch64_offset_7bit_signed_scaled_p (machine_mode, poly_int64);
924 bool aarch64_offset_9bit_signed_unscaled_p (machine_mode, poly_int64);
925 char *aarch64_output_sve_prefetch (const char *, rtx, const char *);
926 char *aarch64_output_sve_cnt_immediate (const char *, const char *, rtx);
927 char *aarch64_output_sve_cnt_pat_immediate (const char *, const char *, rtx *);
928 char *aarch64_output_sve_scalar_inc_dec (rtx);
929 char *aarch64_output_sve_rdvl (rtx);
930 char *aarch64_output_sve_addvl_addpl (rtx);
931 char *aarch64_output_sve_vector_inc_dec (const char *, rtx);
932 char *aarch64_output_scalar_simd_mov_immediate (rtx, scalar_int_mode);
933 char *aarch64_output_simd_mov_imm (rtx, unsigned);
934 char *aarch64_output_simd_orr_imm (rtx, unsigned);
935 char *aarch64_output_simd_and_imm (rtx, unsigned);
936 char *aarch64_output_simd_xor_imm (rtx, unsigned);
937
938 char *aarch64_output_sve_mov_immediate (rtx);
939 char *aarch64_output_sve_ptrues (rtx);
940 bool aarch64_pad_reg_upward (machine_mode, const_tree, bool);
941 bool aarch64_regno_ok_for_base_p (int, bool);
942 bool aarch64_regno_ok_for_index_p (int, bool);
943 bool aarch64_reinterpret_float_as_int (rtx value, unsigned HOST_WIDE_INT *fail);
944 bool aarch64_simd_check_vect_par_cnst_half (rtx op, machine_mode mode,
945 bool high);
946 bool aarch64_parallel_select_half_p (machine_mode, rtx);
947 bool aarch64_pars_overlap_p (rtx, rtx);
948 bool aarch64_simd_scalar_immediate_valid_for_move (rtx, scalar_int_mode);
949 bool aarch64_simd_shift_imm_p (rtx, machine_mode, bool);
950 bool aarch64_sve_ptrue_svpattern_p (rtx, struct simd_immediate_info *);
951 bool aarch64_simd_valid_and_imm (rtx);
952 bool aarch64_simd_valid_mov_imm (rtx);
953 bool aarch64_simd_valid_orr_imm (rtx);
954 bool aarch64_simd_valid_xor_imm (rtx);
955 bool aarch64_valid_sysreg_name_p (const char *);
956 const char *aarch64_retrieve_sysreg (const char *, bool, bool);
957 rtx aarch64_check_zero_based_sve_index_immediate (rtx);
958 bool aarch64_maybe_generate_simd_constant (rtx, rtx, machine_mode);
959 bool aarch64_simd_special_constant_p (rtx, machine_mode);
960 bool aarch64_sve_index_immediate_p (rtx);
961 bool aarch64_sve_arith_immediate_p (machine_mode, rtx, bool);
962 bool aarch64_sve_sqadd_sqsub_immediate_p (machine_mode, rtx, bool);
963 bool aarch64_sve_bitmask_immediate_p (rtx);
964 bool aarch64_sve_dup_immediate_p (rtx);
965 bool aarch64_sve_cmp_immediate_p (rtx, bool);
966 bool aarch64_sve_float_arith_immediate_p (rtx, bool);
967 bool aarch64_sve_float_mul_immediate_p (rtx);
968 bool aarch64_split_dimode_const_store (rtx, rtx);
969 bool aarch64_symbolic_address_p (rtx);
970 bool aarch64_uimm12_shift (unsigned HOST_WIDE_INT);
971 int aarch64_movk_shift (const wide_int_ref &, const wide_int_ref &);
972 bool aarch64_is_mov_xn_imm (unsigned HOST_WIDE_INT);
973 bool aarch64_use_return_insn_p (void);
974 bool aarch64_use_simple_return_insn_p (void);
975 const char *aarch64_output_casesi (rtx *);
976 const char *aarch64_output_load_tp (rtx);
977 const char *aarch64_output_sme_zero_za (rtx);
978
979 arm_pcs aarch64_tlsdesc_abi_id ();
980 enum aarch64_symbol_type aarch64_classify_symbol (rtx, HOST_WIDE_INT);
981 enum aarch64_symbol_type aarch64_classify_tls_symbol (rtx);
982 enum reg_class aarch64_regno_regclass (unsigned);
983 int aarch64_asm_preferred_eh_data_format (int, int);
984 int aarch64_fpconst_pow_of_2 (rtx);
985 int aarch64_fpconst_pow2_recip (rtx);
986 machine_mode aarch64_hard_regno_caller_save_mode (unsigned, unsigned,
987 machine_mode);
988 int aarch64_uxt_size (int, HOST_WIDE_INT);
989 int aarch64_vec_fpconst_pow_of_2 (rtx);
990 rtx aarch64_mask_from_zextract_ops (rtx, rtx);
991 rtx aarch64_return_addr_rtx (void);
992 rtx aarch64_return_addr (int, rtx);
993 rtx aarch64_simd_gen_const_vector_dup (machine_mode, HOST_WIDE_INT);
994 rtx aarch64_gen_shareable_zero (machine_mode);
995 bool aarch64_split_simd_shift_p (rtx_insn *);
996 bool aarch64_simd_mem_operand_p (rtx);
997 bool aarch64_sve_ld1r_operand_p (rtx);
998 bool aarch64_sve_ld1rq_operand_p (rtx);
999 bool aarch64_sve_ld1ro_operand_p (rtx, scalar_mode);
1000 bool aarch64_sve_ldff1_operand_p (rtx);
1001 bool aarch64_sve_ldnf1_operand_p (rtx);
1002 bool aarch64_sve_ldr_operand_p (rtx);
1003 bool aarch64_sve_prefetch_operand_p (rtx, machine_mode);
1004 bool aarch64_sve_struct_memory_operand_p (rtx);
1005 bool aarch64_sme_ldr_vnum_offset_p (rtx, rtx);
1006 rtx aarch64_simd_vect_par_cnst_half (machine_mode, int, bool);
1007 rtx aarch64_gen_stepped_int_parallel (unsigned int, int, int);
1008 bool aarch64_stepped_int_parallel_p (rtx, int);
1009 bool aarch64_strided_registers_p (rtx *, unsigned int, unsigned int);
1010 rtx aarch64_tls_get_addr (void);
1011 unsigned aarch64_debugger_regno (unsigned);
1012 unsigned aarch64_trampoline_size (void);
1013 void aarch64_asm_output_labelref (FILE *, const char *);
1014 void aarch64_cpu_cpp_builtins (cpp_reader *);
1015 const char * aarch64_gen_far_branch (rtx *, int, const char *, const char *);
1016 const char * aarch64_output_probe_stack_range (rtx, rtx);
1017 const char * aarch64_output_probe_sve_stack_clash (rtx, rtx, rtx, rtx);
1018 void aarch64_err_no_fpadvsimd (machine_mode);
1019 void aarch64_expand_epilogue (rtx_call_insn *);
1020 rtx aarch64_ptrue_all (unsigned int);
1021 opt_machine_mode aarch64_ptrue_all_mode (rtx);
1022 rtx aarch64_convert_sve_data_to_pred (rtx, machine_mode, rtx);
1023 rtx aarch64_expand_sve_dupq (rtx, machine_mode, rtx);
1024 void aarch64_expand_mov_immediate (rtx, rtx);
1025 rtx aarch64_stack_protect_canary_mem (machine_mode, rtx, aarch64_salt_type);
1026 rtx aarch64_ptrue_reg (machine_mode);
1027 rtx aarch64_ptrue_reg (machine_mode, unsigned int);
1028 rtx aarch64_ptrue_reg (machine_mode, machine_mode);
1029 rtx aarch64_pfalse_reg (machine_mode);
1030 bool aarch64_sve_same_pred_for_ptest_p (rtx *, rtx *);
1031 void aarch64_emit_sve_pred_move (rtx, rtx, rtx);
1032 void aarch64_expand_sve_mem_move (rtx, rtx, machine_mode);
1033 bool aarch64_maybe_expand_sve_subreg_move (rtx, rtx);
1034 rtx aarch64_replace_reg_mode (rtx, machine_mode);
1035 void aarch64_split_sve_subreg_move (rtx, rtx, rtx);
1036 void aarch64_expand_prologue (void);
1037 void aarch64_expand_vector_init (rtx, rtx);
1038 void aarch64_sve_expand_vector_init_subvector (rtx, rtx);
1039 void aarch64_sve_expand_vector_init (rtx, rtx);
1040 void aarch64_init_cumulative_args (CUMULATIVE_ARGS *, const_tree, rtx,
1041 const_tree, unsigned, bool = false);
1042 void aarch64_init_expanders (void);
1043 rtx_call_insn *aarch64_emit_call_insn (rtx);
1044 void aarch64_register_pragmas (void);
1045 void aarch64_relayout_simd_types (void);
1046 void aarch64_reset_previous_fndecl (void);
1047 bool aarch64_return_address_signing_enabled (void);
1048 void aarch64_save_restore_target_globals (tree);
1049 void aarch64_addti_scratch_regs (rtx, rtx, rtx *,
1050 rtx *, rtx *,
1051 rtx *, rtx *,
1052 rtx *);
1053 void aarch64_subvti_scratch_regs (rtx, rtx, rtx *,
1054 rtx *, rtx *,
1055 rtx *, rtx *, rtx *);
1056 void aarch64_expand_subvti (rtx, rtx, rtx,
1057 rtx, rtx, rtx, rtx, bool);
1058
1059
1060 /* Initialize builtins for SIMD intrinsics. */
1061 void init_aarch64_simd_builtins (void);
1062
1063 void aarch64_simd_emit_reg_reg_move (rtx *, machine_mode, unsigned int);
1064
1065 /* Expand builtins for SIMD intrinsics. */
1066 rtx aarch64_simd_expand_builtin (int, tree, rtx);
1067
1068 void aarch64_simd_lane_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT, const_tree);
1069 rtx aarch64_endian_lane_rtx (machine_mode, unsigned int);
1070
1071 void aarch64_split_move (rtx, rtx, machine_mode);
1072 void aarch64_split_128bit_move (rtx, rtx);
1073
1074 bool aarch64_split_128bit_move_p (rtx, rtx);
1075
1076 bool aarch64_mov128_immediate (rtx);
1077
1078 void aarch64_split_simd_move (rtx, rtx);
1079
1080 /* Check for a legitimate floating point constant for FMOV. */
1081 bool aarch64_float_const_representable_p (rtx);
1082
1083 extern int aarch64_epilogue_uses (int);
1084
1085 #if defined (RTX_CODE)
1086 void aarch64_gen_unlikely_cbranch (enum rtx_code, machine_mode cc_mode,
1087 rtx label_ref);
1088 bool aarch64_legitimate_address_p (machine_mode, rtx, bool,
1089 aarch64_addr_query_type = ADDR_QUERY_M);
1090 machine_mode aarch64_select_cc_mode (RTX_CODE, rtx, rtx);
1091 rtx aarch64_gen_compare_reg (RTX_CODE, rtx, rtx);
1092 bool aarch64_maxmin_plus_const (rtx_code, rtx *, bool);
1093 rtx aarch64_load_tp (rtx);
1094
1095 void aarch64_expand_compare_and_swap (rtx op[]);
1096 void aarch64_split_compare_and_swap (rtx op[]);
1097
1098 void aarch64_split_atomic_op (enum rtx_code, rtx, rtx, rtx, rtx, rtx, rtx);
1099
1100 bool aarch64_gen_adjusted_ldpstp (rtx *, bool, machine_mode, RTX_CODE);
1101 void aarch64_finish_ldpstp_peephole (rtx *, bool,
1102 enum rtx_code = (enum rtx_code)0);
1103
1104 void aarch64_expand_sve_vec_cmp_int (rtx, rtx_code, rtx, rtx);
1105 void aarch64_expand_sve_vec_cmp_float (rtx, rtx_code, rtx, rtx);
1106
1107 bool aarch64_prepare_sve_int_fma (rtx *, rtx_code);
1108 bool aarch64_prepare_sve_cond_int_fma (rtx *, rtx_code);
1109 #endif /* RTX_CODE */
1110
1111 bool aarch64_process_target_attr (tree);
1112 void aarch64_override_options_internal (struct gcc_options *);
1113
1114 const char *aarch64_general_mangle_builtin_type (const_tree);
1115 void aarch64_general_init_builtins (void);
1116 tree aarch64_general_fold_builtin (unsigned int, tree, unsigned int, tree *);
1117 gimple *aarch64_general_gimple_fold_builtin (unsigned int, gcall *,
1118 gimple_stmt_iterator *);
1119 rtx aarch64_general_expand_builtin (unsigned int, tree, rtx, int);
1120 tree aarch64_general_builtin_decl (unsigned, bool);
1121 tree aarch64_general_builtin_rsqrt (unsigned int);
1122 void handle_arm_acle_h (void);
1123 void handle_arm_neon_h (void);
1124
1125 bool aarch64_check_required_extensions (location_t, tree,
1126 aarch64_required_extensions);
1127 bool aarch64_general_check_builtin_call (location_t, vec<location_t>,
1128 unsigned int, tree, unsigned int,
1129 tree *);
1130
1131 namespace aarch64 {
1132 void report_non_ice (location_t, tree, unsigned int);
1133 void report_out_of_range (location_t, tree, unsigned int, HOST_WIDE_INT,
1134 HOST_WIDE_INT, HOST_WIDE_INT);
1135 void report_neither_nor (location_t, tree, unsigned int, HOST_WIDE_INT,
1136 HOST_WIDE_INT, HOST_WIDE_INT);
1137 void report_not_one_of (location_t, tree, unsigned int, HOST_WIDE_INT,
1138 HOST_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT,
1139 HOST_WIDE_INT);
1140 void report_not_enum (location_t, tree, unsigned int, HOST_WIDE_INT, tree);
1141 }
1142
1143 namespace aarch64_sve {
1144 void init_builtins ();
1145 void handle_arm_sve_h (bool);
1146 void handle_arm_sme_h (bool);
1147 void handle_arm_neon_sve_bridge_h (bool);
1148 tree builtin_decl (unsigned, bool);
1149 bool builtin_type_p (const_tree);
1150 bool builtin_type_p (const_tree, unsigned int *, unsigned int *);
1151 const char *mangle_builtin_type (const_tree);
1152 tree resolve_overloaded_builtin (location_t, unsigned int,
1153 vec<tree, va_gc> *);
1154 bool check_builtin_call (location_t, vec<location_t>, unsigned int,
1155 tree, unsigned int, tree *);
1156 gimple *gimple_fold_builtin (unsigned int, gimple_stmt_iterator *, gcall *);
1157 rtx expand_builtin (unsigned int, tree, rtx);
1158 tree handle_arm_sve_vector_bits_attribute (tree *, tree, tree, int, bool *);
1159 #ifdef GCC_TARGET_H
1160 bool verify_type_context (location_t, type_context_kind, const_tree, bool);
1161 #endif
1162 void add_sve_type_attribute (tree, unsigned int, unsigned int,
1163 const char *, const char *);
1164 }
1165
1166 extern void aarch64_split_combinev16qi (rtx operands[3]);
1167 extern void aarch64_expand_vec_perm (rtx, rtx, rtx, rtx, unsigned int);
1168 extern void aarch64_expand_sve_vec_perm (rtx, rtx, rtx, rtx);
1169 extern bool aarch64_madd_needs_nop (rtx_insn *);
1170 extern void aarch64_final_prescan_insn (rtx_insn *);
1171 void aarch64_atomic_assign_expand_fenv (tree *, tree *, tree *);
1172 int aarch64_ccmp_mode_to_code (machine_mode mode);
1173
1174 bool extract_base_offset_in_addr (rtx mem, rtx *base, rtx *offset);
1175 bool aarch64_mergeable_load_pair_p (machine_mode, rtx, rtx);
1176 bool aarch64_operands_ok_for_ldpstp (rtx *, bool);
1177 bool aarch64_operands_adjust_ok_for_ldpstp (rtx *, bool, machine_mode);
1178 bool aarch64_mem_ok_with_ldpstp_policy_model (rtx, bool, machine_mode);
1179 bool aarch64_ldpstp_operand_mode_p (machine_mode);
1180 rtx aarch64_gen_load_pair (rtx, rtx, rtx, enum rtx_code = (enum rtx_code)0);
1181 rtx aarch64_gen_store_pair (rtx, rtx, rtx);
1182
1183 extern void aarch64_asm_output_pool_epilogue (FILE *, const char *,
1184 tree, HOST_WIDE_INT);
1185
1186
1187 extern bool aarch64_classify_address (struct aarch64_address_info *, rtx,
1188 machine_mode, bool,
1189 aarch64_addr_query_type = ADDR_QUERY_M);
1190
1191 void aarch64_set_asm_isa_flags (aarch64_feature_flags);
1192
1193 /* Defined in common/config/aarch64-common.cc. */
1194 void aarch64_set_asm_isa_flags (gcc_options *, aarch64_feature_flags);
1195 bool aarch64_handle_option (struct gcc_options *, struct gcc_options *,
1196 const struct cl_decoded_option *, location_t);
1197 aarch64_feature_flags aarch64_get_required_features (aarch64_feature_flags);
1198 void aarch64_print_hint_for_extensions (const char *);
1199 void aarch64_print_hint_for_arch (const char *);
1200 void aarch64_print_hint_for_core (const char *);
1201 enum aarch_parse_opt_result aarch64_parse_extension (const char *,
1202 aarch64_feature_flags *,
1203 std::string *);
1204 enum aarch_parse_opt_result aarch64_parse_arch (const char *,
1205 aarch64_arch *,
1206 aarch64_feature_flags *,
1207 std::string *);
1208 enum aarch_parse_opt_result aarch64_parse_cpu (const char *,
1209 aarch64_cpu *,
1210 aarch64_feature_flags *,
1211 std::string *);
1212 enum aarch_parse_opt_result aarch64_parse_tune (const char *, aarch64_cpu *);
1213 bool aarch64_validate_march (const char *, aarch64_arch *,
1214 aarch64_feature_flags *);
1215 bool aarch64_validate_mcpu (const char *, aarch64_cpu *,
1216 aarch64_feature_flags *);
1217 bool aarch64_validate_mtune (const char *, aarch64_cpu *);
1218 std::string aarch64_get_extension_string_for_isa_flags (aarch64_feature_flags,
1219 aarch64_feature_flags);
1220 std::string aarch64_get_arch_string_for_assembler (aarch64_arch,
1221 aarch64_feature_flags);
1222
1223 rtl_opt_pass *make_pass_aarch64_early_ra (gcc::context *);
1224 rtl_opt_pass *make_pass_fma_steering (gcc::context *);
1225 rtl_opt_pass *make_pass_track_speculation (gcc::context *);
1226 rtl_opt_pass *make_pass_late_track_speculation (gcc::context *);
1227 rtl_opt_pass *make_pass_insert_bti (gcc::context *ctxt);
1228 rtl_opt_pass *make_pass_cc_fusion (gcc::context *ctxt);
1229 rtl_opt_pass *make_pass_switch_pstate_sm (gcc::context *ctxt);
1230 rtl_opt_pass *make_pass_ldp_fusion (gcc::context *);
1231
1232 poly_uint64 aarch64_regmode_natural_size (machine_mode);
1233
1234 bool aarch64_high_bits_all_ones_p (HOST_WIDE_INT);
1235
1236 struct atomic_ool_names
1237 {
1238 const char *str[5][5];
1239 };
1240
1241 rtx aarch64_atomic_ool_func(machine_mode mode, rtx model_rtx,
1242 const atomic_ool_names *names);
1243 extern const atomic_ool_names aarch64_ool_swp_names;
1244 extern const atomic_ool_names aarch64_ool_ldadd_names;
1245 extern const atomic_ool_names aarch64_ool_ldset_names;
1246 extern const atomic_ool_names aarch64_ool_ldclr_names;
1247 extern const atomic_ool_names aarch64_ool_ldeor_names;
1248
1249 tree aarch64_resolve_overloaded_builtin_general (location_t, tree, void *);
1250
1251 const char *aarch64_sls_barrier (int);
1252 const char *aarch64_indirect_call_asm (rtx);
1253 extern bool aarch64_harden_sls_retbr_p (void);
1254 extern bool aarch64_harden_sls_blr_p (void);
1255
1256 extern void aarch64_output_patchable_area (unsigned int, bool);
1257
1258 extern void aarch64_adjust_reg_alloc_order ();
1259
1260 bool aarch64_optimize_mode_switching (aarch64_mode_entity);
1261 void aarch64_restore_za (rtx);
1262 void aarch64_expand_crc_using_pmull (scalar_mode, scalar_mode, rtx *);
1263 void aarch64_expand_reversed_crc_using_pmull (scalar_mode, scalar_mode, rtx *);
1264
1265
1266 extern bool aarch64_gcs_enabled ();
1267
1268 extern unsigned aarch64_data_alignment (const_tree exp, unsigned align);
1269 extern unsigned aarch64_stack_alignment (const_tree exp, unsigned align);
1270
1271 #endif /* GCC_AARCH64_PROTOS_H */