https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106888

--- Comment #3 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
Debugging of ctz3 case

The insns of interest are:

insn_cost 4 for     6: r74:SI=ctz(r73:DI#0)
      REG_DEAD r73:DI
insn_cost 4 for     7: r72:DI=sign_extend(r74:SI)
      REG_DEAD r74:SI

Before the commit in question, combine is able to mush them

allowing combination of insns 6 and 7
original costs 4 + 4 = 8
replacement cost 8
deferring deletion of insn with uid = 6.
modifying insn i3     7: r72:DI=sign_extend(ctz(r76:DI#0))

With the commit in questions, it takes the new code patch introduced

combine_simplify_rtx

   simplify_context::simplify_unary_operation_1
      case SIGN_EXTEND
+         if (val_signbit_known_clear_p
+             simplify_gen_unary (ZERO_EXTEND, mode, op, GET_MODE (op));

   return expand_compound_operation (x);  // x is ZERO_EXTEND now

Reply via email to