Kael Andrew Franco via Gcc <[email protected]> writes:

>  While working on PR126085, i keep running into this problem:
>
> ‘gimple_match_range_of_expr’ was not declared in this scope.
> This is giving me headache, what is the problem since I can't figure it out?
>
> git diff:
>
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 7da15cc4cdc..2caf9139a39 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -3804,10 +3804,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>         (if (rescode == rcmp)
>          (rcmp @0 @1)))))))))
>
> -/* (type)([0,1]@a != 0) -> (type)a
> -   (type)([0,1]@a == 1) -> (type)a
> -   (type)([0,1]@a == 0) -> a ^ 1
> -   (type)([0,1]@a != 1) -> a ^ 1.  */
> +/* (type)([CST,CST + 1]@a != CST) -> (type)(a - CST)
> +   (type)([CST - 1,CST]@a == CST) -> (type)(a - (CST - 1))
> +   (type)([CST,CST + 1]@a == CST) -> (a - CST) ^ 1
> +   (type)([CST - 1,CST]@a != CST) -> (a - (CST - 1)) ^ 1.  */
>  (for eqne (eq ne)
>   (simplify
>    (convert (eqne zero_one_valued_p@0 INTEGER_CST@1))
> @@ -3819,6 +3819,23 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>         there is no type change. */
>      (if (types_match (type, TREE_TYPE (@0)))
>       (bit_xor @0 { build_one_cst (type); } ))))))
> +#ifdef GIMPLE

You want #if GIMPLE instead.

See genmatch:

  cpp_define (r, gimple ? "GIMPLE=1" : "GENERIC=1");
  cpp_define (r, gimple ? "GENERIC=0" : "GIMPLE=0");

Yes, there's already one oher #ifdef GIMPLE in there but it's wrong too
and should be fixed.

> +(for eqne (eq ne)
> + (simplify
> +  (convert (eqne @0 INTEGER_CST@1))
> +  (with {
> +    int_range_max vr0;
> +    int cond = 0;
> +    if (gimple_match_range_of_expr (vr0, @0))
> +      cond = 1;
> +  }
> +  (if (cond == 2)
> +    @0
> +  )
> +  )
> +)
> +)
> +#endif
>
>  /* ((a ^ b) & c) cmp d || a != b --> (0 cmp d || a != b). */
>  (for cmp (simple_comparison)

sam

Attachment: signature.asc
Description: PGP signature

Reply via email to