This is the mail archive of the gcc-patches@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]

Re: Combiner fixes


On 08/02/2010 10:37 PM, Bernd Schmidt wrote:
+      if (GET_CODE (op0) == NEG && CONST_INT_P (trueop1))
+	return simplify_gen_binary (MULT, mode, XEXP (op0, 0),
+				    simplify_gen_unary (NEG, mode, op1, mode));

Why not go one step further and try it on all operands:


  if (GET_CODE (op0) == NEG)
    {
      rtx temp = simplify_unary (NEG, mode, op1, mode);
      if (temp)
        return simplify_gen_binary (MULT, mode, XEXP (op0, 0), temp);
    }
  if (GET_CODE (op1) == NEG)
    {
      rtx temp = simplify_unary (NEG, mode, op0, mode);
      if (temp)
        return simplify_gen_binary (MULT, mode, temp, XEXP (op1, 0));
    }

Paolo


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