On 02/21/2017 12:25 PM, Segher Boessenkool wrote:
On Tue, Feb 21, 2017 at 12:08:34PM -0800, Michael Eager wrote:
-  /* Shift by zero -- copy regs if necessary.  */
+  /* Shift by zero -- copy regs.  */
    if ((GET_CODE (operands[2]) == CONST_INT) && (INTVAL (operands[2]) ==
    0))
      {
-      if (REGNO (operands[0]) != REGNO (operands[1]))
-       emit_insn (gen_movsi (operands[0], operands[1]));
+      emit_insn (gen_movsi (operands[0], operands[1]));
        return 1;
      }

Why generate an unnecessary NOP?

Why not?  It will be optimised away anyway, and the code to get at the
subregs is hairy...  But could optimise away the useless move here
already if both ops are a reg and both are the same, if you prefer that?
Or rtx_equal_p (operands[0], operands[1])?

It's optimized away only if optimization is on.

The existing code checks and does not generate the unneeded move.
Whatever you change to clean up code should maintain the same behavior.

if ((operands[2] == const0_rtx) && !rtx_equal_p (operands[0], operands[1]))
  {
    emit_insn (gen_movsi (operands[0], operands[1]));
  }


--
Michael Eager    ea...@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

Reply via email to