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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Another issue with the commit:

+;; With -Oz, transform mov $imm,reg to the shorter push $imm; pop reg.
+(define_peephole2
+  [(set (match_operand:SWI248 0 "general_reg_operand")
+  (match_operand:SWI248 1 "const_int_operand"))]
+  "optimize_insn_for_size_p () && optimize_size > 1
+   && operands[1] != const0_rtx

&& operands[1] != constm1_rtx

is missing.  We shouldn't transform "mov $-1,reg" to "push $-1; pop reg".
We should transform "mov $-1,reg" to "or $-1,reg" instead.

+   && IN_RANGE (INTVAL (operands[1]), -128, 127)
+   && !ix86_red_zone_used"
+  [(set (match_dup 2) (match_dup 1))
+   (set (match_dup 0) (match_dup 3))]
+{
+  if (GET_MODE (operands[0]) != word_mode)
+    operands[0] = gen_rtx_REG (word_mode, REGNO (operands[0]));
+
+  operands[2] = gen_rtx_MEM (word_mode,
+             gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx));
+  operands[3] = gen_rtx_MEM (word_mode,
+             gen_rtx_POST_INC (Pmode, stack_pointer_rtx));
+})

Reply via email to