1 /* Definitions of target machine for GCC for IA-32. 2 Copyright (C) 1988-2022 Free Software Foundation, Inc. 3 4 This file is part of GCC. 5 6 GCC is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 GCC is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 Under Section 7 of GPL version 3, you are granted additional 17 permissions described in the GCC Runtime Library Exception, version 18 3.1, as published by the Free Software Foundation. 19 20 You should have received a copy of the GNU General Public License and 21 a copy of the GCC Runtime Library Exception along with this program; 22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 <http://www.gnu.org/licenses/>. */ 24 25 /* The purpose of this file is to define the characteristics of the i386, 26 independent of assembler syntax or operating system. 27 28 Three other files build on this one to describe a specific assembler syntax: 29 bsd386.h, att386.h, and sun386.h. 30 31 The actual tm.h file for a particular system should include 32 this file, and then the file for the appropriate assembler syntax. 33 34 Many macros that specify assembler syntax are omitted entirely from 35 this file because they really belong in the files for particular 36 assemblers. These include RP, IP, LPREFIX, PUT_OP_SIZE, USE_STAR, 37 ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many 38 that start with ASM_ or end in ASM_OP. */ 39 40 /* Redefines for option macros. */ 41 42 #define TARGET_CMPXCHG16B TARGET_CX16 43 #define TARGET_CMPXCHG16B_P(x) TARGET_CX16_P(x) 44 45 #define TARGET_LP64 TARGET_ABI_64 46 #define TARGET_LP64_P(x) TARGET_ABI_64_P(x) 47 #define TARGET_X32 TARGET_ABI_X32 48 #define TARGET_X32_P(x) TARGET_ABI_X32_P(x) 49 #define TARGET_16BIT TARGET_CODE16 50 #define TARGET_16BIT_P(x) TARGET_CODE16_P(x) 51 52 #define TARGET_MMX_WITH_SSE (TARGET_64BIT && TARGET_SSE2) 53 54 #include "config/vxworks-dummy.h" 55 56 #include "config/i386/i386-opts.h" 57 58 #define MAX_STRINGOP_ALGS 4 59 60 /* Specify what algorithm to use for stringops on known size. 61 When size is unknown, the UNKNOWN_SIZE alg is used. When size is 62 known at compile time or estimated via feedback, the SIZE array 63 is walked in order until MAX is greater then the estimate (or -1 64 means infinity). Corresponding ALG is used then. 65 When NOALIGN is true the code guaranting the alignment of the memory 66 block is skipped. 67 68 For example initializer: 69 {{256, loop}, {-1, rep_prefix_4_byte}} 70 will use loop for blocks smaller or equal to 256 bytes, rep prefix will 71 be used otherwise. */ 72 struct stringop_algs 73 { 74 const enum stringop_alg unknown_size; 75 const struct stringop_strategy { 76 /* Several older compilers delete the default constructor because of the 77 const entries (see PR100246). Manually specifying a CTOR works around 78 this issue. Since this header is used by code compiled with the C 79 compiler we must guard the addition. */ 80 #ifdef __cplusplus 81 constexpr 82 stringop_strategy (int _max = -1, enum stringop_alg _alg = libcall, 83 int _noalign = false) maxstringop_algs::stringop_strategy84 : max (_max), alg (_alg), noalign (_noalign) {} 85 #endif 86 const int max; 87 const enum stringop_alg alg; 88 int noalign; 89 } size [MAX_STRINGOP_ALGS]; 90 }; 91 92 /* Analog of COSTS_N_INSNS when optimizing for size. */ 93 #ifndef COSTS_N_BYTES 94 #define COSTS_N_BYTES(N) ((N) * 2) 95 #endif 96 97 /* Define the specific costs for a given cpu. NB: hard_register is used 98 by TARGET_REGISTER_MOVE_COST and TARGET_MEMORY_MOVE_COST to compute 99 hard register move costs by register allocator. Relative costs of 100 pseudo register load and store versus pseudo register moves in RTL 101 expressions for TARGET_RTX_COSTS can be different from relative 102 costs of hard registers to get the most efficient operations with 103 pseudo registers. */ 104 105 struct processor_costs { 106 /* Costs used by register allocator. integer->integer register move 107 cost is 2. */ 108 struct 109 { 110 const int movzbl_load; /* cost of loading using movzbl */ 111 const int int_load[3]; /* cost of loading integer registers 112 in QImode, HImode and SImode relative 113 to reg-reg move (2). */ 114 const int int_store[3]; /* cost of storing integer register 115 in QImode, HImode and SImode */ 116 const int fp_move; /* cost of reg,reg fld/fst */ 117 const int fp_load[3]; /* cost of loading FP register 118 in SFmode, DFmode and XFmode */ 119 const int fp_store[3]; /* cost of storing FP register 120 in SFmode, DFmode and XFmode */ 121 const int mmx_move; /* cost of moving MMX register. */ 122 const int mmx_load[2]; /* cost of loading MMX register 123 in SImode and DImode */ 124 const int mmx_store[2]; /* cost of storing MMX register 125 in SImode and DImode */ 126 const int xmm_move; /* cost of moving XMM register. */ 127 const int ymm_move; /* cost of moving XMM register. */ 128 const int zmm_move; /* cost of moving XMM register. */ 129 const int sse_load[5]; /* cost of loading SSE register 130 in 32bit, 64bit, 128bit, 256bit and 512bit */ 131 const int sse_store[5]; /* cost of storing SSE register 132 in SImode, DImode and TImode. */ 133 const int sse_to_integer; /* cost of moving SSE register to integer. */ 134 const int integer_to_sse; /* cost of moving integer register to SSE. */ 135 const int mask_to_integer; /* cost of moving mask register to integer. */ 136 const int integer_to_mask; /* cost of moving integer register to mask. */ 137 const int mask_load[3]; /* cost of loading mask registers 138 in QImode, HImode and SImode. */ 139 const int mask_store[3]; /* cost of storing mask register 140 in QImode, HImode and SImode. */ 141 const int mask_move; /* cost of moving mask register. */ 142 } hard_register; 143 144 const int add; /* cost of an add instruction */ 145 const int lea; /* cost of a lea instruction */ 146 const int shift_var; /* variable shift costs */ 147 const int shift_const; /* constant shift costs */ 148 const int mult_init[5]; /* cost of starting a multiply 149 in QImode, HImode, SImode, DImode, TImode*/ 150 const int mult_bit; /* cost of multiply per each bit set */ 151 const int divide[5]; /* cost of a divide/mod 152 in QImode, HImode, SImode, DImode, TImode*/ 153 int movsx; /* The cost of movsx operation. */ 154 int movzx; /* The cost of movzx operation. */ 155 const int large_insn; /* insns larger than this cost more */ 156 const int move_ratio; /* The threshold of number of scalar 157 memory-to-memory move insns. */ 158 const int clear_ratio; /* The threshold of number of scalar 159 memory clearing insns. */ 160 const int int_load[3]; /* cost of loading integer registers 161 in QImode, HImode and SImode relative 162 to reg-reg move (2). */ 163 const int int_store[3]; /* cost of storing integer register 164 in QImode, HImode and SImode */ 165 const int sse_load[5]; /* cost of loading SSE register 166 in 32bit, 64bit, 128bit, 256bit and 512bit */ 167 const int sse_store[5]; /* cost of storing SSE register 168 in 32bit, 64bit, 128bit, 256bit and 512bit */ 169 const int sse_unaligned_load[5];/* cost of unaligned load. */ 170 const int sse_unaligned_store[5];/* cost of unaligned store. */ 171 const int xmm_move, ymm_move, /* cost of moving XMM and YMM register. */ 172 zmm_move; 173 const int sse_to_integer; /* cost of moving SSE register to integer. */ 174 const int gather_static, gather_per_elt; /* Cost of gather load is computed 175 as static + per_item * nelts. */ 176 const int scatter_static, scatter_per_elt; /* Cost of gather store is 177 computed as static + per_item * nelts. */ 178 const int l1_cache_size; /* size of l1 cache, in kilobytes. */ 179 const int l2_cache_size; /* size of l2 cache, in kilobytes. */ 180 const int prefetch_block; /* bytes moved to cache for prefetch. */ 181 const int simultaneous_prefetches; /* number of parallel prefetch 182 operations. */ 183 const int branch_cost; /* Default value for BRANCH_COST. */ 184 const int fadd; /* cost of FADD and FSUB instructions. */ 185 const int fmul; /* cost of FMUL instruction. */ 186 const int fdiv; /* cost of FDIV instruction. */ 187 const int fabs; /* cost of FABS instruction. */ 188 const int fchs; /* cost of FCHS instruction. */ 189 const int fsqrt; /* cost of FSQRT instruction. */ 190 /* Specify what algorithm 191 to use for stringops on unknown size. */ 192 const int sse_op; /* cost of cheap SSE instruction. */ 193 const int addss; /* cost of ADDSS/SD SUBSS/SD instructions. */ 194 const int mulss; /* cost of MULSS instructions. */ 195 const int mulsd; /* cost of MULSD instructions. */ 196 const int fmass; /* cost of FMASS instructions. */ 197 const int fmasd; /* cost of FMASD instructions. */ 198 const int divss; /* cost of DIVSS instructions. */ 199 const int divsd; /* cost of DIVSD instructions. */ 200 const int sqrtss; /* cost of SQRTSS instructions. */ 201 const int sqrtsd; /* cost of SQRTSD instructions. */ 202 const int reassoc_int, reassoc_fp, reassoc_vec_int, reassoc_vec_fp; 203 /* Specify reassociation width for integer, 204 fp, vector integer and vector fp 205 operations. Generally should correspond 206 to number of instructions executed in 207 parallel. See also 208 ix86_reassociation_width. */ 209 struct stringop_algs *memcpy, *memset; 210 const int cond_taken_branch_cost; /* Cost of taken branch for vectorizer 211 cost model. */ 212 const int cond_not_taken_branch_cost;/* Cost of not taken branch for 213 vectorizer cost model. */ 214 215 /* The "0:0:8" label alignment specified for some processors generates 216 secondary 8-byte alignment only for those label/jump/loop targets 217 which have primary alignment. */ 218 const char *const align_loop; /* Loop alignment. */ 219 const char *const align_jump; /* Jump alignment. */ 220 const char *const align_label; /* Label alignment. */ 221 const char *const align_func; /* Function alignment. */ 222 }; 223 224 extern const struct processor_costs *ix86_cost; 225 extern const struct processor_costs ix86_size_cost; 226 227 #define ix86_cur_cost() \ 228 (optimize_insn_for_size_p () ? &ix86_size_cost: ix86_cost) 229 230 /* Macros used in the machine description to test the flags. */ 231 232 /* configure can arrange to change it. */ 233 234 #ifndef TARGET_CPU_DEFAULT 235 #define TARGET_CPU_DEFAULT PROCESSOR_GENERIC 236 #endif 237 238 #ifndef TARGET_FPMATH_DEFAULT 239 #define TARGET_FPMATH_DEFAULT \ 240 (TARGET_64BIT && TARGET_SSE ? FPMATH_SSE : FPMATH_387) 241 #endif 242 243 #ifndef TARGET_FPMATH_DEFAULT_P 244 #define TARGET_FPMATH_DEFAULT_P(x) \ 245 (TARGET_64BIT_P(x) && TARGET_SSE_P(x) ? FPMATH_SSE : FPMATH_387) 246 #endif 247 248 /* If the i387 is disabled or -miamcu is used , then do not return 249 values in it. */ 250 #define TARGET_FLOAT_RETURNS_IN_80387 \ 251 (TARGET_FLOAT_RETURNS && TARGET_80387 && !TARGET_IAMCU) 252 #define TARGET_FLOAT_RETURNS_IN_80387_P(x) \ 253 (TARGET_FLOAT_RETURNS_P(x) && TARGET_80387_P(x) && !TARGET_IAMCU_P(x)) 254 255 /* 64bit Sledgehammer mode. For libgcc2 we make sure this is a 256 compile-time constant. */ 257 #ifdef IN_LIBGCC2 258 #undef TARGET_64BIT 259 #ifdef __x86_64__ 260 #define TARGET_64BIT 1 261 #else 262 #define TARGET_64BIT 0 263 #endif 264 #else 265 #ifndef TARGET_BI_ARCH 266 #undef TARGET_64BIT 267 #undef TARGET_64BIT_P 268 #if TARGET_64BIT_DEFAULT 269 #define TARGET_64BIT 1 270 #define TARGET_64BIT_P(x) 1 271 #else 272 #define TARGET_64BIT 0 273 #define TARGET_64BIT_P(x) 0 274 #endif 275 #endif 276 #endif 277 278 #define HAS_LONG_COND_BRANCH 1 279 #define HAS_LONG_UNCOND_BRANCH 1 280 281 #define TARGET_CPU_P(CPU) (ix86_tune == PROCESSOR_ ## CPU) 282 283 /* Feature tests against the various tunings. */ 284 enum ix86_tune_indices { 285 #undef DEF_TUNE 286 #define DEF_TUNE(tune, name, selector) tune, 287 #include "x86-tune.def" 288 #undef DEF_TUNE 289 X86_TUNE_LAST 290 }; 291 292 extern unsigned char ix86_tune_features[X86_TUNE_LAST]; 293 294 #define TARGET_USE_LEAVE ix86_tune_features[X86_TUNE_USE_LEAVE] 295 #define TARGET_PUSH_MEMORY ix86_tune_features[X86_TUNE_PUSH_MEMORY] 296 #define TARGET_ZERO_EXTEND_WITH_AND \ 297 ix86_tune_features[X86_TUNE_ZERO_EXTEND_WITH_AND] 298 #define TARGET_UNROLL_STRLEN ix86_tune_features[X86_TUNE_UNROLL_STRLEN] 299 #define TARGET_BRANCH_PREDICTION_HINTS \ 300 ix86_tune_features[X86_TUNE_BRANCH_PREDICTION_HINTS] 301 #define TARGET_DOUBLE_WITH_ADD ix86_tune_features[X86_TUNE_DOUBLE_WITH_ADD] 302 #define TARGET_USE_SAHF ix86_tune_features[X86_TUNE_USE_SAHF] 303 #define TARGET_MOVX ix86_tune_features[X86_TUNE_MOVX] 304 #define TARGET_PARTIAL_REG_STALL ix86_tune_features[X86_TUNE_PARTIAL_REG_STALL] 305 #define TARGET_PARTIAL_FLAG_REG_STALL \ 306 ix86_tune_features[X86_TUNE_PARTIAL_FLAG_REG_STALL] 307 #define TARGET_LCP_STALL \ 308 ix86_tune_features[X86_TUNE_LCP_STALL] 309 #define TARGET_USE_HIMODE_FIOP ix86_tune_features[X86_TUNE_USE_HIMODE_FIOP] 310 #define TARGET_USE_SIMODE_FIOP ix86_tune_features[X86_TUNE_USE_SIMODE_FIOP] 311 #define TARGET_USE_MOV0 ix86_tune_features[X86_TUNE_USE_MOV0] 312 #define TARGET_USE_CLTD ix86_tune_features[X86_TUNE_USE_CLTD] 313 #define TARGET_USE_XCHGB ix86_tune_features[X86_TUNE_USE_XCHGB] 314 #define TARGET_SPLIT_LONG_MOVES ix86_tune_features[X86_TUNE_SPLIT_LONG_MOVES] 315 #define TARGET_READ_MODIFY_WRITE ix86_tune_features[X86_TUNE_READ_MODIFY_WRITE] 316 #define TARGET_READ_MODIFY ix86_tune_features[X86_TUNE_READ_MODIFY] 317 #define TARGET_PROMOTE_QImode ix86_tune_features[X86_TUNE_PROMOTE_QIMODE] 318 #define TARGET_FAST_PREFIX ix86_tune_features[X86_TUNE_FAST_PREFIX] 319 #define TARGET_SINGLE_STRINGOP ix86_tune_features[X86_TUNE_SINGLE_STRINGOP] 320 #define TARGET_PREFER_KNOWN_REP_MOVSB_STOSB \ 321 ix86_tune_features[X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB] 322 #define TARGET_MISALIGNED_MOVE_STRING_PRO_EPILOGUES \ 323 ix86_tune_features[X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES] 324 #define TARGET_QIMODE_MATH ix86_tune_features[X86_TUNE_QIMODE_MATH] 325 #define TARGET_HIMODE_MATH ix86_tune_features[X86_TUNE_HIMODE_MATH] 326 #define TARGET_PROMOTE_QI_REGS ix86_tune_features[X86_TUNE_PROMOTE_QI_REGS] 327 #define TARGET_PROMOTE_HI_REGS ix86_tune_features[X86_TUNE_PROMOTE_HI_REGS] 328 #define TARGET_SINGLE_POP ix86_tune_features[X86_TUNE_SINGLE_POP] 329 #define TARGET_DOUBLE_POP ix86_tune_features[X86_TUNE_DOUBLE_POP] 330 #define TARGET_SINGLE_PUSH ix86_tune_features[X86_TUNE_SINGLE_PUSH] 331 #define TARGET_DOUBLE_PUSH ix86_tune_features[X86_TUNE_DOUBLE_PUSH] 332 #define TARGET_INTEGER_DFMODE_MOVES \ 333 ix86_tune_features[X86_TUNE_INTEGER_DFMODE_MOVES] 334 #define TARGET_PARTIAL_REG_DEPENDENCY \ 335 ix86_tune_features[X86_TUNE_PARTIAL_REG_DEPENDENCY] 336 #define TARGET_SSE_PARTIAL_REG_DEPENDENCY \ 337 ix86_tune_features[X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY] 338 #define TARGET_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY \ 339 ix86_tune_features[X86_TUNE_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY] 340 #define TARGET_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY \ 341 ix86_tune_features[X86_TUNE_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY] 342 #define TARGET_SSE_UNALIGNED_LOAD_OPTIMAL \ 343 ix86_tune_features[X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL] 344 #define TARGET_SSE_UNALIGNED_STORE_OPTIMAL \ 345 ix86_tune_features[X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL] 346 #define TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL \ 347 ix86_tune_features[X86_TUNE_SSE_PACKED_SINGLE_INSN_OPTIMAL] 348 #define TARGET_SSE_SPLIT_REGS ix86_tune_features[X86_TUNE_SSE_SPLIT_REGS] 349 #define TARGET_SSE_TYPELESS_STORES \ 350 ix86_tune_features[X86_TUNE_SSE_TYPELESS_STORES] 351 #define TARGET_SSE_LOAD0_BY_PXOR ix86_tune_features[X86_TUNE_SSE_LOAD0_BY_PXOR] 352 #define TARGET_MEMORY_MISMATCH_STALL \ 353 ix86_tune_features[X86_TUNE_MEMORY_MISMATCH_STALL] 354 #define TARGET_PROLOGUE_USING_MOVE \ 355 ix86_tune_features[X86_TUNE_PROLOGUE_USING_MOVE] 356 #define TARGET_EPILOGUE_USING_MOVE \ 357 ix86_tune_features[X86_TUNE_EPILOGUE_USING_MOVE] 358 #define TARGET_SHIFT1 ix86_tune_features[X86_TUNE_SHIFT1] 359 #define TARGET_USE_FFREEP ix86_tune_features[X86_TUNE_USE_FFREEP] 360 #define TARGET_INTER_UNIT_MOVES_TO_VEC \ 361 ix86_tune_features[X86_TUNE_INTER_UNIT_MOVES_TO_VEC] 362 #define TARGET_INTER_UNIT_MOVES_FROM_VEC \ 363 ix86_tune_features[X86_TUNE_INTER_UNIT_MOVES_FROM_VEC] 364 #define TARGET_INTER_UNIT_CONVERSIONS \ 365 ix86_tune_features[X86_TUNE_INTER_UNIT_CONVERSIONS] 366 #define TARGET_FOUR_JUMP_LIMIT ix86_tune_features[X86_TUNE_FOUR_JUMP_LIMIT] 367 #define TARGET_SCHEDULE ix86_tune_features[X86_TUNE_SCHEDULE] 368 #define TARGET_USE_BT ix86_tune_features[X86_TUNE_USE_BT] 369 #define TARGET_USE_INCDEC ix86_tune_features[X86_TUNE_USE_INCDEC] 370 #define TARGET_PAD_RETURNS ix86_tune_features[X86_TUNE_PAD_RETURNS] 371 #define TARGET_PAD_SHORT_FUNCTION \ 372 ix86_tune_features[X86_TUNE_PAD_SHORT_FUNCTION] 373 #define TARGET_EXT_80387_CONSTANTS \ 374 ix86_tune_features[X86_TUNE_EXT_80387_CONSTANTS] 375 #define TARGET_AVOID_VECTOR_DECODE \ 376 ix86_tune_features[X86_TUNE_AVOID_VECTOR_DECODE] 377 #define TARGET_TUNE_PROMOTE_HIMODE_IMUL \ 378 ix86_tune_features[X86_TUNE_PROMOTE_HIMODE_IMUL] 379 #define TARGET_SLOW_IMUL_IMM32_MEM \ 380 ix86_tune_features[X86_TUNE_SLOW_IMUL_IMM32_MEM] 381 #define TARGET_SLOW_IMUL_IMM8 ix86_tune_features[X86_TUNE_SLOW_IMUL_IMM8] 382 #define TARGET_MOVE_M1_VIA_OR ix86_tune_features[X86_TUNE_MOVE_M1_VIA_OR] 383 #define TARGET_NOT_UNPAIRABLE ix86_tune_features[X86_TUNE_NOT_UNPAIRABLE] 384 #define TARGET_NOT_VECTORMODE ix86_tune_features[X86_TUNE_NOT_VECTORMODE] 385 #define TARGET_USE_VECTOR_FP_CONVERTS \ 386 ix86_tune_features[X86_TUNE_USE_VECTOR_FP_CONVERTS] 387 #define TARGET_USE_VECTOR_CONVERTS \ 388 ix86_tune_features[X86_TUNE_USE_VECTOR_CONVERTS] 389 #define TARGET_SLOW_PSHUFB \ 390 ix86_tune_features[X86_TUNE_SLOW_PSHUFB] 391 #define TARGET_AVOID_4BYTE_PREFIXES \ 392 ix86_tune_features[X86_TUNE_AVOID_4BYTE_PREFIXES] 393 #define TARGET_USE_GATHER_2PARTS \ 394 ix86_tune_features[X86_TUNE_USE_GATHER_2PARTS] 395 #define TARGET_USE_SCATTER_2PARTS \ 396 ix86_tune_features[X86_TUNE_USE_SCATTER_2PARTS] 397 #define TARGET_USE_GATHER_4PARTS \ 398 ix86_tune_features[X86_TUNE_USE_GATHER_4PARTS] 399 #define TARGET_USE_SCATTER_4PARTS \ 400 ix86_tune_features[X86_TUNE_USE_SCATTER_4PARTS] 401 #define TARGET_USE_GATHER_8PARTS \ 402 ix86_tune_features[X86_TUNE_USE_GATHER_8PARTS] 403 #define TARGET_USE_SCATTER_8PARTS \ 404 ix86_tune_features[X86_TUNE_USE_SCATTER_8PARTS] 405 #define TARGET_FUSE_CMP_AND_BRANCH_32 \ 406 ix86_tune_features[X86_TUNE_FUSE_CMP_AND_BRANCH_32] 407 #define TARGET_FUSE_CMP_AND_BRANCH_64 \ 408 ix86_tune_features[X86_TUNE_FUSE_CMP_AND_BRANCH_64] 409 #define TARGET_FUSE_CMP_AND_BRANCH \ 410 (TARGET_64BIT ? TARGET_FUSE_CMP_AND_BRANCH_64 \ 411 : TARGET_FUSE_CMP_AND_BRANCH_32) 412 #define TARGET_FUSE_CMP_AND_BRANCH_SOFLAGS \ 413 ix86_tune_features[X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS] 414 #define TARGET_FUSE_ALU_AND_BRANCH \ 415 ix86_tune_features[X86_TUNE_FUSE_ALU_AND_BRANCH] 416 #define TARGET_OPT_AGU ix86_tune_features[X86_TUNE_OPT_AGU] 417 #define TARGET_AVOID_LEA_FOR_ADDR \ 418 ix86_tune_features[X86_TUNE_AVOID_LEA_FOR_ADDR] 419 #define TARGET_SOFTWARE_PREFETCHING_BENEFICIAL \ 420 ix86_tune_features[X86_TUNE_SOFTWARE_PREFETCHING_BENEFICIAL] 421 #define TARGET_AVX256_SPLIT_REGS \ 422 ix86_tune_features[X86_TUNE_AVX256_SPLIT_REGS] 423 #define TARGET_AVX512_SPLIT_REGS \ 424 ix86_tune_features[X86_TUNE_AVX512_SPLIT_REGS] 425 #define TARGET_GENERAL_REGS_SSE_SPILL \ 426 ix86_tune_features[X86_TUNE_GENERAL_REGS_SSE_SPILL] 427 #define TARGET_AVOID_MEM_OPND_FOR_CMOVE \ 428 ix86_tune_features[X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE] 429 #define TARGET_SPLIT_MEM_OPND_FOR_FP_CONVERTS \ 430 ix86_tune_features[X86_TUNE_SPLIT_MEM_OPND_FOR_FP_CONVERTS] 431 #define TARGET_ADJUST_UNROLL \ 432 ix86_tune_features[X86_TUNE_ADJUST_UNROLL] 433 #define TARGET_AVOID_FALSE_DEP_FOR_BMI \ 434 ix86_tune_features[X86_TUNE_AVOID_FALSE_DEP_FOR_BMI] 435 #define TARGET_ONE_IF_CONV_INSN \ 436 ix86_tune_features[X86_TUNE_ONE_IF_CONV_INSN] 437 #define TARGET_AVOID_MFENCE ix86_tune_features[X86_TUNE_AVOID_MFENCE] 438 #define TARGET_EMIT_VZEROUPPER \ 439 ix86_tune_features[X86_TUNE_EMIT_VZEROUPPER] 440 #define TARGET_EXPAND_ABS \ 441 ix86_tune_features[X86_TUNE_EXPAND_ABS] 442 #define TARGET_V2DF_REDUCTION_PREFER_HADDPD \ 443 ix86_tune_features[X86_TUNE_V2DF_REDUCTION_PREFER_HADDPD] 444 #define TARGET_DEST_FALSE_DEP_FOR_GLC \ 445 ix86_tune_features[X86_TUNE_DEST_FALSE_DEP_FOR_GLC] 446 447 /* Feature tests against the various architecture variations. */ 448 enum ix86_arch_indices { 449 X86_ARCH_CMOV, 450 X86_ARCH_CMPXCHG, 451 X86_ARCH_CMPXCHG8B, 452 X86_ARCH_XADD, 453 X86_ARCH_BSWAP, 454 455 X86_ARCH_LAST 456 }; 457 458 extern unsigned char ix86_arch_features[X86_ARCH_LAST]; 459 460 #define TARGET_CMOV ix86_arch_features[X86_ARCH_CMOV] 461 #define TARGET_CMPXCHG ix86_arch_features[X86_ARCH_CMPXCHG] 462 #define TARGET_CMPXCHG8B ix86_arch_features[X86_ARCH_CMPXCHG8B] 463 #define TARGET_XADD ix86_arch_features[X86_ARCH_XADD] 464 #define TARGET_BSWAP ix86_arch_features[X86_ARCH_BSWAP] 465 466 /* For sane SSE instruction set generation we need fcomi instruction. 467 It is safe to enable all CMOVE instructions. Also, RDRAND intrinsic 468 expands to a sequence that includes conditional move. */ 469 #define TARGET_CMOVE (TARGET_CMOV || TARGET_SSE || TARGET_RDRND) 470 471 #define TARGET_FISTTP (TARGET_SSE3 && TARGET_80387) 472 473 extern unsigned char ix86_prefetch_sse; 474 #define TARGET_PREFETCH_SSE ix86_prefetch_sse 475 476 #define ASSEMBLER_DIALECT (ix86_asm_dialect) 477 478 #define TARGET_SSE_MATH ((ix86_fpmath & FPMATH_SSE) != 0) 479 #define TARGET_MIX_SSE_I387 \ 480 ((ix86_fpmath & (FPMATH_SSE | FPMATH_387)) == (FPMATH_SSE | FPMATH_387)) 481 482 #define TARGET_HARD_SF_REGS (TARGET_80387 || TARGET_MMX || TARGET_SSE) 483 #define TARGET_HARD_DF_REGS (TARGET_80387 || TARGET_SSE) 484 #define TARGET_HARD_XF_REGS (TARGET_80387) 485 486 #define TARGET_GNU_TLS (ix86_tls_dialect == TLS_DIALECT_GNU) 487 #define TARGET_GNU2_TLS (ix86_tls_dialect == TLS_DIALECT_GNU2) 488 #define TARGET_ANY_GNU_TLS (TARGET_GNU_TLS || TARGET_GNU2_TLS) 489 #define TARGET_SUN_TLS 0 490 491 #ifndef TARGET_64BIT_DEFAULT 492 #define TARGET_64BIT_DEFAULT 0 493 #endif 494 #ifndef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 495 #define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 0 496 #endif 497 498 #define TARGET_SSP_GLOBAL_GUARD (ix86_stack_protector_guard == SSP_GLOBAL) 499 #define TARGET_SSP_TLS_GUARD (ix86_stack_protector_guard == SSP_TLS) 500 501 /* Fence to use after loop using storent. */ 502 503 extern GTY(()) tree x86_mfence; 504 #define FENCE_FOLLOWING_MOVNT x86_mfence 505 506 /* Once GDB has been enhanced to deal with functions without frame 507 pointers, we can change this to allow for elimination of 508 the frame pointer in leaf functions. */ 509 #define TARGET_DEFAULT 0 510 511 /* Extra bits to force. */ 512 #define TARGET_SUBTARGET_DEFAULT 0 513 #define TARGET_SUBTARGET_ISA_DEFAULT 0 514 515 /* Extra bits to force on w/ 32-bit mode. */ 516 #define TARGET_SUBTARGET32_DEFAULT 0 517 #define TARGET_SUBTARGET32_ISA_DEFAULT 0 518 519 /* Extra bits to force on w/ 64-bit mode. */ 520 #define TARGET_SUBTARGET64_DEFAULT 0 521 /* Enable MMX, SSE and SSE2 by default. */ 522 #define TARGET_SUBTARGET64_ISA_DEFAULT \ 523 (OPTION_MASK_ISA_MMX | OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_SSE2) 524 525 /* Replace MACH-O, ifdefs by in-line tests, where possible. 526 (a) Macros defined in config/i386/darwin.h */ 527 #define TARGET_MACHO 0 528 #define TARGET_MACHO_SYMBOL_STUBS 0 529 #define MACHOPIC_ATT_STUB 0 530 /* (b) Macros defined in config/darwin.h */ 531 #define MACHO_DYNAMIC_NO_PIC_P 0 532 #define MACHOPIC_INDIRECT 0 533 #define MACHOPIC_PURE 0 534 535 /* For the RDOS */ 536 #define TARGET_RDOS 0 537 538 /* For the Windows 64-bit ABI. */ 539 #define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI) 540 541 /* For the Windows 32-bit ABI. */ 542 #define TARGET_32BIT_MS_ABI (!TARGET_64BIT && ix86_cfun_abi () == MS_ABI) 543 544 /* This is re-defined by cygming.h. */ 545 #define TARGET_SEH 0 546 547 /* The default abi used by target. */ 548 #define DEFAULT_ABI SYSV_ABI 549 550 /* The default TLS segment register used by target. */ 551 #define DEFAULT_TLS_SEG_REG \ 552 (TARGET_64BIT ? ADDR_SPACE_SEG_FS : ADDR_SPACE_SEG_GS) 553 554 /* Subtargets may reset this to 1 in order to enable 96-bit long double 555 with the rounding mode forced to 53 bits. */ 556 #define TARGET_96_ROUND_53_LONG_DOUBLE 0 557 558 #ifndef SUBTARGET_DRIVER_SELF_SPECS 559 # define SUBTARGET_DRIVER_SELF_SPECS "" 560 #endif 561 562 #define DRIVER_SELF_SPECS SUBTARGET_DRIVER_SELF_SPECS 563 564 /* -march=native handling only makes sense with compiler running on 565 an x86 or x86_64 chip. If changing this condition, also change 566 the condition in driver-i386.cc. */ 567 #if defined(__i386__) || defined(__x86_64__) 568 /* In driver-i386.cc. */ 569 extern const char *host_detect_local_cpu (int argc, const char **argv); 570 #define EXTRA_SPEC_FUNCTIONS \ 571 { "local_cpu_detect", host_detect_local_cpu }, 572 #define HAVE_LOCAL_CPU_DETECT 573 #endif 574 575 #if TARGET_64BIT_DEFAULT 576 #define OPT_ARCH64 "!m32" 577 #define OPT_ARCH32 "m32" 578 #else 579 #define OPT_ARCH64 "m64|mx32" 580 #define OPT_ARCH32 "m64|mx32:;" 581 #endif 582 583 /* Support for configure-time defaults of some command line options. 584 The order here is important so that -march doesn't squash the 585 tune or cpu values. */ 586 #define OPTION_DEFAULT_SPECS \ 587 {"tune", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \ 588 {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ 589 {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ 590 {"cpu", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \ 591 {"cpu_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ 592 {"cpu_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ 593 {"arch", "%{!march=*:-march=%(VALUE)}"}, \ 594 {"arch_32", "%{" OPT_ARCH32 ":%{!march=*:-march=%(VALUE)}}"}, \ 595 {"arch_64", "%{" OPT_ARCH64 ":%{!march=*:-march=%(VALUE)}}"}, 596 597 /* Specs for the compiler proper */ 598 599 #ifndef CC1_CPU_SPEC 600 #define CC1_CPU_SPEC_1 "" 601 602 #ifndef HAVE_LOCAL_CPU_DETECT 603 #define CC1_CPU_SPEC CC1_CPU_SPEC_1 604 #else 605 #define ARCH_ARG "%{" OPT_ARCH64 ":64;:32}" 606 #define CC1_CPU_SPEC CC1_CPU_SPEC_1 \ 607 "%{march=native:%>march=native %:local_cpu_detect(arch " ARCH_ARG ") \ 608 %{!mtune=*:%>mtune=native %:local_cpu_detect(tune " ARCH_ARG ")}} \ 609 %{mtune=native:%>mtune=native %:local_cpu_detect(tune " ARCH_ARG ")}" 610 #endif 611 #endif 612 613 /* Target CPU builtins. */ 614 #define TARGET_CPU_CPP_BUILTINS() ix86_target_macros () 615 616 /* Target Pragmas. */ 617 #define REGISTER_TARGET_PRAGMAS() ix86_register_pragmas () 618 619 #ifndef CC1_SPEC 620 #define CC1_SPEC "%(cc1_cpu) " 621 #endif 622 623 /* This macro defines names of additional specifications to put in the 624 specs that can be used in various specifications like CC1_SPEC. Its 625 definition is an initializer with a subgrouping for each command option. 626 627 Each subgrouping contains a string constant, that defines the 628 specification name, and a string constant that used by the GCC driver 629 program. 630 631 Do not define this macro if it does not need to do anything. */ 632 633 #ifndef SUBTARGET_EXTRA_SPECS 634 #define SUBTARGET_EXTRA_SPECS 635 #endif 636 637 #define EXTRA_SPECS \ 638 { "cc1_cpu", CC1_CPU_SPEC }, \ 639 SUBTARGET_EXTRA_SPECS 640 641 642 /* Whether to allow x87 floating-point arithmetic on MODE (one of 643 SFmode, DFmode and XFmode) in the current excess precision 644 configuration. */ 645 #define X87_ENABLE_ARITH(MODE) \ 646 (ix86_unsafe_math_optimizations \ 647 || ix86_excess_precision == EXCESS_PRECISION_FAST \ 648 || (MODE) == XFmode) 649 650 /* Likewise, whether to allow direct conversions from integer mode 651 IMODE (HImode, SImode or DImode) to MODE. */ 652 #define X87_ENABLE_FLOAT(MODE, IMODE) \ 653 (ix86_unsafe_math_optimizations \ 654 || ix86_excess_precision == EXCESS_PRECISION_FAST \ 655 || (MODE) == XFmode \ 656 || ((MODE) == DFmode && (IMODE) == SImode) \ 657 || (IMODE) == HImode) 658 659 /* target machine storage layout */ 660 661 #define SHORT_TYPE_SIZE 16 662 #define INT_TYPE_SIZE 32 663 #define LONG_TYPE_SIZE (TARGET_X32 ? 32 : BITS_PER_WORD) 664 #define POINTER_SIZE (TARGET_X32 ? 32 : BITS_PER_WORD) 665 #define LONG_LONG_TYPE_SIZE 64 666 #define FLOAT_TYPE_SIZE 32 667 #define DOUBLE_TYPE_SIZE 64 668 #define LONG_DOUBLE_TYPE_SIZE \ 669 (TARGET_LONG_DOUBLE_64 ? 64 : (TARGET_LONG_DOUBLE_128 ? 128 : 80)) 670 671 #define WIDEST_HARDWARE_FP_SIZE 80 672 673 #if defined (TARGET_BI_ARCH) || TARGET_64BIT_DEFAULT 674 #define MAX_BITS_PER_WORD 64 675 #else 676 #define MAX_BITS_PER_WORD 32 677 #endif 678 679 /* Define this if most significant byte of a word is the lowest numbered. */ 680 /* That is true on the 80386. */ 681 682 #define BITS_BIG_ENDIAN 0 683 684 /* Define this if most significant byte of a word is the lowest numbered. */ 685 /* That is not true on the 80386. */ 686 #define BYTES_BIG_ENDIAN 0 687 688 /* Define this if most significant word of a multiword number is the lowest 689 numbered. */ 690 /* Not true for 80386 */ 691 #define WORDS_BIG_ENDIAN 0 692 693 /* Width of a word, in units (bytes). */ 694 #define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4) 695 696 #ifndef IN_LIBGCC2 697 #define MIN_UNITS_PER_WORD 4 698 #endif 699 700 /* Allocation boundary (in *bits*) for storing arguments in argument list. */ 701 #define PARM_BOUNDARY BITS_PER_WORD 702 703 /* Boundary (in *bits*) on which stack pointer should be aligned. */ 704 #define STACK_BOUNDARY (TARGET_64BIT_MS_ABI ? 128 : BITS_PER_WORD) 705 706 /* Stack boundary of the main function guaranteed by OS. */ 707 #define MAIN_STACK_BOUNDARY (TARGET_64BIT ? 128 : 32) 708 709 /* Minimum stack boundary. */ 710 #define MIN_STACK_BOUNDARY BITS_PER_WORD 711 712 /* Boundary (in *bits*) on which the stack pointer prefers to be 713 aligned; the compiler cannot rely on having this alignment. */ 714 #define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary 715 716 /* It should be MIN_STACK_BOUNDARY. But we set it to 128 bits for 717 both 32bit and 64bit, to support codes that need 128 bit stack 718 alignment for SSE instructions, but can't realign the stack. */ 719 #define PREFERRED_STACK_BOUNDARY_DEFAULT \ 720 (TARGET_IAMCU ? MIN_STACK_BOUNDARY : 128) 721 722 /* 1 if -mstackrealign should be turned on by default. It will 723 generate an alternate prologue and epilogue that realigns the 724 runtime stack if nessary. This supports mixing codes that keep a 725 4-byte aligned stack, as specified by i386 psABI, with codes that 726 need a 16-byte aligned stack, as required by SSE instructions. */ 727 #define STACK_REALIGN_DEFAULT 0 728 729 /* Boundary (in *bits*) on which the incoming stack is aligned. */ 730 #define INCOMING_STACK_BOUNDARY ix86_incoming_stack_boundary 731 732 /* According to Windows x64 software convention, the maximum stack allocatable 733 in the prologue is 4G - 8 bytes. Furthermore, there is a limited set of 734 instructions allowed to adjust the stack pointer in the epilog, forcing the 735 use of frame pointer for frames larger than 2 GB. This theorical limit 736 is reduced by 256, an over-estimated upper bound for the stack use by the 737 prologue. 738 We define only one threshold for both the prolog and the epilog. When the 739 frame size is larger than this threshold, we allocate the area to save SSE 740 regs, then save them, and then allocate the remaining. There is no SEH 741 unwind info for this later allocation. */ 742 #define SEH_MAX_FRAME_SIZE ((2U << 30) - 256) 743 744 /* Target OS keeps a vector-aligned (128-bit, 16-byte) stack. This is 745 mandatory for the 64-bit ABI, and may or may not be true for other 746 operating systems. */ 747 #define TARGET_KEEPS_VECTOR_ALIGNED_STACK TARGET_64BIT 748 749 /* Minimum allocation boundary for the code of a function. */ 750 #define FUNCTION_BOUNDARY 8 751 752 /* C++ stores the virtual bit in the lowest bit of function pointers. */ 753 #define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_pfn 754 755 /* Minimum size in bits of the largest boundary to which any 756 and all fundamental data types supported by the hardware 757 might need to be aligned. No data type wants to be aligned 758 rounder than this. 759 760 Pentium+ prefers DFmode values to be aligned to 64 bit boundary 761 and Pentium Pro XFmode values at 128 bit boundaries. 762 763 When increasing the maximum, also update 764 TARGET_ABSOLUTE_BIGGEST_ALIGNMENT. */ 765 766 #define BIGGEST_ALIGNMENT \ 767 (TARGET_IAMCU ? 32 : (TARGET_AVX512F ? 512 : (TARGET_AVX ? 256 : 128))) 768 769 /* Maximum stack alignment. */ 770 #define MAX_STACK_ALIGNMENT MAX_OFILE_ALIGNMENT 771 772 /* Alignment value for attribute ((aligned)). It is a constant since 773 it is the part of the ABI. We shouldn't change it with -mavx. */ 774 #define ATTRIBUTE_ALIGNED_VALUE (TARGET_IAMCU ? 32 : 128) 775 776 /* Decide whether a variable of mode MODE should be 128 bit aligned. */ 777 #define ALIGN_MODE_128(MODE) \ 778 ((MODE) == XFmode || SSE_REG_MODE_P (MODE)) 779 780 /* The published ABIs say that doubles should be aligned on word 781 boundaries, so lower the alignment for structure fields unless 782 -malign-double is set. */ 783 784 /* ??? Blah -- this macro is used directly by libobjc. Since it 785 supports no vector modes, cut out the complexity and fall back 786 on BIGGEST_FIELD_ALIGNMENT. */ 787 #ifdef IN_TARGET_LIBS 788 #ifdef __x86_64__ 789 #define BIGGEST_FIELD_ALIGNMENT 128 790 #else 791 #define BIGGEST_FIELD_ALIGNMENT 32 792 #endif 793 #else 794 #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ 795 x86_field_alignment ((TYPE), (COMPUTED)) 796 #endif 797 798 /* If defined, a C expression to compute the alignment for a static 799 variable. TYPE is the data type, and ALIGN is the alignment that 800 the object would ordinarily have. The value of this macro is used 801 instead of that alignment to align the object. 802 803 If this macro is not defined, then ALIGN is used. 804 805 One use of this macro is to increase alignment of medium-size 806 data to make it all fit in fewer cache lines. Another is to 807 cause character arrays to be word-aligned so that `strcpy' calls 808 that copy constants to character arrays can be done inline. */ 809 810 #define DATA_ALIGNMENT(TYPE, ALIGN) \ 811 ix86_data_alignment ((TYPE), (ALIGN), true) 812 813 /* Similar to DATA_ALIGNMENT, but for the cases where the ABI mandates 814 some alignment increase, instead of optimization only purposes. E.g. 815 AMD x86-64 psABI says that variables with array type larger than 15 bytes 816 must be aligned to 16 byte boundaries. 817 818 If this macro is not defined, then ALIGN is used. */ 819 820 #define DATA_ABI_ALIGNMENT(TYPE, ALIGN) \ 821 ix86_data_alignment ((TYPE), (ALIGN), false) 822 823 /* If defined, a C expression to compute the alignment for a local 824 variable. TYPE is the data type, and ALIGN is the alignment that 825 the object would ordinarily have. The value of this macro is used 826 instead of that alignment to align the object. 827 828 If this macro is not defined, then ALIGN is used. 829 830 One use of this macro is to increase alignment of medium-size 831 data to make it all fit in fewer cache lines. */ 832 833 #define LOCAL_ALIGNMENT(TYPE, ALIGN) \ 834 ix86_local_alignment ((TYPE), VOIDmode, (ALIGN)) 835 836 /* If defined, a C expression to compute the alignment for stack slot. 837 TYPE is the data type, MODE is the widest mode available, and ALIGN 838 is the alignment that the slot would ordinarily have. The value of 839 this macro is used instead of that alignment to align the slot. 840 841 If this macro is not defined, then ALIGN is used when TYPE is NULL, 842 Otherwise, LOCAL_ALIGNMENT will be used. 843 844 One use of this macro is to set alignment of stack slot to the 845 maximum alignment of all possible modes which the slot may have. */ 846 847 #define STACK_SLOT_ALIGNMENT(TYPE, MODE, ALIGN) \ 848 ix86_local_alignment ((TYPE), (MODE), (ALIGN)) 849 850 /* If defined, a C expression to compute the alignment for a local 851 variable DECL. 852 853 If this macro is not defined, then 854 LOCAL_ALIGNMENT (TREE_TYPE (DECL), DECL_ALIGN (DECL)) will be used. 855 856 One use of this macro is to increase alignment of medium-size 857 data to make it all fit in fewer cache lines. */ 858 859 #define LOCAL_DECL_ALIGNMENT(DECL) \ 860 ix86_local_alignment ((DECL), VOIDmode, DECL_ALIGN (DECL)) 861 862 /* If defined, a C expression to compute the minimum required alignment 863 for dynamic stack realignment purposes for EXP (a TYPE or DECL), 864 MODE, assuming normal alignment ALIGN. 865 866 If this macro is not defined, then (ALIGN) will be used. */ 867 868 #define MINIMUM_ALIGNMENT(EXP, MODE, ALIGN) \ 869 ix86_minimum_alignment ((EXP), (MODE), (ALIGN)) 870 871 872 /* Set this nonzero if move instructions will actually fail to work 873 when given unaligned data. */ 874 #define STRICT_ALIGNMENT 0 875 876 /* If bit field type is int, don't let it cross an int, 877 and give entire struct the alignment of an int. */ 878 /* Required on the 386 since it doesn't have bit-field insns. */ 879 #define PCC_BITFIELD_TYPE_MATTERS 1 880 881 /* Standard register usage. */ 882 883 /* This processor has special stack-like registers. See reg-stack.cc 884 for details. */ 885 886 #define STACK_REGS 887 888 #define IS_STACK_MODE(MODE) \ 889 (X87_FLOAT_MODE_P (MODE) \ 890 && (!(SSE_FLOAT_MODE_P (MODE) && TARGET_SSE_MATH) \ 891 || TARGET_MIX_SSE_I387)) 892 893 /* Number of actual hardware registers. 894 The hardware registers are assigned numbers for the compiler 895 from 0 to just below FIRST_PSEUDO_REGISTER. 896 All registers that the compiler knows about must be given numbers, 897 even those that are not normally considered general registers. 898 899 In the 80386 we give the 8 general purpose registers the numbers 0-7. 900 We number the floating point registers 8-15. 901 Note that registers 0-7 can be accessed as a short or int, 902 while only 0-3 may be used with byte `mov' instructions. 903 904 Reg 16 does not correspond to any hardware register, but instead 905 appears in the RTL as an argument pointer prior to reload, and is 906 eliminated during reloading in favor of either the stack or frame 907 pointer. */ 908 909 #define FIRST_PSEUDO_REGISTER FIRST_PSEUDO_REG 910 911 /* Number of hardware registers that go into the DWARF-2 unwind info. 912 If not defined, equals FIRST_PSEUDO_REGISTER. */ 913 914 #define DWARF_FRAME_REGISTERS 17 915 916 /* 1 for registers that have pervasive standard uses 917 and are not available for the register allocator. 918 On the 80386, the stack pointer is such, as is the arg pointer. 919 920 REX registers are disabled for 32bit targets in 921 TARGET_CONDITIONAL_REGISTER_USAGE. */ 922 923 #define FIXED_REGISTERS \ 924 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \ 925 { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, \ 926 /*arg,flags,fpsr,frame*/ \ 927 1, 1, 1, 1, \ 928 /*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \ 929 0, 0, 0, 0, 0, 0, 0, 0, \ 930 /* mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7*/ \ 931 0, 0, 0, 0, 0, 0, 0, 0, \ 932 /* r8, r9, r10, r11, r12, r13, r14, r15*/ \ 933 0, 0, 0, 0, 0, 0, 0, 0, \ 934 /*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \ 935 0, 0, 0, 0, 0, 0, 0, 0, \ 936 /*xmm16,xmm17,xmm18,xmm19,xmm20,xmm21,xmm22,xmm23*/ \ 937 0, 0, 0, 0, 0, 0, 0, 0, \ 938 /*xmm24,xmm25,xmm26,xmm27,xmm28,xmm29,xmm30,xmm31*/ \ 939 0, 0, 0, 0, 0, 0, 0, 0, \ 940 /* k0, k1, k2, k3, k4, k5, k6, k7*/ \ 941 0, 0, 0, 0, 0, 0, 0, 0 } 942 943 /* 1 for registers not available across function calls. 944 These must include the FIXED_REGISTERS and also any 945 registers that can be used without being saved. 946 The latter must include the registers where values are returned 947 and the register where structure-value addresses are passed. 948 Aside from that, you can include as many other registers as you like. 949 950 Value is set to 1 if the register is call used unconditionally. 951 Bit one is set if the register is call used on TARGET_32BIT ABI. 952 Bit two is set if the register is call used on TARGET_64BIT ABI. 953 Bit three is set if the register is call used on TARGET_64BIT_MS_ABI. 954 955 Proper values are computed in TARGET_CONDITIONAL_REGISTER_USAGE. */ 956 957 #define CALL_USED_REGISTERS_MASK(IS_64BIT_MS_ABI) \ 958 ((IS_64BIT_MS_ABI) ? (1 << 3) : TARGET_64BIT ? (1 << 2) : (1 << 1)) 959 960 #define CALL_USED_REGISTERS \ 961 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \ 962 { 1, 1, 1, 0, 4, 4, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ 963 /*arg,flags,fpsr,frame*/ \ 964 1, 1, 1, 1, \ 965 /*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \ 966 1, 1, 1, 1, 1, 1, 6, 6, \ 967 /* mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7*/ \ 968 1, 1, 1, 1, 1, 1, 1, 1, \ 969 /* r8, r9, r10, r11, r12, r13, r14, r15*/ \ 970 1, 1, 1, 1, 2, 2, 2, 2, \ 971 /*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \ 972 6, 6, 6, 6, 6, 6, 6, 6, \ 973 /*xmm16,xmm17,xmm18,xmm19,xmm20,xmm21,xmm22,xmm23*/ \ 974 1, 1, 1, 1, 1, 1, 1, 1, \ 975 /*xmm24,xmm25,xmm26,xmm27,xmm28,xmm29,xmm30,xmm31*/ \ 976 1, 1, 1, 1, 1, 1, 1, 1, \ 977 /* k0, k1, k2, k3, k4, k5, k6, k7*/ \ 978 1, 1, 1, 1, 1, 1, 1, 1 } 979 980 /* Order in which to allocate registers. Each register must be 981 listed once, even those in FIXED_REGISTERS. List frame pointer 982 late and fixed registers last. Note that, in general, we prefer 983 registers listed in CALL_USED_REGISTERS, keeping the others 984 available for storage of persistent values. 985 986 The ADJUST_REG_ALLOC_ORDER actually overwrite the order, 987 so this is just empty initializer for array. */ 988 989 #define REG_ALLOC_ORDER \ 990 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \ 991 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, \ 992 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \ 993 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, \ 994 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75 } 995 996 /* ADJUST_REG_ALLOC_ORDER is a macro which permits reg_alloc_order 997 to be rearranged based on a particular function. When using sse math, 998 we want to allocate SSE before x87 registers and vice versa. */ 999 1000 #define ADJUST_REG_ALLOC_ORDER x86_order_regs_for_local_alloc () 1001 1002 1003 #define OVERRIDE_ABI_FORMAT(FNDECL) ix86_call_abi_override (FNDECL) 1004 1005 #define HARD_REGNO_NREGS_HAS_PADDING(REGNO, MODE) \ 1006 (TARGET_128BIT_LONG_DOUBLE && !TARGET_64BIT \ 1007 && GENERAL_REGNO_P (REGNO) \ 1008 && ((MODE) == XFmode || (MODE) == XCmode)) 1009 1010 #define HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE) ((MODE) == XFmode ? 4 : 8) 1011 1012 #define REGMODE_NATURAL_SIZE(MODE) ix86_regmode_natural_size (MODE) 1013 1014 #define VALID_AVX256_REG_MODE(MODE) \ 1015 ((MODE) == V32QImode || (MODE) == V16HImode || (MODE) == V8SImode \ 1016 || (MODE) == V4DImode || (MODE) == V2TImode || (MODE) == V8SFmode \ 1017 || (MODE) == V4DFmode || (MODE) == V16HFmode) 1018 1019 #define VALID_AVX256_REG_OR_OI_MODE(MODE) \ 1020 (VALID_AVX256_REG_MODE (MODE) || (MODE) == OImode) 1021 1022 #define VALID_AVX512F_SCALAR_MODE(MODE) \ 1023 ((MODE) == DImode || (MODE) == DFmode || (MODE) == SImode \ 1024 || (MODE) == SFmode) 1025 1026 #define VALID_AVX512FP16_SCALAR_MODE(MODE) \ 1027 ((MODE) == HImode || (MODE) == HFmode) 1028 1029 #define VALID_AVX512F_REG_MODE(MODE) \ 1030 ((MODE) == V8DImode || (MODE) == V8DFmode || (MODE) == V64QImode \ 1031 || (MODE) == V16SImode || (MODE) == V16SFmode || (MODE) == V32HImode \ 1032 || (MODE) == V4TImode || (MODE) == V32HFmode) 1033 1034 #define VALID_AVX512F_REG_OR_XI_MODE(MODE) \ 1035 (VALID_AVX512F_REG_MODE (MODE) || (MODE) == XImode) 1036 1037 #define VALID_AVX512VL_128_REG_MODE(MODE) \ 1038 ((MODE) == V2DImode || (MODE) == V2DFmode || (MODE) == V16QImode \ 1039 || (MODE) == V4SImode || (MODE) == V4SFmode || (MODE) == V8HImode \ 1040 || (MODE) == TFmode || (MODE) == V1TImode || (MODE) == V8HFmode \ 1041 || (MODE) == TImode) 1042 1043 #define VALID_AVX512FP16_REG_MODE(MODE) \ 1044 ((MODE) == V8HFmode || (MODE) == V16HFmode || (MODE) == V32HFmode \ 1045 || (MODE) == V2HFmode) 1046 1047 #define VALID_SSE2_REG_MODE(MODE) \ 1048 ((MODE) == V16QImode || (MODE) == V8HImode || (MODE) == V2DFmode \ 1049 || (MODE) == V8HFmode || (MODE) == V4HFmode || (MODE) == V2HFmode \ 1050 || (MODE) == V4QImode || (MODE) == V2HImode || (MODE) == V1SImode \ 1051 || (MODE) == V2DImode || (MODE) == V2QImode || (MODE) == DFmode \ 1052 || (MODE) == HFmode) 1053 1054 #define VALID_SSE_REG_MODE(MODE) \ 1055 ((MODE) == V1TImode || (MODE) == TImode \ 1056 || (MODE) == V4SFmode || (MODE) == V4SImode \ 1057 || (MODE) == SFmode || (MODE) == TFmode || (MODE) == TDmode) 1058 1059 #define VALID_MMX_REG_MODE_3DNOW(MODE) \ 1060 ((MODE) == V2SFmode || (MODE) == SFmode) 1061 1062 /* To match ia32 psABI, V4HFmode should be added here. */ 1063 #define VALID_MMX_REG_MODE(MODE) \ 1064 ((MODE) == V1DImode || (MODE) == DImode \ 1065 || (MODE) == V2SImode || (MODE) == SImode \ 1066 || (MODE) == V4HImode || (MODE) == V8QImode \ 1067 || (MODE) == V4HFmode) 1068 1069 #define VALID_MASK_REG_MODE(MODE) ((MODE) == HImode || (MODE) == QImode) 1070 1071 #define VALID_MASK_AVX512BW_MODE(MODE) ((MODE) == SImode || (MODE) == DImode) 1072 1073 #define VALID_FP_MODE_P(MODE) \ 1074 ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \ 1075 || (MODE) == SCmode || (MODE) == DCmode || (MODE) == XCmode) 1076 1077 #define VALID_INT_MODE_P(MODE) \ 1078 ((MODE) == QImode || (MODE) == HImode \ 1079 || (MODE) == SImode || (MODE) == DImode \ 1080 || (MODE) == CQImode || (MODE) == CHImode \ 1081 || (MODE) == CSImode || (MODE) == CDImode \ 1082 || (MODE) == SDmode || (MODE) == DDmode \ 1083 || (MODE) == HFmode || (MODE) == HCmode \ 1084 || (MODE) == V2HImode || (MODE) == V2HFmode \ 1085 || (MODE) == V1SImode || (MODE) == V4QImode || (MODE) == V2QImode \ 1086 || (TARGET_64BIT \ 1087 && ((MODE) == TImode || (MODE) == CTImode \ 1088 || (MODE) == TFmode || (MODE) == TCmode \ 1089 || (MODE) == V8QImode || (MODE) == V4HImode \ 1090 || (MODE) == V2SImode || (MODE) == TDmode))) 1091 1092 /* Return true for modes passed in SSE registers. */ 1093 #define SSE_REG_MODE_P(MODE) \ 1094 ((MODE) == V1TImode || (MODE) == TImode || (MODE) == V16QImode \ 1095 || (MODE) == TFmode || (MODE) == V8HImode || (MODE) == V2DFmode \ 1096 || (MODE) == V2DImode || (MODE) == V4SFmode || (MODE) == V4SImode \ 1097 || (MODE) == V32QImode || (MODE) == V16HImode || (MODE) == V8SImode \ 1098 || (MODE) == V4DImode || (MODE) == V8SFmode || (MODE) == V4DFmode \ 1099 || (MODE) == V2TImode || (MODE) == V8DImode || (MODE) == V64QImode \ 1100 || (MODE) == V16SImode || (MODE) == V32HImode || (MODE) == V8DFmode \ 1101 || (MODE) == V16SFmode || (MODE) == V32HFmode || (MODE) == V16HFmode \ 1102 || (MODE) == V8HFmode) 1103 1104 #define X87_FLOAT_MODE_P(MODE) \ 1105 (TARGET_80387 && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) 1106 1107 #define SSE_FLOAT_MODE_P(MODE) \ 1108 ((TARGET_SSE && (MODE) == SFmode) || (TARGET_SSE2 && (MODE) == DFmode)) 1109 1110 #define SSE_FLOAT_MODE_SSEMATH_OR_HF_P(MODE) \ 1111 ((SSE_FLOAT_MODE_P (MODE) && TARGET_SSE_MATH) \ 1112 || (TARGET_AVX512FP16 && (MODE) == HFmode)) 1113 1114 #define FMA4_VEC_FLOAT_MODE_P(MODE) \ 1115 (TARGET_FMA4 && ((MODE) == V4SFmode || (MODE) == V2DFmode \ 1116 || (MODE) == V8SFmode || (MODE) == V4DFmode)) 1117 1118 #define VALID_BCST_MODE_P(MODE) \ 1119 ((MODE) == SFmode || (MODE) == DFmode \ 1120 || (MODE) == SImode || (MODE) == DImode \ 1121 || (MODE) == HFmode) 1122 1123 /* It is possible to write patterns to move flags; but until someone 1124 does it, */ 1125 #define AVOID_CCMODE_COPIES 1126 1127 /* Specify the modes required to caller save a given hard regno. 1128 We do this on i386 to prevent flags from being saved at all. 1129 1130 Kill any attempts to combine saving of modes. */ 1131 1132 #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ 1133 (CC_REGNO_P (REGNO) ? VOIDmode \ 1134 : MMX_REGNO_P (REGNO) ? V8QImode \ 1135 : (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode \ 1136 : (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS), NULL) \ 1137 : (MODE) == HImode && !((GENERAL_REGNO_P (REGNO) \ 1138 && TARGET_PARTIAL_REG_STALL) \ 1139 || MASK_REGNO_P (REGNO)) ? SImode \ 1140 : (MODE) == QImode && !(ANY_QI_REGNO_P (REGNO) \ 1141 || MASK_REGNO_P (REGNO)) ? SImode \ 1142 : (MODE)) 1143 1144 /* Specify the registers used for certain standard purposes. 1145 The values of these macros are register numbers. */ 1146 1147 /* on the 386 the pc register is %eip, and is not usable as a general 1148 register. The ordinary mov instructions won't work */ 1149 /* #define PC_REGNUM */ 1150 1151 /* Base register for access to arguments of the function. */ 1152 #define ARG_POINTER_REGNUM ARGP_REG 1153 1154 /* Register to use for pushing function arguments. */ 1155 #define STACK_POINTER_REGNUM SP_REG 1156 1157 /* Base register for access to local variables of the function. */ 1158 #define FRAME_POINTER_REGNUM FRAME_REG 1159 #define HARD_FRAME_POINTER_REGNUM BP_REG 1160 1161 #define FIRST_INT_REG AX_REG 1162 #define LAST_INT_REG SP_REG 1163 1164 #define FIRST_QI_REG AX_REG 1165 #define LAST_QI_REG BX_REG 1166 1167 /* First & last stack-like regs */ 1168 #define FIRST_STACK_REG ST0_REG 1169 #define LAST_STACK_REG ST7_REG 1170 1171 #define FIRST_SSE_REG XMM0_REG 1172 #define LAST_SSE_REG XMM7_REG 1173 1174 #define FIRST_MMX_REG MM0_REG 1175 #define LAST_MMX_REG MM7_REG 1176 1177 #define FIRST_REX_INT_REG R8_REG 1178 #define LAST_REX_INT_REG R15_REG 1179 1180 #define FIRST_REX_SSE_REG XMM8_REG 1181 #define LAST_REX_SSE_REG XMM15_REG 1182 1183 #define FIRST_EXT_REX_SSE_REG XMM16_REG 1184 #define LAST_EXT_REX_SSE_REG XMM31_REG 1185 1186 #define FIRST_MASK_REG MASK0_REG 1187 #define LAST_MASK_REG MASK7_REG 1188 1189 /* Override this in other tm.h files to cope with various OS lossage 1190 requiring a frame pointer. */ 1191 #ifndef SUBTARGET_FRAME_POINTER_REQUIRED 1192 #define SUBTARGET_FRAME_POINTER_REQUIRED 0 1193 #endif 1194 1195 /* Define the shadow offset for asan. Other OS's can override in the 1196 respective tm.h files. */ 1197 #ifndef SUBTARGET_SHADOW_OFFSET 1198 #define SUBTARGET_SHADOW_OFFSET \ 1199 (TARGET_LP64 ? HOST_WIDE_INT_C (0x7fff8000) : HOST_WIDE_INT_1 << 29) 1200 #endif 1201 1202 /* Make sure we can access arbitrary call frames. */ 1203 #define SETUP_FRAME_ADDRESSES() ix86_setup_frame_addresses () 1204 1205 /* Register to hold the addressing base for position independent 1206 code access to data items. We don't use PIC pointer for 64bit 1207 mode. Define the regnum to dummy value to prevent gcc from 1208 pessimizing code dealing with EBX. 1209 1210 To avoid clobbering a call-saved register unnecessarily, we renumber 1211 the pic register when possible. The change is visible after the 1212 prologue has been emitted. */ 1213 1214 #define REAL_PIC_OFFSET_TABLE_REGNUM (TARGET_64BIT ? R15_REG : BX_REG) 1215 1216 #define PIC_OFFSET_TABLE_REGNUM \ 1217 (ix86_use_pseudo_pic_reg () \ 1218 ? (pic_offset_table_rtx \ 1219 ? INVALID_REGNUM \ 1220 : REAL_PIC_OFFSET_TABLE_REGNUM) \ 1221 : INVALID_REGNUM) 1222 1223 #define GOT_SYMBOL_NAME "_GLOBAL_OFFSET_TABLE_" 1224 1225 /* This is overridden by <cygwin.h>. */ 1226 #define MS_AGGREGATE_RETURN 0 1227 1228 #define KEEP_AGGREGATE_RETURN_POINTER 0 1229 1230 /* Define the classes of registers for register constraints in the 1231 machine description. Also define ranges of constants. 1232 1233 One of the classes must always be named ALL_REGS and include all hard regs. 1234 If there is more than one class, another class must be named NO_REGS 1235 and contain no registers. 1236 1237 The name GENERAL_REGS must be the name of a class (or an alias for 1238 another name such as ALL_REGS). This is the class of registers 1239 that is allowed by "g" or "r" in a register constraint. 1240 Also, registers outside this class are allocated only when 1241 instructions express preferences for them. 1242 1243 The classes must be numbered in nondecreasing order; that is, 1244 a larger-numbered class must never be contained completely 1245 in a smaller-numbered class. This is why CLOBBERED_REGS class 1246 is listed early, even though in 64-bit mode it contains more 1247 registers than just %eax, %ecx, %edx. 1248 1249 For any two classes, it is very desirable that there be another 1250 class that represents their union. 1251 1252 The flags and fpsr registers are in no class. */ 1253 1254 enum reg_class 1255 { 1256 NO_REGS, 1257 AREG, DREG, CREG, BREG, SIREG, DIREG, 1258 AD_REGS, /* %eax/%edx for DImode */ 1259 CLOBBERED_REGS, /* call-clobbered integer registers */ 1260 Q_REGS, /* %eax %ebx %ecx %edx */ 1261 NON_Q_REGS, /* %esi %edi %ebp %esp */ 1262 TLS_GOTBASE_REGS, /* %ebx %ecx %edx %esi %edi %ebp */ 1263 INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */ 1264 LEGACY_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */ 1265 GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp 1266 %r8 %r9 %r10 %r11 %r12 %r13 %r14 %r15 */ 1267 FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */ 1268 FLOAT_REGS, 1269 SSE_FIRST_REG, 1270 NO_REX_SSE_REGS, 1271 SSE_REGS, 1272 ALL_SSE_REGS, 1273 MMX_REGS, 1274 FLOAT_SSE_REGS, 1275 FLOAT_INT_REGS, 1276 INT_SSE_REGS, 1277 FLOAT_INT_SSE_REGS, 1278 MASK_REGS, 1279 ALL_MASK_REGS, 1280 INT_MASK_REGS, 1281 ALL_REGS, 1282 LIM_REG_CLASSES 1283 }; 1284 1285 #define N_REG_CLASSES ((int) LIM_REG_CLASSES) 1286 1287 #define INTEGER_CLASS_P(CLASS) \ 1288 reg_class_subset_p ((CLASS), GENERAL_REGS) 1289 #define FLOAT_CLASS_P(CLASS) \ 1290 reg_class_subset_p ((CLASS), FLOAT_REGS) 1291 #define SSE_CLASS_P(CLASS) \ 1292 reg_class_subset_p ((CLASS), ALL_SSE_REGS) 1293 #define INT_SSE_CLASS_P(CLASS) \ 1294 reg_class_subset_p ((CLASS), INT_SSE_REGS) 1295 #define MMX_CLASS_P(CLASS) \ 1296 ((CLASS) == MMX_REGS) 1297 #define MASK_CLASS_P(CLASS) \ 1298 reg_class_subset_p ((CLASS), ALL_MASK_REGS) 1299 #define MAYBE_INTEGER_CLASS_P(CLASS) \ 1300 reg_classes_intersect_p ((CLASS), GENERAL_REGS) 1301 #define MAYBE_FLOAT_CLASS_P(CLASS) \ 1302 reg_classes_intersect_p ((CLASS), FLOAT_REGS) 1303 #define MAYBE_SSE_CLASS_P(CLASS) \ 1304 reg_classes_intersect_p ((CLASS), ALL_SSE_REGS) 1305 #define MAYBE_MMX_CLASS_P(CLASS) \ 1306 reg_classes_intersect_p ((CLASS), MMX_REGS) 1307 #define MAYBE_MASK_CLASS_P(CLASS) \ 1308 reg_classes_intersect_p ((CLASS), ALL_MASK_REGS) 1309 1310 #define Q_CLASS_P(CLASS) \ 1311 reg_class_subset_p ((CLASS), Q_REGS) 1312 1313 #define MAYBE_NON_Q_CLASS_P(CLASS) \ 1314 reg_classes_intersect_p ((CLASS), NON_Q_REGS) 1315 1316 /* Give names of register classes as strings for dump file. */ 1317 1318 #define REG_CLASS_NAMES \ 1319 { "NO_REGS", \ 1320 "AREG", "DREG", "CREG", "BREG", \ 1321 "SIREG", "DIREG", \ 1322 "AD_REGS", \ 1323 "CLOBBERED_REGS", \ 1324 "Q_REGS", "NON_Q_REGS", \ 1325 "TLS_GOTBASE_REGS", \ 1326 "INDEX_REGS", \ 1327 "LEGACY_REGS", \ 1328 "GENERAL_REGS", \ 1329 "FP_TOP_REG", "FP_SECOND_REG", \ 1330 "FLOAT_REGS", \ 1331 "SSE_FIRST_REG", \ 1332 "NO_REX_SSE_REGS", \ 1333 "SSE_REGS", \ 1334 "ALL_SSE_REGS", \ 1335 "MMX_REGS", \ 1336 "FLOAT_SSE_REGS", \ 1337 "FLOAT_INT_REGS", \ 1338 "INT_SSE_REGS", \ 1339 "FLOAT_INT_SSE_REGS", \ 1340 "MASK_REGS", \ 1341 "ALL_MASK_REGS", \ 1342 "INT_MASK_REGS", \ 1343 "ALL_REGS" } 1344 1345 /* Define which registers fit in which classes. This is an initializer 1346 for a vector of HARD_REG_SET of length N_REG_CLASSES. 1347 1348 Note that CLOBBERED_REGS are calculated by 1349 TARGET_CONDITIONAL_REGISTER_USAGE. */ 1350 1351 #define REG_CLASS_CONTENTS \ 1352 { { 0x0, 0x0, 0x0 }, /* NO_REGS */ \ 1353 { 0x01, 0x0, 0x0 }, /* AREG */ \ 1354 { 0x02, 0x0, 0x0 }, /* DREG */ \ 1355 { 0x04, 0x0, 0x0 }, /* CREG */ \ 1356 { 0x08, 0x0, 0x0 }, /* BREG */ \ 1357 { 0x10, 0x0, 0x0 }, /* SIREG */ \ 1358 { 0x20, 0x0, 0x0 }, /* DIREG */ \ 1359 { 0x03, 0x0, 0x0 }, /* AD_REGS */ \ 1360 { 0x07, 0x0, 0x0 }, /* CLOBBERED_REGS */ \ 1361 { 0x0f, 0x0, 0x0 }, /* Q_REGS */ \ 1362 { 0x900f0, 0x0, 0x0 }, /* NON_Q_REGS */ \ 1363 { 0x7e, 0xff0, 0x0 }, /* TLS_GOTBASE_REGS */ \ 1364 { 0x7f, 0xff0, 0x0 }, /* INDEX_REGS */ \ 1365 { 0x900ff, 0x0, 0x0 }, /* LEGACY_REGS */ \ 1366 { 0x900ff, 0xff0, 0x0 }, /* GENERAL_REGS */ \ 1367 { 0x100, 0x0, 0x0 }, /* FP_TOP_REG */ \ 1368 { 0x200, 0x0, 0x0 }, /* FP_SECOND_REG */ \ 1369 { 0xff00, 0x0, 0x0 }, /* FLOAT_REGS */ \ 1370 { 0x100000, 0x0, 0x0 }, /* SSE_FIRST_REG */ \ 1371 { 0xff00000, 0x0, 0x0 }, /* NO_REX_SSE_REGS */ \ 1372 { 0xff00000, 0xff000, 0x0 }, /* SSE_REGS */ \ 1373 { 0xff00000, 0xfffff000, 0xf }, /* ALL_SSE_REGS */ \ 1374 { 0xf0000000, 0xf, 0x0 }, /* MMX_REGS */ \ 1375 { 0xff0ff00, 0xfffff000, 0xf }, /* FLOAT_SSE_REGS */ \ 1376 { 0x9ffff, 0xff0, 0x0 }, /* FLOAT_INT_REGS */ \ 1377 { 0xff900ff, 0xfffffff0, 0xf }, /* INT_SSE_REGS */ \ 1378 { 0xff9ffff, 0xfffffff0, 0xf }, /* FLOAT_INT_SSE_REGS */ \ 1379 { 0x0, 0x0, 0xfe0 }, /* MASK_REGS */ \ 1380 { 0x0, 0x0, 0xff0 }, /* ALL_MASK_REGS */ \ 1381 { 0x900ff, 0xff0, 0xff0 }, /* INT_MASK_REGS */ \ 1382 { 0xffffffff, 0xffffffff, 0xfff } /* ALL_REGS */ \ 1383 } 1384 1385 /* The same information, inverted: 1386 Return the class number of the smallest class containing 1387 reg number REGNO. This could be a conditional expression 1388 or could index an array. */ 1389 1390 #define REGNO_REG_CLASS(REGNO) (regclass_map[(REGNO)]) 1391 1392 /* When this hook returns true for MODE, the compiler allows 1393 registers explicitly used in the rtl to be used as spill registers 1394 but prevents the compiler from extending the lifetime of these 1395 registers. */ 1396 #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P hook_bool_mode_true 1397 1398 #define QI_REG_P(X) (REG_P (X) && QI_REGNO_P (REGNO (X))) 1399 #define QI_REGNO_P(N) IN_RANGE ((N), FIRST_QI_REG, LAST_QI_REG) 1400 1401 #define LEGACY_INT_REG_P(X) (REG_P (X) && LEGACY_INT_REGNO_P (REGNO (X))) 1402 #define LEGACY_INT_REGNO_P(N) (IN_RANGE ((N), FIRST_INT_REG, LAST_INT_REG)) 1403 1404 #define REX_INT_REG_P(X) (REG_P (X) && REX_INT_REGNO_P (REGNO (X))) 1405 #define REX_INT_REGNO_P(N) \ 1406 IN_RANGE ((N), FIRST_REX_INT_REG, LAST_REX_INT_REG) 1407 1408 #define GENERAL_REG_P(X) (REG_P (X) && GENERAL_REGNO_P (REGNO (X))) 1409 #define GENERAL_REGNO_P(N) \ 1410 (LEGACY_INT_REGNO_P (N) || REX_INT_REGNO_P (N)) 1411 1412 #define ANY_QI_REG_P(X) (REG_P (X) && ANY_QI_REGNO_P (REGNO (X))) 1413 #define ANY_QI_REGNO_P(N) \ 1414 (TARGET_64BIT ? GENERAL_REGNO_P (N) : QI_REGNO_P (N)) 1415 1416 #define STACK_REG_P(X) (REG_P (X) && STACK_REGNO_P (REGNO (X))) 1417 #define STACK_REGNO_P(N) IN_RANGE ((N), FIRST_STACK_REG, LAST_STACK_REG) 1418 1419 #define SSE_REG_P(X) (REG_P (X) && SSE_REGNO_P (REGNO (X))) 1420 #define SSE_REGNO_P(N) \ 1421 (LEGACY_SSE_REGNO_P (N) \ 1422 || REX_SSE_REGNO_P (N) \ 1423 || EXT_REX_SSE_REGNO_P (N)) 1424 1425 #define LEGACY_SSE_REGNO_P(N) \ 1426 IN_RANGE ((N), FIRST_SSE_REG, LAST_SSE_REG) 1427 1428 #define REX_SSE_REGNO_P(N) \ 1429 IN_RANGE ((N), FIRST_REX_SSE_REG, LAST_REX_SSE_REG) 1430 1431 #define EXT_REX_SSE_REG_P(X) (REG_P (X) && EXT_REX_SSE_REGNO_P (REGNO (X))) 1432 1433 #define EXT_REX_SSE_REGNO_P(N) \ 1434 IN_RANGE ((N), FIRST_EXT_REX_SSE_REG, LAST_EXT_REX_SSE_REG) 1435 1436 #define ANY_FP_REG_P(X) (REG_P (X) && ANY_FP_REGNO_P (REGNO (X))) 1437 #define ANY_FP_REGNO_P(N) (STACK_REGNO_P (N) || SSE_REGNO_P (N)) 1438 1439 #define MASK_REG_P(X) (REG_P (X) && MASK_REGNO_P (REGNO (X))) 1440 #define MASK_REGNO_P(N) IN_RANGE ((N), FIRST_MASK_REG, LAST_MASK_REG) 1441 #define MASK_PAIR_REGNO_P(N) ((((N) - FIRST_MASK_REG) & 1) == 0) 1442 1443 #define MMX_REG_P(X) (REG_P (X) && MMX_REGNO_P (REGNO (X))) 1444 #define MMX_REGNO_P(N) IN_RANGE ((N), FIRST_MMX_REG, LAST_MMX_REG) 1445 1446 #define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X))) 1447 #define CC_REGNO_P(X) ((X) == FLAGS_REG) 1448 1449 #define MOD4_SSE_REG_P(X) (REG_P (X) && MOD4_SSE_REGNO_P (REGNO (X))) 1450 #define MOD4_SSE_REGNO_P(N) ((N) == XMM0_REG \ 1451 || (N) == XMM4_REG \ 1452 || (N) == XMM8_REG \ 1453 || (N) == XMM12_REG \ 1454 || (N) == XMM16_REG \ 1455 || (N) == XMM20_REG \ 1456 || (N) == XMM24_REG \ 1457 || (N) == XMM28_REG) 1458 1459 /* First floating point reg */ 1460 #define FIRST_FLOAT_REG FIRST_STACK_REG 1461 #define STACK_TOP_P(X) (REG_P (X) && REGNO (X) == FIRST_FLOAT_REG) 1462 1463 #define GET_SSE_REGNO(N) \ 1464 ((N) < 8 ? FIRST_SSE_REG + (N) \ 1465 : (N) < 16 ? FIRST_REX_SSE_REG + (N) - 8 \ 1466 : FIRST_EXT_REX_SSE_REG + (N) - 16) 1467 1468 /* The class value for index registers, and the one for base regs. */ 1469 1470 #define INDEX_REG_CLASS INDEX_REGS 1471 #define BASE_REG_CLASS GENERAL_REGS 1472 1473 /* Stack layout; function entry, exit and calling. */ 1474 1475 /* Define this if pushing a word on the stack 1476 makes the stack pointer a smaller address. */ 1477 #define STACK_GROWS_DOWNWARD 1 1478 1479 /* Define this to nonzero if the nominal address of the stack frame 1480 is at the high-address end of the local variables; 1481 that is, each additional local variable allocated 1482 goes at a more negative offset in the frame. */ 1483 #define FRAME_GROWS_DOWNWARD 1 1484 1485 #define PUSH_ROUNDING(BYTES) ix86_push_rounding (BYTES) 1486 1487 /* If defined, the maximum amount of space required for outgoing arguments 1488 will be computed and placed into the variable `crtl->outgoing_args_size'. 1489 No space will be pushed onto the stack for each call; instead, the 1490 function prologue should increase the stack frame size by this amount. 1491 1492 In 32bit mode enabling argument accumulation results in about 5% code size 1493 growth because move instructions are less compact than push. In 64bit 1494 mode the difference is less drastic but visible. 1495 1496 FIXME: Unlike earlier implementations, the size of unwind info seems to 1497 actually grow with accumulation. Is that because accumulated args 1498 unwind info became unnecesarily bloated? 1499 1500 With the 64-bit MS ABI, we can generate correct code with or without 1501 accumulated args, but because of OUTGOING_REG_PARM_STACK_SPACE the code 1502 generated without accumulated args is terrible. 1503 1504 If stack probes are required, the space used for large function 1505 arguments on the stack must also be probed, so enable 1506 -maccumulate-outgoing-args so this happens in the prologue. 1507 1508 We must use argument accumulation in interrupt function if stack 1509 may be realigned to avoid DRAP. */ 1510 1511 #define ACCUMULATE_OUTGOING_ARGS \ 1512 ((TARGET_ACCUMULATE_OUTGOING_ARGS \ 1513 && optimize_function_for_speed_p (cfun)) \ 1514 || (cfun->machine->func_type != TYPE_NORMAL \ 1515 && crtl->stack_realign_needed) \ 1516 || TARGET_STACK_PROBE \ 1517 || TARGET_64BIT_MS_ABI \ 1518 || (TARGET_MACHO && crtl->profile)) 1519 1520 /* We want the stack and args grow in opposite directions, even if 1521 targetm.calls.push_argument returns false. */ 1522 #define PUSH_ARGS_REVERSED 1 1523 1524 /* Offset of first parameter from the argument pointer register value. */ 1525 #define FIRST_PARM_OFFSET(FNDECL) 0 1526 1527 /* Define this macro if functions should assume that stack space has been 1528 allocated for arguments even when their values are passed in registers. 1529 1530 The value of this macro is the size, in bytes, of the area reserved for 1531 arguments passed in registers for the function represented by FNDECL. 1532 1533 This space can be allocated by the caller, or be a part of the 1534 machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says 1535 which. */ 1536 #define REG_PARM_STACK_SPACE(FNDECL) ix86_reg_parm_stack_space (FNDECL) 1537 1538 #define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) \ 1539 (TARGET_64BIT && ix86_function_type_abi (FNTYPE) == MS_ABI) 1540 1541 /* Define how to find the value returned by a library function 1542 assuming the value has mode MODE. */ 1543 1544 #define LIBCALL_VALUE(MODE) ix86_libcall_value (MODE) 1545 1546 /* Define the size of the result block used for communication between 1547 untyped_call and untyped_return. The block contains a DImode value 1548 followed by the block used by fnsave and frstor. */ 1549 1550 #define APPLY_RESULT_SIZE (8+108) 1551 1552 /* 1 if N is a possible register number for function argument passing. */ 1553 #define FUNCTION_ARG_REGNO_P(N) ix86_function_arg_regno_p (N) 1554 1555 /* Define a data type for recording info about an argument list 1556 during the scan of that argument list. This data type should 1557 hold all necessary information about the function itself 1558 and about the args processed so far, enough to enable macros 1559 such as FUNCTION_ARG to determine where the next arg should go. */ 1560 1561 typedef struct ix86_args { 1562 int words; /* # words passed so far */ 1563 int nregs; /* # registers available for passing */ 1564 int regno; /* next available register number */ 1565 int fastcall; /* fastcall or thiscall calling convention 1566 is used */ 1567 int sse_words; /* # sse words passed so far */ 1568 int sse_nregs; /* # sse registers available for passing */ 1569 int warn_avx512f; /* True when we want to warn 1570 about AVX512F ABI. */ 1571 int warn_avx; /* True when we want to warn about AVX ABI. */ 1572 int warn_sse; /* True when we want to warn about SSE ABI. */ 1573 int warn_mmx; /* True when we want to warn about MMX ABI. */ 1574 int warn_empty; /* True when we want to warn about empty classes 1575 passing ABI change. */ 1576 int sse_regno; /* next available sse register number */ 1577 int mmx_words; /* # mmx words passed so far */ 1578 int mmx_nregs; /* # mmx registers available for passing */ 1579 int mmx_regno; /* next available mmx register number */ 1580 int maybe_vaarg; /* true for calls to possibly vardic fncts. */ 1581 int caller; /* true if it is caller. */ 1582 int float_in_sse; /* Set to 1 or 2 for 32bit targets if 1583 SFmode/DFmode arguments should be passed 1584 in SSE registers. Otherwise 0. */ 1585 int stdarg; /* Set to 1 if function is stdarg. */ 1586 enum calling_abi call_abi; /* Set to SYSV_ABI for sysv abi. Otherwise 1587 MS_ABI for ms abi. */ 1588 tree decl; /* Callee decl. */ 1589 } CUMULATIVE_ARGS; 1590 1591 /* Initialize a variable CUM of type CUMULATIVE_ARGS 1592 for a call to a function whose data type is FNTYPE. 1593 For a library call, FNTYPE is 0. */ 1594 1595 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ 1596 init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (FNDECL), \ 1597 (N_NAMED_ARGS) != -1) 1598 1599 /* Output assembler code to FILE to increment profiler label # LABELNO 1600 for profiling a function entry. */ 1601 1602 #define FUNCTION_PROFILER(FILE, LABELNO) \ 1603 x86_function_profiler ((FILE), (LABELNO)) 1604 1605 #define MCOUNT_NAME "_mcount" 1606 1607 #define MCOUNT_NAME_BEFORE_PROLOGUE "__fentry__" 1608 1609 #define PROFILE_COUNT_REGISTER "edx" 1610 1611 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, 1612 the stack pointer does not matter. The value is tested only in 1613 functions that have frame pointers. 1614 No definition is equivalent to always zero. */ 1615 /* Note on the 386 it might be more efficient not to define this since 1616 we have to restore it ourselves from the frame pointer, in order to 1617 use pop */ 1618 1619 #define EXIT_IGNORE_STACK 1 1620 1621 /* Define this macro as a C expression that is nonzero for registers 1622 used by the epilogue or the `return' pattern. */ 1623 1624 #define EPILOGUE_USES(REGNO) ix86_epilogue_uses (REGNO) 1625 1626 /* Output assembler code for a block containing the constant parts 1627 of a trampoline, leaving space for the variable parts. */ 1628 1629 /* On the 386, the trampoline contains two instructions: 1630 mov #STATIC,ecx 1631 jmp FUNCTION 1632 The trampoline is generated entirely at runtime. The operand of JMP 1633 is the address of FUNCTION relative to the instruction following the 1634 JMP (which is 5 bytes long). */ 1635 1636 /* Length in units of the trampoline for entering a nested function. */ 1637 1638 #define TRAMPOLINE_SIZE (TARGET_64BIT ? 28 : 14) 1639 1640 /* Definitions for register eliminations. 1641 1642 This is an array of structures. Each structure initializes one pair 1643 of eliminable registers. The "from" register number is given first, 1644 followed by "to". Eliminations of the same "from" register are listed 1645 in order of preference. 1646 1647 There are two registers that can always be eliminated on the i386. 1648 The frame pointer and the arg pointer can be replaced by either the 1649 hard frame pointer or to the stack pointer, depending upon the 1650 circumstances. The hard frame pointer is not used before reload and 1651 so it is not eligible for elimination. */ 1652 1653 #define ELIMINABLE_REGS \ 1654 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 1655 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ 1656 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 1657 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} \ 1658 1659 /* Define the offset between two registers, one to be eliminated, and the other 1660 its replacement, at the start of a routine. */ 1661 1662 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ 1663 ((OFFSET) = ix86_initial_elimination_offset ((FROM), (TO))) 1664 1665 /* Addressing modes, and classification of registers for them. */ 1666 1667 /* Macros to check register numbers against specific register classes. */ 1668 1669 /* These assume that REGNO is a hard or pseudo reg number. 1670 They give nonzero only if REGNO is a hard reg of the suitable class 1671 or a pseudo reg currently allocated to a suitable hard reg. 1672 Since they use reg_renumber, they are safe only once reg_renumber 1673 has been allocated, which happens in reginfo.cc during register 1674 allocation. */ 1675 1676 #define REGNO_OK_FOR_INDEX_P(REGNO) \ 1677 ((REGNO) < STACK_POINTER_REGNUM \ 1678 || REX_INT_REGNO_P (REGNO) \ 1679 || (unsigned) reg_renumber[(REGNO)] < STACK_POINTER_REGNUM \ 1680 || REX_INT_REGNO_P ((unsigned) reg_renumber[(REGNO)])) 1681 1682 #define REGNO_OK_FOR_BASE_P(REGNO) \ 1683 (GENERAL_REGNO_P (REGNO) \ 1684 || (REGNO) == ARG_POINTER_REGNUM \ 1685 || (REGNO) == FRAME_POINTER_REGNUM \ 1686 || GENERAL_REGNO_P ((unsigned) reg_renumber[(REGNO)])) 1687 1688 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx 1689 and check its validity for a certain class. 1690 We have two alternate definitions for each of them. 1691 The usual definition accepts all pseudo regs; the other rejects 1692 them unless they have been allocated suitable hard regs. 1693 The symbol REG_OK_STRICT causes the latter definition to be used. 1694 1695 Most source files want to accept pseudo regs in the hope that 1696 they will get allocated to the class that the insn wants them to be in. 1697 Source files for reload pass need to be strict. 1698 After reload, it makes no difference, since pseudo regs have 1699 been eliminated by then. */ 1700 1701 1702 /* Non strict versions, pseudos are ok. */ 1703 #define REG_OK_FOR_INDEX_NONSTRICT_P(X) \ 1704 (REGNO (X) < STACK_POINTER_REGNUM \ 1705 || REX_INT_REGNO_P (REGNO (X)) \ 1706 || REGNO (X) >= FIRST_PSEUDO_REGISTER) 1707 1708 #define REG_OK_FOR_BASE_NONSTRICT_P(X) \ 1709 (GENERAL_REGNO_P (REGNO (X)) \ 1710 || REGNO (X) == ARG_POINTER_REGNUM \ 1711 || REGNO (X) == FRAME_POINTER_REGNUM \ 1712 || REGNO (X) >= FIRST_PSEUDO_REGISTER) 1713 1714 /* Strict versions, hard registers only */ 1715 #define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) 1716 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) 1717 1718 #ifndef REG_OK_STRICT 1719 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P (X) 1720 #define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P (X) 1721 1722 #else 1723 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P (X) 1724 #define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X) 1725 #endif 1726 1727 /* TARGET_LEGITIMATE_ADDRESS_P recognizes an RTL expression 1728 that is a valid memory address for an instruction. 1729 The MODE argument is the machine mode for the MEM expression 1730 that wants to use this address. 1731 1732 The other macros defined here are used only in TARGET_LEGITIMATE_ADDRESS_P, 1733 except for CONSTANT_ADDRESS_P which is usually machine-independent. 1734 1735 See legitimize_pic_address in i386.cc for details as to what 1736 constitutes a legitimate address when -fpic is used. */ 1737 1738 #define MAX_REGS_PER_ADDRESS 2 1739 1740 #define CONSTANT_ADDRESS_P(X) constant_address_p (X) 1741 1742 /* If defined, a C expression to determine the base term of address X. 1743 This macro is used in only one place: `find_base_term' in alias.cc. 1744 1745 It is always safe for this macro to not be defined. It exists so 1746 that alias analysis can understand machine-dependent addresses. 1747 1748 The typical use of this macro is to handle addresses containing 1749 a label_ref or symbol_ref within an UNSPEC. */ 1750 1751 #define FIND_BASE_TERM(X) ix86_find_base_term (X) 1752 1753 /* Nonzero if the constant value X is a legitimate general operand 1754 when generating PIC code. It is given that flag_pic is on and 1755 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ 1756 1757 #define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X) 1758 1759 #define STRIP_UNARY(X) (UNARY_P (X) ? XEXP (X, 0) : X) 1760 1761 #define SYMBOLIC_CONST(X) \ 1762 (GET_CODE (X) == SYMBOL_REF \ 1763 || GET_CODE (X) == LABEL_REF \ 1764 || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X))) 1765 1766 /* Max number of args passed in registers. If this is more than 3, we will 1767 have problems with ebx (register #4), since it is a caller save register and 1768 is also used as the pic register in ELF. So for now, don't allow more than 1769 3 registers to be passed in registers. */ 1770 1771 /* Abi specific values for REGPARM_MAX and SSE_REGPARM_MAX */ 1772 #define X86_64_REGPARM_MAX 6 1773 #define X86_64_MS_REGPARM_MAX 4 1774 1775 #define X86_32_REGPARM_MAX 3 1776 1777 #define REGPARM_MAX \ 1778 (TARGET_64BIT \ 1779 ? (TARGET_64BIT_MS_ABI \ 1780 ? X86_64_MS_REGPARM_MAX \ 1781 : X86_64_REGPARM_MAX) \ 1782 : X86_32_REGPARM_MAX) 1783 1784 #define X86_64_SSE_REGPARM_MAX 8 1785 #define X86_64_MS_SSE_REGPARM_MAX 4 1786 1787 #define X86_32_SSE_REGPARM_MAX (TARGET_SSE ? (TARGET_MACHO ? 4 : 3) : 0) 1788 1789 #define SSE_REGPARM_MAX \ 1790 (TARGET_64BIT \ 1791 ? (TARGET_64BIT_MS_ABI \ 1792 ? X86_64_MS_SSE_REGPARM_MAX \ 1793 : X86_64_SSE_REGPARM_MAX) \ 1794 : X86_32_SSE_REGPARM_MAX) 1795 1796 #define X86_32_MMX_REGPARM_MAX (TARGET_MMX ? (TARGET_MACHO ? 0 : 3) : 0) 1797 1798 #define MMX_REGPARM_MAX (TARGET_64BIT ? 0 : X86_32_MMX_REGPARM_MAX) 1799 1800 /* Specify the machine mode that this machine uses 1801 for the index in the tablejump instruction. */ 1802 #define CASE_VECTOR_MODE \ 1803 (!TARGET_LP64 || (flag_pic && ix86_cmodel != CM_LARGE_PIC) ? SImode : DImode) 1804 1805 /* Define this as 1 if `char' should by default be signed; else as 0. */ 1806 #define DEFAULT_SIGNED_CHAR 1 1807 1808 /* The constant maximum number of bytes that a single instruction can 1809 move quickly between memory and registers or between two memory 1810 locations. */ 1811 #define MAX_MOVE_MAX 64 1812 1813 /* Max number of bytes we can move from memory to memory in one 1814 reasonably fast instruction, as opposed to MOVE_MAX_PIECES which 1815 is the number of bytes at a time which we can move efficiently. 1816 MOVE_MAX_PIECES defaults to MOVE_MAX. */ 1817 1818 #define MOVE_MAX \ 1819 ((TARGET_AVX512F \ 1820 && (ix86_move_max == PVW_AVX512 \ 1821 || ix86_store_max == PVW_AVX512)) \ 1822 ? 64 \ 1823 : ((TARGET_AVX \ 1824 && (ix86_move_max >= PVW_AVX256 \ 1825 || ix86_store_max >= PVW_AVX256)) \ 1826 ? 32 \ 1827 : ((TARGET_SSE2 \ 1828 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL \ 1829 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL) \ 1830 ? 16 : UNITS_PER_WORD))) 1831 1832 /* STORE_MAX_PIECES is the number of bytes at a time that we can store 1833 efficiently. Allow 16/32/64 bytes only if inter-unit move is enabled 1834 since vec_duplicate enabled by inter-unit move is used to implement 1835 store_by_pieces of 16/32/64 bytes. */ 1836 #define STORE_MAX_PIECES \ 1837 (TARGET_INTER_UNIT_MOVES_TO_VEC \ 1838 ? ((TARGET_AVX512F && ix86_store_max == PVW_AVX512) \ 1839 ? 64 \ 1840 : ((TARGET_AVX \ 1841 && ix86_store_max >= PVW_AVX256) \ 1842 ? 32 \ 1843 : ((TARGET_SSE2 \ 1844 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL) \ 1845 ? 16 : UNITS_PER_WORD))) \ 1846 : UNITS_PER_WORD) 1847 1848 /* If a memory-to-memory move would take MOVE_RATIO or more simple 1849 move-instruction pairs, we will do a cpymem or libcall instead. 1850 Increasing the value will always make code faster, but eventually 1851 incurs high cost in increased code size. 1852 1853 If you don't define this, a reasonable default is used. */ 1854 1855 #define MOVE_RATIO(speed) ((speed) ? ix86_cost->move_ratio : 3) 1856 1857 /* If a clear memory operation would take CLEAR_RATIO or more simple 1858 move-instruction sequences, we will do a clrmem or libcall instead. */ 1859 1860 #define CLEAR_RATIO(speed) ((speed) ? ix86_cost->clear_ratio : 2) 1861 1862 /* Define if shifts truncate the shift count which implies one can 1863 omit a sign-extension or zero-extension of a shift count. 1864 1865 On i386, shifts do truncate the count. But bit test instructions 1866 take the modulo of the bit offset operand. */ 1867 1868 /* #define SHIFT_COUNT_TRUNCATED */ 1869 1870 /* A macro to update M and UNSIGNEDP when an object whose type is 1871 TYPE and which has the specified mode and signedness is to be 1872 stored in a register. This macro is only called when TYPE is a 1873 scalar type. 1874 1875 On i386 it is sometimes useful to promote HImode and QImode 1876 quantities to SImode. The choice depends on target type. */ 1877 1878 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ 1879 do { \ 1880 if (((MODE) == HImode && TARGET_PROMOTE_HI_REGS) \ 1881 || ((MODE) == QImode && TARGET_PROMOTE_QI_REGS)) \ 1882 (MODE) = SImode; \ 1883 } while (0) 1884 1885 /* Specify the machine mode that pointers have. 1886 After generation of rtl, the compiler makes no further distinction 1887 between pointers and any other objects of this machine mode. */ 1888 #define Pmode (ix86_pmode == PMODE_DI ? DImode : SImode) 1889 1890 /* Supply a definition of STACK_SAVEAREA_MODE for emit_stack_save. 1891 NONLOCAL needs space to save both shadow stack and stack pointers. 1892 1893 FIXME: We only need to save and restore stack pointer in ptr_mode. 1894 But expand_builtin_setjmp_setup and expand_builtin_longjmp use Pmode 1895 to save and restore stack pointer. See 1896 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84150 1897 */ 1898 #define STACK_SAVEAREA_MODE(LEVEL) \ 1899 ((LEVEL) == SAVE_NONLOCAL ? (TARGET_64BIT ? TImode : DImode) : Pmode) 1900 1901 /* Specify the machine_mode of the size increment 1902 operand of an 'allocate_stack' named pattern. */ 1903 #define STACK_SIZE_MODE Pmode 1904 1905 /* A C expression whose value is zero if pointers that need to be extended 1906 from being `POINTER_SIZE' bits wide to `Pmode' are sign-extended and 1907 greater then zero if they are zero-extended and less then zero if the 1908 ptr_extend instruction should be used. */ 1909 1910 #define POINTERS_EXTEND_UNSIGNED 1 1911 1912 /* A function address in a call instruction 1913 is a byte address (for indexing purposes) 1914 so give the MEM rtx a byte's mode. */ 1915 #define FUNCTION_MODE QImode 1916 1917 1918 /* A C expression for the cost of a branch instruction. A value of 1 1919 is the default; other values are interpreted relative to that. */ 1920 1921 #define BRANCH_COST(speed_p, predictable_p) \ 1922 (!(speed_p) ? 2 : (predictable_p) ? 0 : ix86_branch_cost) 1923 1924 /* An integer expression for the size in bits of the largest integer machine 1925 mode that should actually be used. We allow pairs of registers. */ 1926 #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_64BIT ? TImode : DImode) 1927 1928 /* Define this macro as a C expression which is nonzero if accessing 1929 less than a word of memory (i.e. a `char' or a `short') is no 1930 faster than accessing a word of memory, i.e., if such access 1931 require more than one instruction or if there is no difference in 1932 cost between byte and (aligned) word loads. 1933 1934 When this macro is not defined, the compiler will access a field by 1935 finding the smallest containing object; when it is defined, a 1936 fullword load will be used if alignment permits. Unless bytes 1937 accesses are faster than word accesses, using word accesses is 1938 preferable since it may eliminate subsequent memory access if 1939 subsequent accesses occur to other fields in the same word of the 1940 structure, but to different bytes. */ 1941 1942 #define SLOW_BYTE_ACCESS 0 1943 1944 /* Nonzero if access to memory by shorts is slow and undesirable. */ 1945 #define SLOW_SHORT_ACCESS 0 1946 1947 /* Define this macro if it is as good or better to call a constant 1948 function address than to call an address kept in a register. 1949 1950 Desirable on the 386 because a CALL with a constant address is 1951 faster than one with a register address. */ 1952 1953 #define NO_FUNCTION_CSE 1 1954 1955 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, 1956 return the mode to be used for the comparison. 1957 1958 For floating-point equality comparisons, CCFPEQmode should be used. 1959 VOIDmode should be used in all other cases. 1960 1961 For integer comparisons against zero, reduce to CCNOmode or CCZmode if 1962 possible, to allow for more combinations. */ 1963 1964 #define SELECT_CC_MODE(OP, X, Y) ix86_cc_mode ((OP), (X), (Y)) 1965 1966 /* Return nonzero if MODE implies a floating point inequality can be 1967 reversed. */ 1968 1969 #define REVERSIBLE_CC_MODE(MODE) 1 1970 1971 /* A C expression whose value is reversed condition code of the CODE for 1972 comparison done in CC_MODE mode. */ 1973 #define REVERSE_CONDITION(CODE, MODE) ix86_reverse_condition ((CODE), (MODE)) 1974 1975 1976 /* Control the assembler format that we output, to the extent 1977 this does not vary between assemblers. */ 1978 1979 /* How to refer to registers in assembler output. 1980 This sequence is indexed by compiler's hard-register-number (see above). */ 1981 1982 /* In order to refer to the first 8 regs as 32-bit regs, prefix an "e". 1983 For non floating point regs, the following are the HImode names. 1984 1985 For float regs, the stack top is sometimes referred to as "%st(0)" 1986 instead of just "%st". TARGET_PRINT_OPERAND handles this with the 1987 "y" code. */ 1988 1989 #define HI_REGISTER_NAMES \ 1990 {"ax","dx","cx","bx","si","di","bp","sp", \ 1991 "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)", \ 1992 "argp", "flags", "fpsr", "frame", \ 1993 "xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7", \ 1994 "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7", \ 1995 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ 1996 "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15", \ 1997 "xmm16", "xmm17", "xmm18", "xmm19", \ 1998 "xmm20", "xmm21", "xmm22", "xmm23", \ 1999 "xmm24", "xmm25", "xmm26", "xmm27", \ 2000 "xmm28", "xmm29", "xmm30", "xmm31", \ 2001 "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7" } 2002 2003 #define REGISTER_NAMES HI_REGISTER_NAMES 2004 2005 #define QI_REGISTER_NAMES \ 2006 {"al", "dl", "cl", "bl", "sil", "dil", "bpl", "spl"} 2007 2008 #define QI_HIGH_REGISTER_NAMES \ 2009 {"ah", "dh", "ch", "bh"} 2010 2011 /* Table of additional register names to use in user input. */ 2012 2013 #define ADDITIONAL_REGISTER_NAMES \ 2014 { \ 2015 { "eax", AX_REG }, { "edx", DX_REG }, { "ecx", CX_REG }, { "ebx", BX_REG }, \ 2016 { "esi", SI_REG }, { "edi", DI_REG }, { "ebp", BP_REG }, { "esp", SP_REG }, \ 2017 { "rax", AX_REG }, { "rdx", DX_REG }, { "rcx", CX_REG }, { "rbx", BX_REG }, \ 2018 { "rsi", SI_REG }, { "rdi", DI_REG }, { "rbp", BP_REG }, { "rsp", SP_REG }, \ 2019 { "al", AX_REG }, { "dl", DX_REG }, { "cl", CX_REG }, { "bl", BX_REG }, \ 2020 { "sil", SI_REG }, { "dil", DI_REG }, { "bpl", BP_REG }, { "spl", SP_REG }, \ 2021 { "ah", AX_REG }, { "dh", DX_REG }, { "ch", CX_REG }, { "bh", BX_REG }, \ 2022 { "ymm0", XMM0_REG }, { "ymm1", XMM1_REG }, { "ymm2", XMM2_REG }, { "ymm3", XMM3_REG }, \ 2023 { "ymm4", XMM4_REG }, { "ymm5", XMM5_REG }, { "ymm6", XMM6_REG }, { "ymm7", XMM7_REG }, \ 2024 { "ymm8", XMM8_REG }, { "ymm9", XMM9_REG }, { "ymm10", XMM10_REG }, { "ymm11", XMM11_REG }, \ 2025 { "ymm12", XMM12_REG }, { "ymm13", XMM13_REG }, { "ymm14", XMM14_REG }, { "ymm15", XMM15_REG }, \ 2026 { "ymm16", XMM16_REG }, { "ymm17", XMM17_REG }, { "ymm18", XMM18_REG }, { "ymm19", XMM19_REG }, \ 2027 { "ymm20", XMM20_REG }, { "ymm21", XMM21_REG }, { "ymm22", XMM22_REG }, { "ymm23", XMM23_REG }, \ 2028 { "ymm24", XMM24_REG }, { "ymm25", XMM25_REG }, { "ymm26", XMM26_REG }, { "ymm27", XMM27_REG }, \ 2029 { "ymm28", XMM28_REG }, { "ymm29", XMM29_REG }, { "ymm30", XMM30_REG }, { "ymm31", XMM31_REG }, \ 2030 { "zmm0", XMM0_REG }, { "zmm1", XMM1_REG }, { "zmm2", XMM2_REG }, { "zmm3", XMM3_REG }, \ 2031 { "zmm4", XMM4_REG }, { "zmm5", XMM5_REG }, { "zmm6", XMM6_REG }, { "zmm7", XMM7_REG }, \ 2032 { "zmm8", XMM8_REG }, { "zmm9", XMM9_REG }, { "zmm10", XMM10_REG }, { "zmm11", XMM11_REG }, \ 2033 { "zmm12", XMM12_REG }, { "zmm13", XMM13_REG }, { "zmm14", XMM14_REG }, { "zmm15", XMM15_REG }, \ 2034 { "zmm16", XMM16_REG }, { "zmm17", XMM17_REG }, { "zmm18", XMM18_REG }, { "zmm19", XMM19_REG }, \ 2035 { "zmm20", XMM20_REG }, { "zmm21", XMM21_REG }, { "zmm22", XMM22_REG }, { "zmm23", XMM23_REG }, \ 2036 { "zmm24", XMM24_REG }, { "zmm25", XMM25_REG }, { "zmm26", XMM26_REG }, { "zmm27", XMM27_REG }, \ 2037 { "zmm28", XMM28_REG }, { "zmm29", XMM29_REG }, { "zmm30", XMM30_REG }, { "zmm31", XMM31_REG } \ 2038 } 2039 2040 /* How to renumber registers for dbx and gdb. */ 2041 2042 #define DBX_REGISTER_NUMBER(N) \ 2043 (TARGET_64BIT ? dbx64_register_map[(N)] : dbx_register_map[(N)]) 2044 2045 extern int const dbx_register_map[FIRST_PSEUDO_REGISTER]; 2046 extern int const dbx64_register_map[FIRST_PSEUDO_REGISTER]; 2047 extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; 2048 2049 /* Before the prologue, RA is at 0(%esp). */ 2050 #define INCOMING_RETURN_ADDR_RTX \ 2051 gen_rtx_MEM (Pmode, stack_pointer_rtx) 2052 2053 /* After the prologue, RA is at -4(AP) in the current frame. */ 2054 #define RETURN_ADDR_RTX(COUNT, FRAME) \ 2055 ((COUNT) == 0 \ 2056 ? gen_rtx_MEM (Pmode, plus_constant (Pmode, arg_pointer_rtx, \ 2057 -UNITS_PER_WORD)) \ 2058 : gen_rtx_MEM (Pmode, plus_constant (Pmode, (FRAME), UNITS_PER_WORD))) 2059 2060 /* PC is dbx register 8; let's use that column for RA. */ 2061 #define DWARF_FRAME_RETURN_COLUMN (TARGET_64BIT ? 16 : 8) 2062 2063 /* Before the prologue, there are return address and error code for 2064 exception handler on the top of the frame. */ 2065 #define INCOMING_FRAME_SP_OFFSET \ 2066 (cfun->machine->func_type == TYPE_EXCEPTION \ 2067 ? 2 * UNITS_PER_WORD : UNITS_PER_WORD) 2068 2069 /* The value of INCOMING_FRAME_SP_OFFSET the assembler assumes in 2070 .cfi_startproc. */ 2071 #define DEFAULT_INCOMING_FRAME_SP_OFFSET UNITS_PER_WORD 2072 2073 /* Describe how we implement __builtin_eh_return. */ 2074 #define EH_RETURN_DATA_REGNO(N) ((N) <= DX_REG ? (N) : INVALID_REGNUM) 2075 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, CX_REG) 2076 2077 2078 /* Select a format to encode pointers in exception handling data. CODE 2079 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is 2080 true if the symbol may be affected by dynamic relocations. 2081 2082 ??? All x86 object file formats are capable of representing this. 2083 After all, the relocation needed is the same as for the call insn. 2084 Whether or not a particular assembler allows us to enter such, I 2085 guess we'll have to see. */ 2086 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ 2087 asm_preferred_eh_data_format ((CODE), (GLOBAL)) 2088 2089 /* These are a couple of extensions to the formats accepted 2090 by asm_fprintf: 2091 %z prints out opcode suffix for word-mode instruction 2092 %r prints out word-mode name for reg_names[arg] */ 2093 #define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P) \ 2094 case 'z': \ 2095 fputc (TARGET_64BIT ? 'q' : 'l', (FILE)); \ 2096 break; \ 2097 \ 2098 case 'r': \ 2099 { \ 2100 unsigned int regno = va_arg ((ARGS), int); \ 2101 if (LEGACY_INT_REGNO_P (regno)) \ 2102 fputc (TARGET_64BIT ? 'r' : 'e', (FILE)); \ 2103 fputs (reg_names[regno], (FILE)); \ 2104 break; \ 2105 } 2106 2107 /* This is how to output an insn to push a register on the stack. */ 2108 2109 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \ 2110 asm_fprintf ((FILE), "\tpush%z\t%%%r\n", (REGNO)) 2111 2112 /* This is how to output an insn to pop a register from the stack. */ 2113 2114 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \ 2115 asm_fprintf ((FILE), "\tpop%z\t%%%r\n", (REGNO)) 2116 2117 /* This is how to output an element of a case-vector that is absolute. */ 2118 2119 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ 2120 ix86_output_addr_vec_elt ((FILE), (VALUE)) 2121 2122 /* This is how to output an element of a case-vector that is relative. */ 2123 2124 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ 2125 ix86_output_addr_diff_elt ((FILE), (VALUE), (REL)) 2126 2127 /* When we see %v, we will print the 'v' prefix if TARGET_AVX is true. */ 2128 2129 #define ASM_OUTPUT_AVX_PREFIX(STREAM, PTR) \ 2130 { \ 2131 if ((PTR)[0] == '%' && (PTR)[1] == 'v') \ 2132 (PTR) += TARGET_AVX ? 1 : 2; \ 2133 } 2134 2135 /* A C statement or statements which output an assembler instruction 2136 opcode to the stdio stream STREAM. The macro-operand PTR is a 2137 variable of type `char *' which points to the opcode name in 2138 its "internal" form--the form that is written in the machine 2139 description. */ 2140 2141 #define ASM_OUTPUT_OPCODE(STREAM, PTR) \ 2142 ASM_OUTPUT_AVX_PREFIX ((STREAM), (PTR)) 2143 2144 /* A C statement to output to the stdio stream FILE an assembler 2145 command to pad the location counter to a multiple of 1<<LOG 2146 bytes if it is within MAX_SKIP bytes. */ 2147 2148 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN 2149 # define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ 2150 do { \ 2151 if ((LOG) != 0) { \ 2152 if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1 << (LOG)) - 1) \ 2153 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ 2154 else \ 2155 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ 2156 } \ 2157 } while (0) 2158 #endif 2159 2160 /* Write the extra assembler code needed to declare a function 2161 properly. */ 2162 2163 #undef ASM_OUTPUT_FUNCTION_LABEL 2164 #define ASM_OUTPUT_FUNCTION_LABEL(FILE, NAME, DECL) \ 2165 ix86_asm_output_function_label ((FILE), (NAME), (DECL)) 2166 2167 /* A C statement (sans semicolon) to output a reference to SYMBOL_REF SYM. 2168 If not defined, assemble_name will be used to output the name of the 2169 symbol. This macro may be used to modify the way a symbol is referenced 2170 depending on information encoded by TARGET_ENCODE_SECTION_INFO. */ 2171 2172 #ifndef ASM_OUTPUT_SYMBOL_REF 2173 #define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \ 2174 do { \ 2175 const char *name \ 2176 = assemble_name_resolve (XSTR (x, 0)); \ 2177 /* In -masm=att wrap identifiers that start with $ \ 2178 into parens. */ \ 2179 if (ASSEMBLER_DIALECT == ASM_ATT \ 2180 && name[0] == '$' \ 2181 && user_label_prefix[0] == '\0') \ 2182 { \ 2183 fputc ('(', (FILE)); \ 2184 assemble_name_raw ((FILE), name); \ 2185 fputc (')', (FILE)); \ 2186 } \ 2187 else \ 2188 assemble_name_raw ((FILE), name); \ 2189 } while (0) 2190 #endif 2191 2192 /* Under some conditions we need jump tables in the text section, 2193 because the assembler cannot handle label differences between 2194 sections. */ 2195 2196 #define JUMP_TABLES_IN_TEXT_SECTION \ 2197 (flag_pic && !(TARGET_64BIT || HAVE_AS_GOTOFF_IN_DATA)) 2198 2199 /* Switch to init or fini section via SECTION_OP, emit a call to FUNC, 2200 and switch back. For x86 we do this only to save a few bytes that 2201 would otherwise be unused in the text section. */ 2202 #define CRT_MKSTR2(VAL) #VAL 2203 #define CRT_MKSTR(x) CRT_MKSTR2(x) 2204 2205 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ 2206 asm (SECTION_OP "\n\t" \ 2207 "call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n" \ 2208 TEXT_SECTION_ASM_OP); 2209 2210 /* Default threshold for putting data in large sections 2211 with x86-64 medium memory model */ 2212 #define DEFAULT_LARGE_SECTION_THRESHOLD 65536 2213 2214 /* Which processor to tune code generation for. These must be in sync 2215 with processor_target_table in i386.cc. */ 2216 2217 enum processor_type 2218 { 2219 PROCESSOR_GENERIC = 0, 2220 PROCESSOR_I386, /* 80386 */ 2221 PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */ 2222 PROCESSOR_PENTIUM, 2223 PROCESSOR_LAKEMONT, 2224 PROCESSOR_PENTIUMPRO, 2225 PROCESSOR_PENTIUM4, 2226 PROCESSOR_NOCONA, 2227 PROCESSOR_CORE2, 2228 PROCESSOR_NEHALEM, 2229 PROCESSOR_SANDYBRIDGE, 2230 PROCESSOR_HASWELL, 2231 PROCESSOR_BONNELL, 2232 PROCESSOR_SILVERMONT, 2233 PROCESSOR_GOLDMONT, 2234 PROCESSOR_GOLDMONT_PLUS, 2235 PROCESSOR_TREMONT, 2236 PROCESSOR_KNL, 2237 PROCESSOR_KNM, 2238 PROCESSOR_SKYLAKE, 2239 PROCESSOR_SKYLAKE_AVX512, 2240 PROCESSOR_CANNONLAKE, 2241 PROCESSOR_ICELAKE_CLIENT, 2242 PROCESSOR_ICELAKE_SERVER, 2243 PROCESSOR_CASCADELAKE, 2244 PROCESSOR_TIGERLAKE, 2245 PROCESSOR_COOPERLAKE, 2246 PROCESSOR_SAPPHIRERAPIDS, 2247 PROCESSOR_ALDERLAKE, 2248 PROCESSOR_ROCKETLAKE, 2249 PROCESSOR_INTEL, 2250 PROCESSOR_GEODE, 2251 PROCESSOR_K6, 2252 PROCESSOR_ATHLON, 2253 PROCESSOR_K8, 2254 PROCESSOR_AMDFAM10, 2255 PROCESSOR_BDVER1, 2256 PROCESSOR_BDVER2, 2257 PROCESSOR_BDVER3, 2258 PROCESSOR_BDVER4, 2259 PROCESSOR_BTVER1, 2260 PROCESSOR_BTVER2, 2261 PROCESSOR_ZNVER1, 2262 PROCESSOR_ZNVER2, 2263 PROCESSOR_ZNVER3, 2264 PROCESSOR_ZNVER4, 2265 PROCESSOR_max 2266 }; 2267 2268 #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS) 2269 extern const char *const processor_names[]; 2270 2271 #include "wide-int-bitmask.h" 2272 2273 enum pta_flag 2274 { 2275 #define DEF_PTA(NAME) _ ## NAME, 2276 #include "i386-isa.def" 2277 #undef DEF_PTA 2278 END_PTA 2279 }; 2280 2281 /* wide_int_bitmask can handle only 128 flags. */ 2282 STATIC_ASSERT (END_PTA <= 128); 2283 2284 #define WIDE_INT_BITMASK_FROM_NTH(N) (N < 64 ? wide_int_bitmask (0, 1ULL << N) \ 2285 : wide_int_bitmask (1ULL << (N - 64), 0)) 2286 2287 #define DEF_PTA(NAME) constexpr wide_int_bitmask PTA_ ## NAME \ 2288 = WIDE_INT_BITMASK_FROM_NTH ((pta_flag) _ ## NAME); 2289 #include "i386-isa.def" 2290 #undef DEF_PTA 2291 2292 constexpr wide_int_bitmask PTA_X86_64_BASELINE = PTA_64BIT | PTA_MMX | PTA_SSE 2293 | PTA_SSE2 | PTA_NO_SAHF | PTA_FXSR; 2294 constexpr wide_int_bitmask PTA_X86_64_V2 = (PTA_X86_64_BASELINE 2295 & (~PTA_NO_SAHF)) 2296 | PTA_CX16 | PTA_POPCNT | PTA_SSE3 | PTA_SSE4_1 | PTA_SSE4_2 | PTA_SSSE3; 2297 constexpr wide_int_bitmask PTA_X86_64_V3 = PTA_X86_64_V2 2298 | PTA_AVX | PTA_AVX2 | PTA_BMI | PTA_BMI2 | PTA_F16C | PTA_FMA | PTA_LZCNT 2299 | PTA_MOVBE | PTA_XSAVE; 2300 constexpr wide_int_bitmask PTA_X86_64_V4 = PTA_X86_64_V3 2301 | PTA_AVX512F | PTA_AVX512BW | PTA_AVX512CD | PTA_AVX512DQ | PTA_AVX512VL; 2302 2303 constexpr wide_int_bitmask PTA_CORE2 = PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 2304 | PTA_SSE3 | PTA_SSSE3 | PTA_CX16 | PTA_FXSR; 2305 constexpr wide_int_bitmask PTA_NEHALEM = PTA_CORE2 | PTA_SSE4_1 | PTA_SSE4_2 2306 | PTA_POPCNT; 2307 constexpr wide_int_bitmask PTA_WESTMERE = PTA_NEHALEM | PTA_PCLMUL; 2308 constexpr wide_int_bitmask PTA_SANDYBRIDGE = PTA_WESTMERE | PTA_AVX | PTA_XSAVE 2309 | PTA_XSAVEOPT; 2310 constexpr wide_int_bitmask PTA_IVYBRIDGE = PTA_SANDYBRIDGE | PTA_FSGSBASE 2311 | PTA_RDRND | PTA_F16C; 2312 constexpr wide_int_bitmask PTA_HASWELL = PTA_IVYBRIDGE | PTA_AVX2 | PTA_BMI 2313 | PTA_BMI2 | PTA_LZCNT | PTA_FMA | PTA_MOVBE | PTA_HLE; 2314 constexpr wide_int_bitmask PTA_BROADWELL = PTA_HASWELL | PTA_ADX | PTA_RDSEED 2315 | PTA_PRFCHW; 2316 constexpr wide_int_bitmask PTA_SKYLAKE = PTA_BROADWELL | PTA_AES 2317 | PTA_CLFLUSHOPT | PTA_XSAVEC | PTA_XSAVES | PTA_SGX; 2318 constexpr wide_int_bitmask PTA_SKYLAKE_AVX512 = PTA_SKYLAKE | PTA_AVX512F 2319 | PTA_AVX512CD | PTA_AVX512VL | PTA_AVX512BW | PTA_AVX512DQ | PTA_PKU 2320 | PTA_CLWB; 2321 constexpr wide_int_bitmask PTA_CASCADELAKE = PTA_SKYLAKE_AVX512 2322 | PTA_AVX512VNNI; 2323 constexpr wide_int_bitmask PTA_COOPERLAKE = PTA_CASCADELAKE | PTA_AVX512BF16; 2324 constexpr wide_int_bitmask PTA_CANNONLAKE = PTA_SKYLAKE | PTA_AVX512F 2325 | PTA_AVX512CD | PTA_AVX512VL | PTA_AVX512BW | PTA_AVX512DQ | PTA_PKU 2326 | PTA_AVX512VBMI | PTA_AVX512IFMA | PTA_SHA; 2327 constexpr wide_int_bitmask PTA_ICELAKE_CLIENT = PTA_CANNONLAKE | PTA_AVX512VNNI 2328 | PTA_GFNI | PTA_VAES | PTA_AVX512VBMI2 | PTA_VPCLMULQDQ | PTA_AVX512BITALG 2329 | PTA_RDPID | PTA_AVX512VPOPCNTDQ; 2330 constexpr wide_int_bitmask PTA_ROCKETLAKE = PTA_ICELAKE_CLIENT & ~PTA_SGX; 2331 constexpr wide_int_bitmask PTA_ICELAKE_SERVER = PTA_ICELAKE_CLIENT 2332 | PTA_PCONFIG | PTA_WBNOINVD | PTA_CLWB; 2333 constexpr wide_int_bitmask PTA_TIGERLAKE = PTA_ICELAKE_CLIENT | PTA_MOVDIRI 2334 | PTA_MOVDIR64B | PTA_CLWB | PTA_AVX512VP2INTERSECT | PTA_KL | PTA_WIDEKL; 2335 constexpr wide_int_bitmask PTA_SAPPHIRERAPIDS = PTA_ICELAKE_SERVER | PTA_MOVDIRI 2336 | PTA_MOVDIR64B | PTA_ENQCMD | PTA_CLDEMOTE | PTA_PTWRITE | PTA_WAITPKG 2337 | PTA_SERIALIZE | PTA_TSXLDTRK | PTA_AMX_TILE | PTA_AMX_INT8 | PTA_AMX_BF16 2338 | PTA_UINTR | PTA_AVXVNNI | PTA_AVX512FP16 | PTA_AVX512BF16; 2339 constexpr wide_int_bitmask PTA_KNL = PTA_BROADWELL | PTA_AVX512PF 2340 | PTA_AVX512ER | PTA_AVX512F | PTA_AVX512CD | PTA_PREFETCHWT1; 2341 constexpr wide_int_bitmask PTA_BONNELL = PTA_CORE2 | PTA_MOVBE; 2342 constexpr wide_int_bitmask PTA_SILVERMONT = PTA_WESTMERE | PTA_MOVBE 2343 | PTA_RDRND | PTA_PRFCHW; 2344 constexpr wide_int_bitmask PTA_GOLDMONT = PTA_SILVERMONT | PTA_AES | PTA_SHA 2345 | PTA_XSAVE | PTA_RDSEED | PTA_XSAVEC | PTA_XSAVES | PTA_CLFLUSHOPT 2346 | PTA_XSAVEOPT | PTA_FSGSBASE; 2347 constexpr wide_int_bitmask PTA_GOLDMONT_PLUS = PTA_GOLDMONT | PTA_RDPID 2348 | PTA_SGX | PTA_PTWRITE; 2349 constexpr wide_int_bitmask PTA_TREMONT = PTA_GOLDMONT_PLUS | PTA_CLWB 2350 | PTA_GFNI | PTA_MOVDIRI | PTA_MOVDIR64B | PTA_CLDEMOTE | PTA_WAITPKG; 2351 constexpr wide_int_bitmask PTA_ALDERLAKE = PTA_TREMONT | PTA_ADX | PTA_AVX 2352 | PTA_AVX2 | PTA_BMI | PTA_BMI2 | PTA_F16C | PTA_FMA | PTA_LZCNT 2353 | PTA_PCONFIG | PTA_PKU | PTA_VAES | PTA_VPCLMULQDQ | PTA_SERIALIZE 2354 | PTA_HRESET | PTA_KL | PTA_WIDEKL | PTA_AVXVNNI; 2355 constexpr wide_int_bitmask PTA_KNM = PTA_KNL | PTA_AVX5124VNNIW 2356 | PTA_AVX5124FMAPS | PTA_AVX512VPOPCNTDQ; 2357 constexpr wide_int_bitmask PTA_ZNVER1 = PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 2358 | PTA_SSE3 | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1 2359 | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_AVX2 | PTA_BMI | PTA_BMI2 2360 | PTA_F16C | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE | PTA_XSAVEOPT 2361 | PTA_FSGSBASE | PTA_RDRND | PTA_MOVBE | PTA_MWAITX | PTA_ADX | PTA_RDSEED 2362 | PTA_CLZERO | PTA_CLFLUSHOPT | PTA_XSAVEC | PTA_XSAVES | PTA_SHA | PTA_LZCNT 2363 | PTA_POPCNT; 2364 constexpr wide_int_bitmask PTA_ZNVER2 = PTA_ZNVER1 | PTA_CLWB | PTA_RDPID 2365 | PTA_WBNOINVD; 2366 constexpr wide_int_bitmask PTA_ZNVER3 = PTA_ZNVER2 | PTA_VAES | PTA_VPCLMULQDQ 2367 | PTA_PKU; 2368 constexpr wide_int_bitmask PTA_ZNVER4 = PTA_ZNVER3 | PTA_AVX512F | PTA_AVX512DQ 2369 | PTA_AVX512IFMA | PTA_AVX512CD | PTA_AVX512BW | PTA_AVX512VL 2370 | PTA_AVX512BF16 | PTA_AVX512VBMI | PTA_AVX512VBMI2 | PTA_GFNI 2371 | PTA_AVX512VNNI | PTA_AVX512BITALG | PTA_AVX512VPOPCNTDQ; 2372 2373 #ifndef GENERATOR_FILE 2374 2375 #include "insn-attr-common.h" 2376 2377 #include "common/config/i386/i386-cpuinfo.h" 2378 2379 class pta 2380 { 2381 public: 2382 const char *const name; /* processor name or nickname. */ 2383 const enum processor_type processor; 2384 const enum attr_cpu schedule; 2385 const wide_int_bitmask flags; 2386 const int model; 2387 const enum feature_priority priority; 2388 }; 2389 2390 extern const pta processor_alias_table[]; 2391 extern unsigned int const pta_size; 2392 extern unsigned int const num_arch_names; 2393 #endif 2394 2395 #endif 2396 2397 extern enum processor_type ix86_tune; 2398 extern enum processor_type ix86_arch; 2399 2400 /* Size of the RED_ZONE area. */ 2401 #define RED_ZONE_SIZE 128 2402 /* Reserved area of the red zone for temporaries. */ 2403 #define RED_ZONE_RESERVE 8 2404 2405 extern unsigned int ix86_preferred_stack_boundary; 2406 extern unsigned int ix86_incoming_stack_boundary; 2407 2408 /* Smallest class containing REGNO. */ 2409 extern enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER]; 2410 2411 enum ix86_fpcmp_strategy { 2412 IX86_FPCMP_SAHF, 2413 IX86_FPCMP_COMI, 2414 IX86_FPCMP_ARITH 2415 }; 2416 2417 /* To properly truncate FP values into integers, we need to set i387 control 2418 word. We can't emit proper mode switching code before reload, as spills 2419 generated by reload may truncate values incorrectly, but we still can avoid 2420 redundant computation of new control word by the mode switching pass. 2421 The fldcw instructions are still emitted redundantly, but this is probably 2422 not going to be noticeable problem, as most CPUs do have fast path for 2423 the sequence. 2424 2425 The machinery is to emit simple truncation instructions and split them 2426 before reload to instructions having USEs of two memory locations that 2427 are filled by this code to old and new control word. 2428 2429 Post-reload pass may be later used to eliminate the redundant fildcw if 2430 needed. */ 2431 2432 enum ix86_stack_slot 2433 { 2434 SLOT_TEMP = 0, 2435 SLOT_CW_STORED, 2436 SLOT_CW_ROUNDEVEN, 2437 SLOT_CW_TRUNC, 2438 SLOT_CW_FLOOR, 2439 SLOT_CW_CEIL, 2440 SLOT_STV_TEMP, 2441 SLOT_FLOATxFDI_387, 2442 MAX_386_STACK_LOCALS 2443 }; 2444 2445 enum ix86_entity 2446 { 2447 X86_DIRFLAG = 0, 2448 AVX_U128, 2449 I387_ROUNDEVEN, 2450 I387_TRUNC, 2451 I387_FLOOR, 2452 I387_CEIL, 2453 MAX_386_ENTITIES 2454 }; 2455 2456 enum x86_dirflag_state 2457 { 2458 X86_DIRFLAG_RESET, 2459 X86_DIRFLAG_ANY 2460 }; 2461 2462 enum avx_u128_state 2463 { 2464 AVX_U128_CLEAN, 2465 AVX_U128_DIRTY, 2466 AVX_U128_ANY 2467 }; 2468 2469 /* Define this macro if the port needs extra instructions inserted 2470 for mode switching in an optimizing compilation. */ 2471 2472 #define OPTIMIZE_MODE_SWITCHING(ENTITY) \ 2473 ix86_optimize_mode_switching[(ENTITY)] 2474 2475 /* If you define `OPTIMIZE_MODE_SWITCHING', you have to define this as 2476 initializer for an array of integers. Each initializer element N 2477 refers to an entity that needs mode switching, and specifies the 2478 number of different modes that might need to be set for this 2479 entity. The position of the initializer in the initializer - 2480 starting counting at zero - determines the integer that is used to 2481 refer to the mode-switched entity in question. */ 2482 2483 #define NUM_MODES_FOR_MODE_SWITCHING \ 2484 { X86_DIRFLAG_ANY, AVX_U128_ANY, \ 2485 I387_CW_ANY, I387_CW_ANY, I387_CW_ANY, I387_CW_ANY } 2486 2487 2488 /* Avoid renaming of stack registers, as doing so in combination with 2489 scheduling just increases amount of live registers at time and in 2490 the turn amount of fxch instructions needed. 2491 2492 ??? Maybe Pentium chips benefits from renaming, someone can try.... 2493 2494 Don't rename evex to non-evex sse registers. */ 2495 2496 #define HARD_REGNO_RENAME_OK(SRC, TARGET) \ 2497 (!STACK_REGNO_P (SRC) \ 2498 && EXT_REX_SSE_REGNO_P (SRC) == EXT_REX_SSE_REGNO_P (TARGET)) 2499 2500 2501 #define FASTCALL_PREFIX '@' 2502 2503 #ifndef USED_FOR_TARGET 2504 /* Structure describing stack frame layout. 2505 Stack grows downward: 2506 2507 [arguments] 2508 <- ARG_POINTER 2509 saved pc 2510 2511 saved static chain if ix86_static_chain_on_stack 2512 2513 saved frame pointer if frame_pointer_needed 2514 <- HARD_FRAME_POINTER 2515 [saved regs] 2516 <- reg_save_offset 2517 [padding0] 2518 <- stack_realign_offset 2519 [saved SSE regs] 2520 OR 2521 [stub-saved registers for ms x64 --> sysv clobbers 2522 <- Start of out-of-line, stub-saved/restored regs 2523 (see libgcc/config/i386/(sav|res)ms64*.S) 2524 [XMM6-15] 2525 [RSI] 2526 [RDI] 2527 [?RBX] only if RBX is clobbered 2528 [?RBP] only if RBP and RBX are clobbered 2529 [?R12] only if R12 and all previous regs are clobbered 2530 [?R13] only if R13 and all previous regs are clobbered 2531 [?R14] only if R14 and all previous regs are clobbered 2532 [?R15] only if R15 and all previous regs are clobbered 2533 <- end of stub-saved/restored regs 2534 [padding1] 2535 ] 2536 <- sse_reg_save_offset 2537 [padding2] 2538 | <- FRAME_POINTER 2539 [va_arg registers] | 2540 | 2541 [frame] | 2542 | 2543 [padding2] | = to_allocate 2544 <- STACK_POINTER 2545 */ 2546 struct GTY(()) ix86_frame 2547 { 2548 int nsseregs; 2549 int nregs; 2550 int va_arg_size; 2551 int red_zone_size; 2552 int outgoing_arguments_size; 2553 2554 /* The offsets relative to ARG_POINTER. */ 2555 HOST_WIDE_INT frame_pointer_offset; 2556 HOST_WIDE_INT hard_frame_pointer_offset; 2557 HOST_WIDE_INT stack_pointer_offset; 2558 HOST_WIDE_INT hfp_save_offset; 2559 HOST_WIDE_INT reg_save_offset; 2560 HOST_WIDE_INT stack_realign_allocate; 2561 HOST_WIDE_INT stack_realign_offset; 2562 HOST_WIDE_INT sse_reg_save_offset; 2563 2564 /* When save_regs_using_mov is set, emit prologue using 2565 move instead of push instructions. */ 2566 bool save_regs_using_mov; 2567 2568 /* Assume without checking that: 2569 EXPENSIVE_P = expensive_function_p (EXPENSIVE_COUNT). */ 2570 bool expensive_p; 2571 int expensive_count; 2572 }; 2573 2574 /* Machine specific frame tracking during prologue/epilogue generation. All 2575 values are positive, but since the x86 stack grows downward, are subtratced 2576 from the CFA to produce a valid address. */ 2577 2578 struct GTY(()) machine_frame_state 2579 { 2580 /* This pair tracks the currently active CFA as reg+offset. When reg 2581 is drap_reg, we don't bother trying to record here the real CFA when 2582 it might really be a DW_CFA_def_cfa_expression. */ 2583 rtx cfa_reg; 2584 HOST_WIDE_INT cfa_offset; 2585 2586 /* The current offset (canonically from the CFA) of ESP and EBP. 2587 When stack frame re-alignment is active, these may not be relative 2588 to the CFA. However, in all cases they are relative to the offsets 2589 of the saved registers stored in ix86_frame. */ 2590 HOST_WIDE_INT sp_offset; 2591 HOST_WIDE_INT fp_offset; 2592 2593 /* The size of the red-zone that may be assumed for the purposes of 2594 eliding register restore notes in the epilogue. This may be zero 2595 if no red-zone is in effect, or may be reduced from the real 2596 red-zone value by a maximum runtime stack re-alignment value. */ 2597 int red_zone_offset; 2598 2599 /* Indicate whether each of ESP, EBP or DRAP currently holds a valid 2600 value within the frame. If false then the offset above should be 2601 ignored. Note that DRAP, if valid, *always* points to the CFA and 2602 thus has an offset of zero. */ 2603 BOOL_BITFIELD sp_valid : 1; 2604 BOOL_BITFIELD fp_valid : 1; 2605 BOOL_BITFIELD drap_valid : 1; 2606 2607 /* Indicate whether the local stack frame has been re-aligned. When 2608 set, the SP/FP offsets above are relative to the aligned frame 2609 and not the CFA. */ 2610 BOOL_BITFIELD realigned : 1; 2611 2612 /* Indicates whether the stack pointer has been re-aligned. When set, 2613 SP/FP continue to be relative to the CFA, but the stack pointer 2614 should only be used for offsets > sp_realigned_offset, while 2615 the frame pointer should be used for offsets <= sp_realigned_fp_last. 2616 The flags realigned and sp_realigned are mutually exclusive. */ 2617 BOOL_BITFIELD sp_realigned : 1; 2618 2619 /* If sp_realigned is set, this is the last valid offset from the CFA 2620 that can be used for access with the frame pointer. */ 2621 HOST_WIDE_INT sp_realigned_fp_last; 2622 2623 /* If sp_realigned is set, this is the offset from the CFA that the stack 2624 pointer was realigned, and may or may not be equal to sp_realigned_fp_last. 2625 Access via the stack pointer is only valid for offsets that are greater than 2626 this value. */ 2627 HOST_WIDE_INT sp_realigned_offset; 2628 }; 2629 2630 /* Private to winnt.cc. */ 2631 struct seh_frame_state; 2632 2633 enum function_type 2634 { 2635 TYPE_UNKNOWN = 0, 2636 TYPE_NORMAL, 2637 /* The current function is an interrupt service routine with a 2638 pointer argument as specified by the "interrupt" attribute. */ 2639 TYPE_INTERRUPT, 2640 /* The current function is an interrupt service routine with a 2641 pointer argument and an integer argument as specified by the 2642 "interrupt" attribute. */ 2643 TYPE_EXCEPTION 2644 }; 2645 2646 enum queued_insn_type 2647 { 2648 TYPE_NONE = 0, 2649 TYPE_ENDBR, 2650 TYPE_PATCHABLE_AREA 2651 }; 2652 2653 struct GTY(()) machine_function { 2654 struct stack_local_entry *stack_locals; 2655 int varargs_gpr_size; 2656 int varargs_fpr_size; 2657 int optimize_mode_switching[MAX_386_ENTITIES]; 2658 2659 /* Cached initial frame layout for the current function. */ 2660 struct ix86_frame frame; 2661 2662 /* For -fsplit-stack support: A stack local which holds a pointer to 2663 the stack arguments for a function with a variable number of 2664 arguments. This is set at the start of the function and is used 2665 to initialize the overflow_arg_area field of the va_list 2666 structure. */ 2667 rtx split_stack_varargs_pointer; 2668 2669 /* This value is used for amd64 targets and specifies the current abi 2670 to be used. MS_ABI means ms abi. Otherwise SYSV_ABI means sysv abi. */ 2671 ENUM_BITFIELD(calling_abi) call_abi : 8; 2672 2673 /* Nonzero if the function accesses a previous frame. */ 2674 BOOL_BITFIELD accesses_prev_frame : 1; 2675 2676 /* Set by ix86_compute_frame_layout and used by prologue/epilogue 2677 expander to determine the style used. */ 2678 BOOL_BITFIELD use_fast_prologue_epilogue : 1; 2679 2680 /* Nonzero if the current function calls pc thunk and 2681 must not use the red zone. */ 2682 BOOL_BITFIELD pc_thunk_call_expanded : 1; 2683 2684 /* If true, the current function needs the default PIC register, not 2685 an alternate register (on x86) and must not use the red zone (on 2686 x86_64), even if it's a leaf function. We don't want the 2687 function to be regarded as non-leaf because TLS calls need not 2688 affect register allocation. This flag is set when a TLS call 2689 instruction is expanded within a function, and never reset, even 2690 if all such instructions are optimized away. Use the 2691 ix86_current_function_calls_tls_descriptor macro for a better 2692 approximation. */ 2693 BOOL_BITFIELD tls_descriptor_call_expanded_p : 1; 2694 2695 /* If true, the current function has a STATIC_CHAIN is placed on the 2696 stack below the return address. */ 2697 BOOL_BITFIELD static_chain_on_stack : 1; 2698 2699 /* If true, it is safe to not save/restore DRAP register. */ 2700 BOOL_BITFIELD no_drap_save_restore : 1; 2701 2702 /* Function type. */ 2703 ENUM_BITFIELD(function_type) func_type : 2; 2704 2705 /* How to generate indirec branch. */ 2706 ENUM_BITFIELD(indirect_branch) indirect_branch_type : 3; 2707 2708 /* If true, the current function has local indirect jumps, like 2709 "indirect_jump" or "tablejump". */ 2710 BOOL_BITFIELD has_local_indirect_jump : 1; 2711 2712 /* How to generate function return. */ 2713 ENUM_BITFIELD(indirect_branch) function_return_type : 3; 2714 2715 /* If true, the current function is a function specified with 2716 the "interrupt" or "no_caller_saved_registers" attribute. */ 2717 BOOL_BITFIELD no_caller_saved_registers : 1; 2718 2719 /* If true, there is register available for argument passing. This 2720 is used only in ix86_function_ok_for_sibcall by 32-bit to determine 2721 if there is scratch register available for indirect sibcall. In 2722 64-bit, rax, r10 and r11 are scratch registers which aren't used to 2723 pass arguments and can be used for indirect sibcall. */ 2724 BOOL_BITFIELD arg_reg_available : 1; 2725 2726 /* If true, we're out-of-lining reg save/restore for regs clobbered 2727 by 64-bit ms_abi functions calling a sysv_abi function. */ 2728 BOOL_BITFIELD call_ms2sysv : 1; 2729 2730 /* If true, the incoming 16-byte aligned stack has an offset (of 8) and 2731 needs padding prior to out-of-line stub save/restore area. */ 2732 BOOL_BITFIELD call_ms2sysv_pad_in : 1; 2733 2734 /* This is the number of extra registers saved by stub (valid range is 2735 0-6). Each additional register is only saved/restored by the stubs 2736 if all successive ones are. (Will always be zero when using a hard 2737 frame pointer.) */ 2738 unsigned int call_ms2sysv_extra_regs:3; 2739 2740 /* Nonzero if the function places outgoing arguments on stack. */ 2741 BOOL_BITFIELD outgoing_args_on_stack : 1; 2742 2743 /* If true, ENDBR or patchable area is queued at function entrance. */ 2744 ENUM_BITFIELD(queued_insn_type) insn_queued_at_entrance : 2; 2745 2746 /* If true, the function label has been emitted. */ 2747 BOOL_BITFIELD function_label_emitted : 1; 2748 2749 /* True if the function needs a stack frame. */ 2750 BOOL_BITFIELD stack_frame_required : 1; 2751 2752 /* True if we should act silently, rather than raise an error for 2753 invalid calls. */ 2754 BOOL_BITFIELD silent_p : 1; 2755 2756 /* True if red zone is used. */ 2757 BOOL_BITFIELD red_zone_used : 1; 2758 2759 /* The largest alignment, in bytes, of stack slot actually used. */ 2760 unsigned int max_used_stack_alignment; 2761 2762 /* During prologue/epilogue generation, the current frame state. 2763 Otherwise, the frame state at the end of the prologue. */ 2764 struct machine_frame_state fs; 2765 2766 /* During SEH output, this is non-null. */ 2767 struct seh_frame_state * GTY((skip(""))) seh; 2768 }; 2769 2770 extern GTY(()) tree sysv_va_list_type_node; 2771 extern GTY(()) tree ms_va_list_type_node; 2772 #endif 2773 2774 #define ix86_stack_locals (cfun->machine->stack_locals) 2775 #define ix86_varargs_gpr_size (cfun->machine->varargs_gpr_size) 2776 #define ix86_varargs_fpr_size (cfun->machine->varargs_fpr_size) 2777 #define ix86_optimize_mode_switching (cfun->machine->optimize_mode_switching) 2778 #define ix86_pc_thunk_call_expanded (cfun->machine->pc_thunk_call_expanded) 2779 #define ix86_tls_descriptor_calls_expanded_in_cfun \ 2780 (cfun->machine->tls_descriptor_call_expanded_p) 2781 /* Since tls_descriptor_call_expanded is not cleared, even if all TLS 2782 calls are optimized away, we try to detect cases in which it was 2783 optimized away. Since such instructions (use (reg REG_SP)), we can 2784 verify whether there's any such instruction live by testing that 2785 REG_SP is live. */ 2786 #define ix86_current_function_calls_tls_descriptor \ 2787 (ix86_tls_descriptor_calls_expanded_in_cfun && df_regs_ever_live_p (SP_REG)) 2788 #define ix86_static_chain_on_stack (cfun->machine->static_chain_on_stack) 2789 #define ix86_red_zone_used (cfun->machine->red_zone_used) 2790 2791 /* Control behavior of x86_file_start. */ 2792 #define X86_FILE_START_VERSION_DIRECTIVE false 2793 #define X86_FILE_START_FLTUSED false 2794 2795 /* Flag to mark data that is in the large address area. */ 2796 #define SYMBOL_FLAG_FAR_ADDR (SYMBOL_FLAG_MACH_DEP << 0) 2797 #define SYMBOL_REF_FAR_ADDR_P(X) \ 2798 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_FAR_ADDR) != 0) 2799 2800 /* Flags to mark dllimport/dllexport. Used by PE ports, but handy to 2801 have defined always, to avoid ifdefing. */ 2802 #define SYMBOL_FLAG_DLLIMPORT (SYMBOL_FLAG_MACH_DEP << 1) 2803 #define SYMBOL_REF_DLLIMPORT_P(X) \ 2804 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLIMPORT) != 0) 2805 2806 #define SYMBOL_FLAG_DLLEXPORT (SYMBOL_FLAG_MACH_DEP << 2) 2807 #define SYMBOL_REF_DLLEXPORT_P(X) \ 2808 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0) 2809 2810 #define SYMBOL_FLAG_STUBVAR (SYMBOL_FLAG_MACH_DEP << 4) 2811 #define SYMBOL_REF_STUBVAR_P(X) \ 2812 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_STUBVAR) != 0) 2813 2814 extern void debug_ready_dispatch (void); 2815 extern void debug_dispatch_window (int); 2816 2817 /* The value at zero is only defined for the BMI instructions 2818 LZCNT and TZCNT, not the BSR/BSF insns in the original isa. */ 2819 #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ 2820 ((VALUE) = GET_MODE_BITSIZE (MODE), TARGET_BMI ? 2 : 0) 2821 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ 2822 ((VALUE) = GET_MODE_BITSIZE (MODE), TARGET_LZCNT ? 2 : 0) 2823 2824 2825 /* Flags returned by ix86_get_callcvt (). */ 2826 #define IX86_CALLCVT_CDECL 0x1 2827 #define IX86_CALLCVT_STDCALL 0x2 2828 #define IX86_CALLCVT_FASTCALL 0x4 2829 #define IX86_CALLCVT_THISCALL 0x8 2830 #define IX86_CALLCVT_REGPARM 0x10 2831 #define IX86_CALLCVT_SSEREGPARM 0x20 2832 2833 #define IX86_BASE_CALLCVT(FLAGS) \ 2834 ((FLAGS) & (IX86_CALLCVT_CDECL | IX86_CALLCVT_STDCALL \ 2835 | IX86_CALLCVT_FASTCALL | IX86_CALLCVT_THISCALL)) 2836 2837 #define RECIP_MASK_NONE 0x00 2838 #define RECIP_MASK_DIV 0x01 2839 #define RECIP_MASK_SQRT 0x02 2840 #define RECIP_MASK_VEC_DIV 0x04 2841 #define RECIP_MASK_VEC_SQRT 0x08 2842 #define RECIP_MASK_ALL (RECIP_MASK_DIV | RECIP_MASK_SQRT \ 2843 | RECIP_MASK_VEC_DIV | RECIP_MASK_VEC_SQRT) 2844 #define RECIP_MASK_DEFAULT (RECIP_MASK_VEC_DIV | RECIP_MASK_VEC_SQRT) 2845 2846 #define TARGET_RECIP_DIV ((recip_mask & RECIP_MASK_DIV) != 0) 2847 #define TARGET_RECIP_SQRT ((recip_mask & RECIP_MASK_SQRT) != 0) 2848 #define TARGET_RECIP_VEC_DIV ((recip_mask & RECIP_MASK_VEC_DIV) != 0) 2849 #define TARGET_RECIP_VEC_SQRT ((recip_mask & RECIP_MASK_VEC_SQRT) != 0) 2850 2851 /* Use 128-bit AVX instructions in the auto-vectorizer. */ 2852 #define TARGET_PREFER_AVX128 (prefer_vector_width_type == PVW_AVX128) 2853 /* Use 256-bit AVX instructions in the auto-vectorizer. */ 2854 #define TARGET_PREFER_AVX256 (TARGET_PREFER_AVX128 \ 2855 || prefer_vector_width_type == PVW_AVX256) 2856 2857 #define TARGET_INDIRECT_BRANCH_REGISTER \ 2858 (ix86_indirect_branch_register \ 2859 || cfun->machine->indirect_branch_type != indirect_branch_keep) 2860 2861 #define IX86_HLE_ACQUIRE (1 << 16) 2862 #define IX86_HLE_RELEASE (1 << 17) 2863 2864 /* For switching between functions with different target attributes. */ 2865 #define SWITCHABLE_TARGET 1 2866 2867 #define TARGET_SUPPORTS_WIDE_INT 1 2868 2869 #if !defined(GENERATOR_FILE) && !defined(IN_LIBGCC2) 2870 extern enum attr_cpu ix86_schedule; 2871 2872 #define NUM_X86_64_MS_CLOBBERED_REGS 12 2873 #endif 2874 2875 /* __builtin_eh_return can't handle stack realignment, so disable MMX/SSE 2876 in 32-bit libgcc functions that call it. */ 2877 #ifndef __x86_64__ 2878 #define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((target ("no-mmx,no-sse"))) 2879 #endif 2880 2881 /* 2882 Local variables: 2883 version-control: t 2884 End: 2885 */ 2886