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: [PATCH][PING] 2 tiny but unreviewed patches


Andreas Krebbel wrote:
Hello,

could please someone have a look at these:

Simplify inside CONST expressions:
http://gcc.gnu.org/ml/gcc-patches/2005-09/msg00320.html

hmm, I don't like the patch anymore. For example, I believe it cannot simplify (plus (const (plus (something) 4)) (const_int 4)).


My impression is that this is not enough:

+		if (GET_CODE (lhs) == CONST && GET_CODE (rhs) == CONST)
+		  {
+		    gcc_assert (GET_MODE (lhs) == GET_MODE (rhs));
+		    if (!CONSTANT_P (tem))
+		      tem = gen_rtx_CONST (GET_MODE (lhs), tem);
+		  }

I'd rather do something like

  if (CONSTANT_P (lhs) && CONSTANT_P (rhs) && !CONSTANT_P (tem))
    {
      gcc_assert (GET_MODE (tem) != VOIDmode);
      gcc_assert (GET_CODE (lhs) == CONST || GET_CODE (rhs) == CONST);
      tem = gen_rtx_CONST (GET_MODE (tem), tem);
    }

assuming it works... ;-)

Paolo


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