public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Optab: add isnormal_optab for __builtin_isnormal
@ 2024-04-12  8:09 HAO CHEN GUI
  2024-05-16 12:15 ` Richard Biener
  2024-05-18 19:41 ` Andrew Pinski
  0 siblings, 2 replies; 3+ messages in thread
From: HAO CHEN GUI @ 2024-04-12  8:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool, David, Kewen.Lin, Peter Bergner

Hi,
  This patch adds an optab for __builtin_isnormal. The normal check can be
implemented on rs6000 by a single instruction. It needs an optab to be
expanded to the certain sequence of instructions.

  The subsequent patches will implement the expand on rs6000.

  Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no
regressions. Is this OK for next stage-1?

Thanks
Gui Haochen
ChangeLog
optab: Add isnormal_optab for isnormal builtin

gcc/
	* builtins.cc (interclass_mathfn_icode): Set optab to isnormal_optab
	for isnormal builtin.
	* optabs.def (isnormal_optab): New.

patch.diff
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 3174f52ebe8..defb39de95f 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -2462,6 +2462,7 @@ interclass_mathfn_icode (tree arg, tree fndecl)
     case BUILT_IN_ISFINITE:
       builtin_optab = isfinite_optab; break;
     case BUILT_IN_ISNORMAL:
+      builtin_optab = isnormal_optab; break;
     CASE_FLT_FN (BUILT_IN_FINITE):
     case BUILT_IN_FINITED32:
     case BUILT_IN_FINITED64:
diff --git a/gcc/optabs.def b/gcc/optabs.def
index dcd77315c2a..3c401fc0b4c 100644
--- a/gcc/optabs.def
+++ b/gcc/optabs.def
@@ -353,6 +353,7 @@ OPTAB_D (hypot_optab, "hypot$a3")
 OPTAB_D (ilogb_optab, "ilogb$a2")
 OPTAB_D (isinf_optab, "isinf$a2")
 OPTAB_D (isfinite_optab, "isfinite$a2")
+OPTAB_D (isnormal_optab, "isnormal$a2")
 OPTAB_D (issignaling_optab, "issignaling$a2")
 OPTAB_D (ldexp_optab, "ldexp$a3")
 OPTAB_D (log10_optab, "log10$a2")

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Optab: add isnormal_optab for __builtin_isnormal
  2024-04-12  8:09 [PATCH] Optab: add isnormal_optab for __builtin_isnormal HAO CHEN GUI
@ 2024-05-16 12:15 ` Richard Biener
  2024-05-18 19:41 ` Andrew Pinski
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Biener @ 2024-05-16 12:15 UTC (permalink / raw)
  To: HAO CHEN GUI
  Cc: gcc-patches, Segher Boessenkool, David, Kewen.Lin, Peter Bergner

On Fri, Apr 12, 2024 at 10:10 AM HAO CHEN GUI <guihaoc@linux.ibm.com> wrote:
>
> Hi,
>   This patch adds an optab for __builtin_isnormal. The normal check can be
> implemented on rs6000 by a single instruction. It needs an optab to be
> expanded to the certain sequence of instructions.
>
>   The subsequent patches will implement the expand on rs6000.
>
>   Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no
> regressions. Is this OK for next stage-1?

Looks good, if the rs6000 part is approved.

