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: [4.5] Doloop improvement patches, 3/7


Bernd Schmidt <bernds_cb1@t-online.de> writes:

> 	* simplify-rtx.c (simplify_relational_operation_1): Convert unsigned
> 	comparisons of the form (X + CONST) < CONST to X >= -CONST.


> +  /* (LTU/GEU (PLUS a C) C), where C is constant, can be simplified to
> +     (GEU/LTU a -C).  */
> +  if ((code == LTU || code == GEU)
> +      && GET_CODE (op0) == PLUS
> +      && GET_CODE (XEXP (op0, 1)) == CONST_INT
> +      && (rtx_equal_p (op1, XEXP (op0, 0))
> +	  || rtx_equal_p (op1, XEXP (op0, 1))))

This doesn't test for the expression in the comment.  This tests for
either (LTU/GEU (PLUS a C) C) or for (LTU/GEU (plus a C) a).

> +    {
> +      HOST_WIDE_INT new_cmp
> +	= trunc_int_for_mode (-INTVAL (XEXP (op0, 1)), cmp_mode);

I think that will yield an incorrect result if cmp_mode is wider than
HOST_BITS_PER_WIDE_INT.  You can use simplify_gen_unary as Zdenek
suggests.

This is OK for gcc 4.5 if you fix the comment and use
simplify_gen_unary.

Thanks.

Ian


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