https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78794
--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> --- Perhaps as simple as: diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1cd1cd8..6899d4f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3424,7 +3424,7 @@ dimode_scalar_chain::compute_convert_gain () } else if (GET_CODE (src) == NEG || GET_CODE (src) == NOT) - gain += ix86_cost->add - COSTS_N_INSNS (1); + gain += ix86_cost->add - COSTS_N_INSNS (2); else if (GET_CODE (src) == COMPARE) { /* Assume comparison cost is the same. */