On 11/09/11 16:32, Jakub Jelinek wrote:
> --- gcc/combine.c.jj  2011-11-08 23:35:12.000000000 +0100
> +++ gcc/combine.c     2011-11-09 10:06:27.207333364 +0100
> @@ -11397,9 +11397,12 @@ simplify_comparison (enum rtx_code code,
>            later on, and then we wouldn't know whether to sign- or
>            zero-extend.  */
>         mode = GET_MODE (XEXP (op0, 0));
> -       if (mode != VOIDmode && GET_MODE_CLASS (mode) == MODE_INT
> +       if (GET_MODE_CLASS (mode) == MODE_INT
>             && ! unsigned_comparison_p
> -           && val_signbit_known_clear_p (mode, const_op)
> +           && HWI_COMPUTABLE_MODE_P (mode)
> +           && ((unsigned HOST_WIDE_INT) const_op
> +               < (((unsigned HOST_WIDE_INT) 1
> +                   << (GET_MODE_PRECISION (mode) - 1))))
>             && have_insn_for (COMPARE, mode))
>           {
>             op0 = XEXP (op0, 0);

I guess this is OK, although it would still be nicer to use something
with a descriptive name rather than bit-fiddling, to avoid this kind of
confusion. Maybe check whether trunc_int_for_mode doesn't change the
constant? Or we could make val_signbit_known_clear_p do more extensive
checking.


Bernd

Reply via email to