> Thanks
> Gui Haochen
> ChangeLog
> optab: Add isnormal_optab for isnormal builtin
>
> gcc/
>         * builtins.cc (interclass_mathfn_icode): Set optab to isnormal_optab
>         for isnormal builtin.
>         * optabs.def (isnormal_optab): New.
>
> patch.diff
> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
> index 3174f52ebe8..defb39de95f 100644
> --- a/gcc/builtins.cc
> +++ b/gcc/builtins.cc
> @@ -2462,6 +2462,7 @@ interclass_mathfn_icode (tree arg, tree fndecl)
>      case BUILT_IN_ISFINITE:
>        builtin_optab = isfinite_optab; break;
>      case BUILT_IN_ISNORMAL:
> +      builtin_optab = isnormal_optab; break;
>      CASE_FLT_FN (BUILT_IN_FINITE):
>      case BUILT_IN_FINITED32:
>      case BUILT_IN_FINITED64:
> diff --git a/gcc/optabs.def b/gcc/optabs.def
> index dcd77315c2a..3c401fc0b4c 100644
> --- a/gcc/optabs.def
> +++ b/gcc/optabs.def
> @@ -353,6 +353,7 @@ OPTAB_D (hypot_optab, "hypot$a3")
>  OPTAB_D (ilogb_optab, "ilogb$a2")
>  OPTAB_D (isinf_optab, "isinf$a2")
>  OPTAB_D (isfinite_optab, "isfinite$a2")
> +OPTAB_D (isnormal_optab, "isnormal$a2")
>  OPTAB_D (issignaling_optab, "issignaling$a2")
>  OPTAB_D (ldexp_optab, "ldexp$a3")
>  OPTAB_D (log10_optab, "log10$a2")

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Optab: add isnormal_optab for __builtin_isnormal
  2024-04-12  8:09 [PATCH] Optab: add isnormal_optab for __builtin_isnormal HAO CHEN GUI
  2024-05-16 12:15 ` Richard Biener
@ 2024-05-18 19:41 ` Andrew Pinski
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Pinski @ 2024-05-18 19:41 UTC (permalink / raw)
  To: HAO CHEN GUI
  Cc: gcc-patches, Segher Boessenkool, David, Kewen.Lin, Peter Bergner

On Fri, Apr 12, 2024 at 1:10 AM HAO CHEN GUI <guihaoc@linux.ibm.com> wrote:
>
> Hi,
>   This patch adds an optab for __builtin_isnormal. The normal check can be
> implemented on rs6000 by a single instruction. It needs an optab to be
> expanded to the certain sequence of instructions.
>
>   The subsequent patches will implement the expand on rs6000.
>
>   Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no
> regressions. Is this OK for next stage-1?

This is missing adding documentation for the new optab.
It should be documented in md.texi under `Standard Pattern Names For
Generation` section.

Thanks,
Andrew

>
> Thanks
> Gui Haochen
> ChangeLog
> optab: Add isnormal_optab for isnormal builtin
>
> gcc/
>         * builtins.cc (interclass_mathfn_icode): Set optab to isnormal_optab
>         for isnormal builtin.
>         * optabs.def (isnormal_optab): New.
>
> patch.diff
> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
> index 3174f52ebe8..defb39de95f 100644
> --- a/gcc/builtins.cc
> +++ b/gcc/builtins.cc
> @@ -2462,6 +2462,7 @@ interclass_mathfn_icode (tree arg, tree fndecl)
>      case BUILT_IN_ISFINITE:
>        builtin_optab = isfinite_optab; break;
>      case BUILT_IN_ISNORMAL:
> +      builtin_optab = isnormal_optab; break;
>      CASE_FLT_FN (BUILT_IN_FINITE):
>      case BUILT_IN_FINITED32:
>      case BUILT_IN_FINITED64:
> diff --git a/gcc/optabs.def b/gcc/optabs.def
> index dcd77315c2a..3c401fc0b4c 100644
> --- a/gcc/optabs.def
> +++ b/gcc/optabs.def
> @@ -353,6 +353,7 @@ OPTAB_D (hypot_optab, "hypot$a3")
>  OPTAB_D (ilogb_optab, "ilogb$a2")
>  OPTAB_D (isinf_optab, "isinf$a2")
>  OPTAB_D (isfinite_optab, "isfinite$a2")
> +OPTAB_D (isnormal_optab, "isnormal$a2")
>  OPTAB_D (issignaling_optab, "issignaling$a2")
>  OPTAB_D (ldexp_optab, "ldexp$a3")
>  OPTAB_D (log10_optab, "log10$a2")

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-18 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12  8:09 [PATCH] Optab: add isnormal_optab for __builtin_isnormal HAO CHEN GUI
2024-05-16 12:15 ` Richard Biener
2024-05-18 19:41 ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).