📄 i386.c
字号:
COSTS_N_INSNS (3), /* SI */ COSTS_N_INSNS (4), /* DI */ COSTS_N_INSNS (2)}, /* other */ 0, /* cost of multiply per each bit set */ {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */ COSTS_N_INSNS (26), /* HI */ COSTS_N_INSNS (42), /* SI */ COSTS_N_INSNS (74), /* DI */ COSTS_N_INSNS (74)}, /* other */ COSTS_N_INSNS (1), /* cost of movsx */ COSTS_N_INSNS (1), /* cost of movzx */ 8, /* "large" insn */ 17, /* MOVE_RATIO */ 4, /* cost for loading QImode using movzbl */ {4, 4, 4}, /* cost of loading integer registers in QImode, HImode and SImode. Relative to reg-reg move (2). */ {4, 4, 4}, /* cost of storing integer registers */ 4, /* cost of reg,reg fld/fst */ {12, 12, 12}, /* cost of loading fp registers in SFmode, DFmode and XFmode */ {6, 6, 8}, /* cost of loading integer registers */ 2, /* cost of moving MMX register */ {8, 8}, /* cost of loading MMX registers in SImode and DImode */ {8, 8}, /* cost of storing MMX registers in SImode and DImode */ 2, /* cost of moving SSE register */ {8, 8, 8}, /* cost of loading SSE registers in SImode, DImode and TImode */ {8, 8, 8}, /* cost of storing SSE registers in SImode, DImode and TImode */ 5, /* MMX or SSE register to integer */ 64, /* size of prefetch block */ 6, /* number of parallel prefetches */ /* Benchmarks shows large regressions on K8 sixtrack benchmark when this value is increased to perhaps more appropriate value of 5. */ 3, /* Branch cost */ COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */ COSTS_N_INSNS (8), /* cost of FMUL instruction. */ COSTS_N_INSNS (20), /* cost of FDIV instruction. */ COSTS_N_INSNS (8), /* cost of FABS instruction. */ COSTS_N_INSNS (8), /* cost of FCHS instruction. */ COSTS_N_INSNS (40), /* cost of FSQRT instruction. */};/* Generic32 should produce code tuned for Athlon, PPro, Pentium4, Nocona and K8. */static conststruct processor_costs generic32_cost = { COSTS_N_INSNS (1), /* cost of an add instruction */ COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */ COSTS_N_INSNS (1), /* variable shift costs */ COSTS_N_INSNS (1), /* constant shift costs */ {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ COSTS_N_INSNS (4), /* HI */ COSTS_N_INSNS (3), /* SI */ COSTS_N_INSNS (4), /* DI */ COSTS_N_INSNS (2)}, /* other */ 0, /* cost of multiply per each bit set */ {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */ COSTS_N_INSNS (26), /* HI */ COSTS_N_INSNS (42), /* SI */ COSTS_N_INSNS (74), /* DI */ COSTS_N_INSNS (74)}, /* other */ COSTS_N_INSNS (1), /* cost of movsx */ COSTS_N_INSNS (1), /* cost of movzx */ 8, /* "large" insn */ 17, /* MOVE_RATIO */ 4, /* cost for loading QImode using movzbl */ {4, 4, 4}, /* cost of loading integer registers in QImode, HImode and SImode. Relative to reg-reg move (2). */ {4, 4, 4}, /* cost of storing integer registers */ 4, /* cost of reg,reg fld/fst */ {12, 12, 12}, /* cost of loading fp registers in SFmode, DFmode and XFmode */ {6, 6, 8}, /* cost of loading integer registers */ 2, /* cost of moving MMX register */ {8, 8}, /* cost of loading MMX registers in SImode and DImode */ {8, 8}, /* cost of storing MMX registers in SImode and DImode */ 2, /* cost of moving SSE register */ {8, 8, 8}, /* cost of loading SSE registers in SImode, DImode and TImode */ {8, 8, 8}, /* cost of storing SSE registers in SImode, DImode and TImode */ 5, /* MMX or SSE register to integer */ 64, /* size of prefetch block */ 6, /* number of parallel prefetches */ 3, /* Branch cost */ COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */ COSTS_N_INSNS (8), /* cost of FMUL instruction. */ COSTS_N_INSNS (20), /* cost of FDIV instruction. */ COSTS_N_INSNS (8), /* cost of FABS instruction. */ COSTS_N_INSNS (8), /* cost of FCHS instruction. */ COSTS_N_INSNS (40), /* cost of FSQRT instruction. */};/* APPLE LOCAL end mainline 2006-04-19 4434601 */const struct processor_costs *ix86_cost = &pentium_cost;/* APPLE LOCAL begin Altivec *//* vector types */static GTY(()) tree unsigned_V16QI_type_node;static GTY(()) tree unsigned_V4SI_type_node;static GTY(()) tree unsigned_V8QI_type_node;static GTY(()) tree unsigned_V8HI_type_node;static GTY(()) tree unsigned_V4HI_type_node;static GTY(()) tree unsigned_V2HI_type_node;static GTY(()) tree unsigned_V2SI_type_node;static GTY(()) tree unsigned_V2DI_type_node;static GTY(()) tree unsigned_V1DI_type_node;static GTY(()) tree V16QI_type_node;static GTY(()) tree V4SF_type_node;static GTY(()) tree V4SI_type_node;static GTY(()) tree V8QI_type_node;static GTY(()) tree V8HI_type_node;static GTY(()) tree V4HI_type_node;static GTY(()) tree V2HI_type_node;static GTY(()) tree V2SI_type_node;static GTY(()) tree V2SF_type_node;static GTY(()) tree V2DI_type_node;static GTY(()) tree V2DF_type_node;static GTY(()) tree V16SF_type_node;static GTY(()) tree V1DI_type_node;static GTY(()) tree V4DF_type_node;/* APPLE LOCAL end Altivec *//* Processor feature/optimization bitmasks. */#define m_386 (1<<PROCESSOR_I386)#define m_486 (1<<PROCESSOR_I486)#define m_PENT (1<<PROCESSOR_PENTIUM)#define m_PPRO (1<<PROCESSOR_PENTIUMPRO)#define m_K6 (1<<PROCESSOR_K6)#define m_ATHLON (1<<PROCESSOR_ATHLON)#define m_PENT4 (1<<PROCESSOR_PENTIUM4)#define m_K8 (1<<PROCESSOR_K8)#define m_ATHLON_K8 (m_K8 | m_ATHLON)#define m_NOCONA (1<<PROCESSOR_NOCONA)/* APPLE LOCAL begin mainline 2006-04-19 4434601 */#define m_GENERIC32 (1<<PROCESSOR_GENERIC32)#define m_GENERIC64 (1<<PROCESSOR_GENERIC64)#define m_GENERIC (m_GENERIC32 | m_GENERIC64)/* Generic instruction choice should be common subset of supported CPUs (PPro/PENT4/NOCONA/Athlon/K8). *//* Leave is not affecting Nocona SPEC2000 results negatively, so enabling for Generic seems like good code size tradeoff. */const int x86_use_leave = m_386 | m_K6 | m_ATHLON_K8 | m_GENERIC;const int x86_push_memory = m_386 | m_K6 | m_ATHLON_K8 | m_PENT4 | m_NOCONA | m_GENERIC;const int x86_zero_extend_with_and = m_486 | m_PENT;const int x86_movx = m_ATHLON_K8 | m_PPRO | m_PENT4 | m_NOCONA | m_GENERIC /* m_386 | m_K6 */;const int x86_double_with_add = ~m_386;const int x86_use_bit_test = m_386;const int x86_unroll_strlen = m_486 | m_PENT | m_PPRO | m_ATHLON_K8 | m_K6 | m_GENERIC;const int x86_cmove = m_PPRO | m_ATHLON_K8 | m_PENT4 | m_NOCONA;/* APPLE LOCAL end mainline 2006-04-19 4434601 *//* APPLE LOCAL mainline 2005-03-16 4054919 */const int x86_fisttp = m_NOCONA;const int x86_3dnow_a = m_ATHLON_K8;/* APPLE LOCAL mainline */const int x86_deep_branch = m_PPRO | m_K6 | m_ATHLON_K8 | m_PENT4 | m_NOCONA | m_GENERIC;/* Branch hints were put in P4 based on simulation result. But after P4 was made, no performance benefit was observed with branch hints. It also increases the code size. As the result, icc never generates branch hints. *//* APPLE LOCAL begin mainline 2006-04-19 4434601 */const int x86_branch_hints = 0;const int x86_use_sahf = m_PPRO | m_K6 | m_PENT4 | m_NOCONA; /*m_GENERIC | m_ATHLON_K8 ? *//* We probably ought to watch for partial register stalls on Generic32 compilation setting as well. However in current implementation the partial register stalls are not eliminated very well - they can be introduced via subregs synthetized by combine and can happen in caller/callee saving sequences. Because this option pays back little on PPro based chips and is in conflict with partial reg. dependencies used by Athlon/P4 based chips, it is better to leave it off for generic32 for now. */const int x86_partial_reg_stall = m_PPRO;const int x86_use_loop = m_K6;const int x86_use_fiop = ~(m_PPRO | m_ATHLON_K8 | m_PENT | m_GENERIC);const int x86_use_mov0 = m_K6;const int x86_use_cltd = ~(m_PENT | m_K6 | m_GENERIC);const int x86_read_modify_write = ~m_PENT;const int x86_read_modify = ~(m_PENT | m_PPRO);const int x86_split_long_moves = m_PPRO;const int x86_promote_QImode = m_K6 | m_PENT | m_386 | m_486 | m_ATHLON_K8 | m_GENERIC; /* m_PENT4 ? */const int x86_fast_prefix = ~(m_PENT | m_486 | m_386);const int x86_single_stringop = m_386 | m_PENT4 | m_NOCONA;const int x86_qimode_math = ~(0);const int x86_promote_qi_regs = 0;/* On PPro this flag is meant to avoid partial register stalls. Just like the x86_partial_reg_stall this option might be considered for Generic32 if our scheme for avoiding partial stalls was more effective. */const int x86_himode_math = ~(m_PPRO);const int x86_promote_hi_regs = m_PPRO;const int x86_sub_esp_4 = m_ATHLON_K8 | m_PPRO | m_PENT4 | m_NOCONA | m_GENERIC;const int x86_sub_esp_8 = m_ATHLON_K8 | m_PPRO | m_386 | m_486 | m_PENT4 | m_NOCONA | m_GENERIC;const int x86_add_esp_4 = m_ATHLON_K8 | m_K6 | m_PENT4 | m_NOCONA | m_GENERIC;const int x86_add_esp_8 = m_ATHLON_K8 | m_PPRO | m_K6 | m_386 | m_486 | m_PENT4 | m_NOCONA | m_GENERIC;const int x86_integer_DFmode_moves = ~(m_ATHLON_K8 | m_PENT4 | m_NOCONA | m_PPRO | m_GENERIC);const int x86_partial_reg_dependency = m_ATHLON_K8 | m_PENT4 | m_NOCONA | m_GENERIC;const int x86_memory_mismatch_stall = m_ATHLON_K8 | m_PENT4 | m_NOCONA | m_GENERIC;const int x86_accumulate_outgoing_args = m_ATHLON_K8 | m_PENT4 | m_NOCONA | m_PPRO | m_GENERIC;const int x86_prologue_using_move = m_ATHLON_K8 | m_PPRO | m_GENERIC;const int x86_epilogue_using_move = m_ATHLON_K8 | m_PPRO | m_GENERIC;const int x86_shift1 = ~m_486;const int x86_arch_always_fancy_math_387 = m_PENT | m_PPRO | m_ATHLON_K8 | m_PENT4 | m_NOCONA | m_GENERIC;/* In Generic model we have an confict here in between PPro/Pentium4 based chips that thread 128bit SSE registers as single units versus K8 based chips that divide SSE registers to two 64bit halves. x86_sse_partial_reg_dependency promote all store destinations to be 128bit to allow register renaming on 128bit SSE units, but usually results in one extra microop on 64bit SSE units. Experimental results shows that disabling this option on P4 brings over 20% SPECfp regression, while enabling it on K8 brings roughly 2.4% regression that can be partly masked by careful scheduling of moves. */const int x86_sse_partial_reg_dependency = m_PENT4 | m_NOCONA | m_PPRO | m_GENERIC;/* Set for machines where the type and dependencies are resolved on SSE register parts instead of whole registers, so we may maintain just lower part of scalar values in proper format leaving the upper part undefined. */const int x86_sse_split_regs = m_ATHLON_K8;const int x86_sse_typeless_stores = m_ATHLON_K8;const int x86_sse_load0_by_pxor = m_PPRO | m_PENT4 | m_NOCONA;const int x86_use_ffreep = m_ATHLON_K8;const int x86_rep_movl_optimal = m_386 | m_PENT | m_PPRO | m_K6;const int x86_use_incdec = ~(m_PENT4 | m_NOCONA | m_GENERIC);/* ??? Allowing interunit moves makes it all too easy for the compiler to put integer data in xmm registers. Which results in pretty abysmal code. */const int x86_inter_unit_moves = 0 /* ~(m_ATHLON_K8) */;const int x86_ext_80387_constants = m_K6 | m_ATHLON | m_PENT4 | m_NOCONA | m_PPRO | m_GENERIC32;/* Some CPU cores are not able to predict more than 4 branch instructions in the 16 byte window. */const int x86_four_jump_limit = m_PPRO | m_ATHLON_K8 | m_PENT4 | m_NOCONA | m_GENERIC;const int x86_schedule = m_PPRO | m_ATHLON_K8 | m_K6 | m_PENT | m_GENERIC;const int x86_use_bt = m_ATHLON_K8;const int x86_pad_returns = m_ATHLON_K8 | m_GENERIC;/* APPLE LOCAL end mainline 2006-04-19 4434601 *//* In case the average insn count for single function invocation is lower than this constant, emit fast (but longer) prologue and epilogue code. */#define FAST_PROLOGUE_INSN_COUNT 20/* Names for 8 (low), 8 (high), and 16-bit registers, respectively. */static const char *const qi_reg_name[] = QI_REGISTER_NAMES;static const char *const qi_high_reg_name[] = QI_HIGH_REGISTER_NAMES;static const char *const hi_reg_name[] = HI_REGISTER_NAMES;/* Array of the smallest class containing reg number REGNO, indexed by REGNO. Used by REGNO_REG_CLASS in i386.h. */enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER] ={ /* ax, dx, cx, bx */ AREG, DREG, CREG, BREG, /* si, di, bp, sp */ SIREG, DIREG, NON_Q_REGS, NON_Q_REGS, /* FP registers */ FP_TOP_REG, FP_SECOND_REG, FLOAT_REGS, FLOAT_REGS, FLOAT_REGS, FLOAT_REGS, FLOAT_REGS, FLOAT_REGS, /* arg pointer */ NON_Q_REGS, /* flags, fpsr, dirflag, frame */ NO_REGS, NO_REGS, NO_REGS, NON_Q_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS, MMX_REGS, MMX_REGS, MMX_REGS, MMX_REGS, MMX_REGS, MMX_REGS, MMX_REGS, MMX_REGS, NON_Q_REGS, NON_Q_REGS, NON_Q_REGS, NON_Q_REGS, NON_Q_REGS, NON_Q_REGS, NON_Q_REGS, NON_Q_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS, SSE_REGS,};/* The "default" register map used in 32bit mode. *//* APPLE LOCAL begin mainline 2006-02-17 4356747 stack realign */int const dbx_register_map[FIRST_PSEUDO_REGISTER+1] ={ 0, 2, 1, 3, 6, 7, 4, 5, /* general regs */ 12, 13, 14, 15, 16, 17, 18, 19, /* fp regs */ -1, -1, -1, -1, -1, /* arg, flags, fpsr, dir, frame */ 21, 22, 23, 24, 25, 26, 27, 28, /* SSE */ 29, 30, 31, 32, 33, 34, 35, 36, /* MMX */ -1, -1, -1, -1, -1, -1, -1, -1, /* extended integer registers */ -1, -1, -1, -1, -1, -1, -1, -1, /* extended SSE registers */ 8 /* return column */};/* APPLE LOCAL end mainline 2006-02-17 4356747 stack realign */static int const x86_64_int_parameter_registers[6] ={ 5 /*RDI*/, 4 /*RSI*/, 1 /*RDX*/, 2 /*RCX*/, FIRST_REX_INT_REG /*R8 */, FIRST_REX_INT_REG + 1 /*R9 */};static int const x86_64_int_return_registers[4] ={ 0 /*RAX*/, 1 /*RDI*/, 5 /*RDI*/, 4 /*RSI*/};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -