This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR/4706

[Get raw message]
I isolated this a bit more.  Specifically it's related to this
optimization, in combination with loop unrolling:

combine_simplify_rtx (x, op0_mode, last, in_dest):

      /* Try simplify a*(b/c) as (a*b)/c.  */
      if (FLOAT_MODE_P (mode) && flag_unsafe_math_optimizations
	  && GET_CODE (XEXP (x, 0)) == DIV)
	{
	  rtx tem = simplify_binary_operation (MULT, mode,
					       XEXP (XEXP (x, 0), 0),
					       XEXP (x, 1));
	  if (tem)
	    return gen_binary (DIV, mode, tem, XEXP (XEXP (x, 0), 1));
	}
      break;

expand_expr (exp, target, tmode, modifier):

    case RDIV_EXPR:
      /* Emit a/b as a*(1/b).  Later we may manage CSE the reciprocal saving
         expensive divide.  If not, combine will rebuild the original
         computation.  */
      if (flag_unsafe_math_optimizations && optimize && !optimize_size
	  && !real_onep (TREE_OPERAND (exp, 0)))
        return expand_expr (build (MULT_EXPR, type, TREE_OPERAND (exp, 0),
				   build (RDIV_EXPR, type,
					  build_real (type, dconst1),
					  TREE_OPERAND (exp, 1))),
			    target, tmode, unsignedp);
      this_optab = sdiv_optab;
      goto binop;

Tested by changing all flag_unsafe_math_optimizations into
flag_unsafe_math_optimizations_N and finding what broke.

The reg stack pass cores due to it using a reg that is unused:

(from sched2 pass)

(insn:TI 172 176 177 (set (mem/f:DF (plus:SI (reg/f:SI 7 esp)
                (const_int 4 [0x4])) [0 S8 A64])
        (reg:DF 9 st(1))) 95 {*movdf_integer} (insn_list 1014 (insn_list 1129 (insn_list 46 (insn_list:REG_DEP_OUTPUT 59 (insn_list:REG_DEP_OUTPUT 792 (insn_list:REG_DEP_OUTPUT 826 (insn_list:REG_DEP_OUTPUT 860 (insn_list:REG_DEP_ANTI 51 (insn_list:REG_DEP_ANTI 53 (insn_list:REG_DEP_ANTI 56 (insn_list:REG_DEP_ANTI 770 (insn_list:REG_DEP_ANTI 778 (insn_list:REG_DEP_ANTI 790 (insn_list:REG_DEP_ANTI 812 (insn_list:REG_DEP_ANTI 846 (nil))))))))))))))))
    (expr_list:REG_DEAD (reg:DF 9 st(1))
        (nil)))

.
.
(no other uses of st(1))
.
.

(insn:TI 715 230 716 (set (reg:DF 9 st(1))
        (minus:DF (reg:DF 9 st(1))
            (mem:DF (plus:SI (reg/v/f:SI 4 esi [60])
                    (const_int 8 [0x8])) [3 S8 A64]))) 535 {*fop_df_1} (insn_list 10 (insn_list 230 (insn_list 177 (insn_list 1014 (insn_list:REG_DEP_ANTI 172 (nil))))))
    (nil))

Dave.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]