On Thu, Dec 12, 2024 at 9:45 AM <pan2...@intel.com> wrote:
>
> From: Pan Li <pan2...@intel.com>
>
> Given the SAT_* patterns are grouped for each alu and signed or not,
> add leading comments to indicate the beginning of the pattern.

OK.

> gcc/ChangeLog:
>
>         * match.pd: Update comments for sat_* pattern.
>
> Signed-off-by: Pan Li <pan2...@intel.com>
> ---
>  gcc/match.pd | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 18098920007..aa006b9e282 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -3099,6 +3099,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>         || POINTER_TYPE_P (itype))
>        && wi::eq_p (wi::to_wide (int_cst), wi::max_value (itype))))))
>
> +/* Saturation add for unsigned integer.  */
>  (if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (type))
>   (match (usadd_overflow_mask @0 @1)
>    /* SAT_U_ADD = (X + Y) | -(X > (X + Y)).
> @@ -3173,6 +3174,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>          integer_minus_onep (realpart @2))
>    (if (types_match (type, @0) && int_fits_type_p (@1, type)))))
>
> +/* Saturation sub for unsigned integer.  */
>  (if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (type))
>   (match (unsigned_integer_sat_sub @0 @1)
>    /* SAT_U_SUB = X > Y ? X - Y : 0  */
> @@ -3262,6 +3264,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>      }
>      (if (wi::eq_p (sum, wi::uhwi (0, precision))))))))
>
> +/* Saturation truncate for unsigned integer.  */
>  (if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (type))
>   (match (unsigned_integer_sat_trunc @0)
>    /* SAT_U_TRUNC = (NT)x | (NT)(-(X > (WT)(NT)(-1)))  */
> @@ -3321,6 +3324,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>                             (nop_convert? (convert (lt @0 integer_zerop)))))
>              max_value)))
>
> +/* Saturation add for signed integer.  */
>  (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type))
>   (match (signed_integer_sat_add @0 @1)
>    /* T SUM = (T)((UT)X + (UT)Y)
> @@ -3375,6 +3379,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>          @2)
>    (if (wi::bit_and (wi::to_wide (@1), wi::to_wide (@3)) == 0))))
>
> +/* Saturation sub for signed integer.  */
>  (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type))
>   (match (signed_integer_sat_sub @0 @1)
>    /* T Z = (T)((UT)X - (UT)Y);
> @@ -3411,6 +3416,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>          (realpart @2))
>    (if (types_match (type, @0, @1)))))
>
> +/* Saturation truncate for signed integer.  */
>  (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type))
>   (match (signed_integer_sat_trunc @0)
>    /* SAT_S_TRUNC(X) = (unsigned)X + NT_MAX + 1  > Unsigned_MAX ? (NT)X  */
> --
> 2.43.0
>

Reply via email to