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