https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87545
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEW Assignee|rguenth at gcc dot gnu.org |unassigned at gcc dot gnu.org --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- note: === vect_compute_single_scalar_iteration_cost === 0x341e830 v1[i_11] 1 times scalar_load costs 13 in body 0x341e830 v2[i_11] 1 times scalar_load costs 13 in body 0x341e830 MAX_EXPR <_1, _2> 1 times scalar_stmt costs 6 in body 0x341e830 _3 1 times scalar_store costs 20 in body 0x3409090 v1[i_11] 1 times vector_load costs 20 in body 0x3409090 v2[i_11] 1 times vector_load costs 20 in body 0x3409090 MAX_EXPR <_1, _2> 1 times vector_stmt costs 54 in body 0x3409090 _3 1 times unaligned_store costs 20 in body ix86_add_stmt_cost costs MAX_EXPR as if (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH) stmt_cost = ix86_cost->sse_op; else if (VECTOR_MODE_P (mode)) stmt_cost = ix86_vec_cost (mode, ix86_cost->sse_op, true); else stmt_cost = ix86_cost->add; where COSTS_N_INSNS (1), /* cost of an add instruction */ COSTS_N_INSNS (8), /* cost of cheap SSE instruction. */ I see that most cost models have COSTS_N_INSNS (1) for a cheap SSE instruction which generally is used for most integer vector ops. core_cost has COSTS_N_INSNS (1) for cheap SSE instruction. nocona_cost has 2, so do pentium4_cost, bdver[1234]_cost, amdfam10_cost, k8_cost, athlon_cost. All other costs (besides size_cost) have 1. So why the heck does intel_cost have 8!? I didn't look at other costs besides cost of cheap SSE instruction but I wonder how intel_cost was derived? I expected it to be a blend of other existing intel CPU cost tables, not a completely unrelated outlier? Not my bug but a pre-existing target one I happened to uncover. Suggested "fix" (but the other vector costs appear high compared to other intel costs as well). diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h index 71a5854c09a..c7f3945d72c 100644 --- a/gcc/config/i386/x86-tune-costs.h +++ b/gcc/config/i386/x86-tune-costs.h @@ -2294,7 +2294,7 @@ struct processor_costs intel_cost = { COSTS_N_INSNS (8), /* cost of FCHS instruction. */ COSTS_N_INSNS (40), /* cost of FSQRT instruction. */ - COSTS_N_INSNS (8), /* cost of cheap SSE instruction. */ + COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ COSTS_N_INSNS (8), /* cost of ADDSS/SD SUBSS/SD insns. */ COSTS_N_INSNS (8), /* cost of MULSS instruction. */ COSTS_N_INSNS (8), /* cost of MULSD instruction. */ HJ, can you make Intel people double-check intel_cost and fix it up?