On Thu, 5 Oct 2023, Tamar Christina wrote:

> Hi All,
> 
> This adds a masked variant of copysign.  Nothing very exciting just the
> general machinery to define and use a new masked IFN.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> 
> Note: This patch is part of a testseries and tests for it are added in the
> AArch64 patch that adds supports for the optab.
> 
> Ok for master?

OK I guess.

Richard.

> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
>       PR tree-optimization/109154
>       * internal-fn.def (COPYSIGN): New.
>       * match.pd (UNCOND_BINARY, COND_BINARY): Map IFN_COPYSIGN to
>       IFN_COND_COPYSIGN.
>       * optabs.def (cond_copysign_optab, cond_len_copysign_optab): New.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def
> index 
> a2023ab9c3d01c28f51eb8a59e08c59e4c39aa7f..d9e6bdef6977f7ab9c0290bf4f4568aad0380456
>  100644
> --- a/gcc/internal-fn.def
> +++ b/gcc/internal-fn.def
> @@ -268,6 +268,7 @@ DEF_INTERNAL_SIGNED_COND_FN (MOD, ECF_CONST, first, smod, 
> umod, binary)
>  DEF_INTERNAL_COND_FN (RDIV, ECF_CONST, sdiv, binary)
>  DEF_INTERNAL_SIGNED_COND_FN (MIN, ECF_CONST, first, smin, umin, binary)
>  DEF_INTERNAL_SIGNED_COND_FN (MAX, ECF_CONST, first, smax, umax, binary)
> +DEF_INTERNAL_COND_FN (COPYSIGN, ECF_CONST, copysign, binary)
>  DEF_INTERNAL_COND_FN (FMIN, ECF_CONST, fmin, binary)
>  DEF_INTERNAL_COND_FN (FMAX, ECF_CONST, fmax, binary)
>  DEF_INTERNAL_COND_FN (AND, ECF_CONST | ECF_NOTHROW, and, binary)
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 
> e12b508ce8ced64e62d94d6df82734cb630b8c1c..1e8d406e6c196b10b48d3c30dc29bffc1bc27bf4
>  100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -93,14 +93,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>    plus minus
>    mult trunc_div trunc_mod rdiv
>    min max
> -  IFN_FMIN IFN_FMAX
> +  IFN_FMIN IFN_FMAX IFN_COPYSIGN
>    bit_and bit_ior bit_xor
>    lshift rshift)
>  (define_operator_list COND_BINARY
>    IFN_COND_ADD IFN_COND_SUB
>    IFN_COND_MUL IFN_COND_DIV IFN_COND_MOD IFN_COND_RDIV
>    IFN_COND_MIN IFN_COND_MAX
> -  IFN_COND_FMIN IFN_COND_FMAX
> +  IFN_COND_FMIN IFN_COND_FMAX IFN_COND_COPYSIGN
>    IFN_COND_AND IFN_COND_IOR IFN_COND_XOR
>    IFN_COND_SHL IFN_COND_SHR)
>  
> diff --git a/gcc/optabs.def b/gcc/optabs.def
> index 
> 2ccbe4197b7b700dcdb70e2c67cfcf12d7e381b1..93d4c63700cbaa9fea1177b3d6c7a3e12f609361
>  100644
> --- a/gcc/optabs.def
> +++ b/gcc/optabs.def
> @@ -256,6 +256,7 @@ OPTAB_D (cond_fms_optab, "cond_fms$a")
>  OPTAB_D (cond_fnma_optab, "cond_fnma$a")
>  OPTAB_D (cond_fnms_optab, "cond_fnms$a")
>  OPTAB_D (cond_neg_optab, "cond_neg$a")
> +OPTAB_D (cond_copysign_optab, "cond_copysign$F$a")
>  OPTAB_D (cond_one_cmpl_optab, "cond_one_cmpl$a")
>  OPTAB_D (cond_len_add_optab, "cond_len_add$a")
>  OPTAB_D (cond_len_sub_optab, "cond_len_sub$a")
> @@ -281,6 +282,7 @@ OPTAB_D (cond_len_fms_optab, "cond_len_fms$a")
>  OPTAB_D (cond_len_fnma_optab, "cond_len_fnma$a")
>  OPTAB_D (cond_len_fnms_optab, "cond_len_fnms$a")
>  OPTAB_D (cond_len_neg_optab, "cond_len_neg$a")
> +OPTAB_D (cond_len_copysign_optab, "cond_len_copysign$F$a")
>  OPTAB_D (cond_len_one_cmpl_optab, "cond_len_one_cmpl$a")
>  OPTAB_D (cmov_optab, "cmov$a6")
>  OPTAB_D (cstore_optab, "cstore$a4")
> 
> 
> 
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to