https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82767
--- Comment #3 from Sebastian Peryt <sebastian.peryt at intel dot com> --- As per Uros's suggestion (https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00329.html ) I checked -mtune=generic idea and this works without additional changes either in testcase or in cost model. >From what I gathered the cause of this test failing is below change in core cost model: /gcc/config/i386/x86-tune-costs.h @@ -2253,7 +2253,7 @@ struct processor_costs core_cost = { COSTS_N_INSNS (4), /* DI */ COSTS_N_INSNS (4)}, /* other */ 0, /* cost of multiply per each bit set */ + {COSTS_N_INSNS (8), /* cost of a divide/mod for QI */ - {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */ COSTS_N_INSNS (8), /* HI */ /* 8-11 */ COSTS_N_INSNS (11), /* SI */ Because most of Intel's CPUs are using core_cost model (including haswell) this testcase is failing without additional tuning to generic cost model, which is still using old cost values.