public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCHv5] Optab: add isfinite_optab for __builtin_isfinite
@ 2024-05-29  6:36 HAO CHEN GUI
  2024-06-03  2:37 ` Ping " HAO CHEN GUI
  0 siblings, 1 reply; 4+ messages in thread
From: HAO CHEN GUI @ 2024-05-29  6:36 UTC (permalink / raw)
  To: gcc-patches
  Cc: Segher Boessenkool, David, Kewen.Lin, Peter Bergner,
	Andrew Pinski, Richard Biener, Richard Sandiford

Hi,
  This patch adds an optab for __builtin_isfinite. The finite 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.

  Compared to previous version, the main change is to specify return
value of the optab should be either 0 or 1.
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652864.html

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

Thanks
Gui Haochen

ChangeLog
optab: Add isfinite_optab for isfinite builtin

gcc/
	* builtins.cc (interclass_mathfn_icode): Set optab to isfinite_optab
	for isfinite builtin.
	* optabs.def (isfinite_optab): New.
	* doc/md.texi (isfinite): Document.


patch.diff
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index f8d94c4b435..53e9d210541 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -2459,8 +2459,10 @@ interclass_mathfn_icode (tree arg, tree fndecl)
       errno_set = true; builtin_optab = ilogb_optab; break;
     CASE_FLT_FN (BUILT_IN_ISINF):
       builtin_optab = isinf_optab; break;
-    case BUILT_IN_ISNORMAL:
     case BUILT_IN_ISFINITE:
+      builtin_optab = isfinite_optab;
+      break;
+    case BUILT_IN_ISNORMAL:
     CASE_FLT_FN (BUILT_IN_FINITE):
     case BUILT_IN_FINITED32:
     case BUILT_IN_FINITED64:
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 5730bda80dc..3eb4216141e 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -8557,6 +8557,12 @@ operand 2, greater than operand 2 or is unordered with operand 2.

 This pattern is not allowed to @code{FAIL}.

+@cindex @code{isfinite@var{m}2} instruction pattern
+@item @samp{isfinite@var{m}2}
+Return 1 if operand 1 is a finite floating point number and 0
+otherwise.  @var{m} is a scalar floating point mode.  Operand 0
+has mode @code{SImode}, and operand 1 has mode @var{m}.
+
 @end table

 @end ifset
diff --git a/gcc/optabs.def b/gcc/optabs.def
index ad14f9328b9..dcd77315c2a 100644
--- a/gcc/optabs.def
+++ b/gcc/optabs.def
@@ -352,6 +352,7 @@ OPTAB_D (fmod_optab, "fmod$a3")
 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 (issignaling_optab, "issignaling$a2")
 OPTAB_D (ldexp_optab, "ldexp$a3")
 OPTAB_D (log10_optab, "log10$a2")

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

* Ping [PATCHv5] Optab: add isfinite_optab for __builtin_isfinite
  2024-05-29  6:36 [PATCHv5] Optab: add isfinite_optab for __builtin_isfinite HAO CHEN GUI
@ 2024-06-03  2:37 ` HAO CHEN GUI
  2024-06-17  5:29   ` Ping^2 " HAO CHEN GUI
  0 siblings, 1 reply; 4+ messages in thread
From: HAO CHEN GUI @ 2024-06-03  2:37 UTC (permalink / raw)
  To: gcc-patches
  Cc: Segher Boessenkool, David, Kewen.Lin, Peter Bergner,
	Andrew Pinski, Richard Biener, Richard Sandiford

Hi,
  All issues were addressed. Gently ping it.
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652991.html

Thanks
Gui Haochen

在 2024/5/29 14:36, HAO CHEN GUI 写道:
> Hi,
>   This patch adds an optab for __builtin_isfinite. The finite 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.
> 
>   Compared to previous version, the main change is to specify return
> value of the optab should be either 0 or 1.
> https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652864.html
> 
>   Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no
> regressions. Is this OK for trunk?
> 
> Thanks
> Gui Haochen
> 
> ChangeLog
> optab: Add isfinite_optab for isfinite builtin
> 
> gcc/
> 	* builtins.cc (interclass_mathfn_icode): Set optab to isfinite_optab
> 	for isfinite builtin.
> 	* optabs.def (isfinite_optab): New.
> 	* doc/md.texi (isfinite): Document.
> 
> 
> patch.diff
> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
> index f8d94c4b435..53e9d210541 100644
> --- a/gcc/builtins.cc
> +++ b/gcc/builtins.cc
> @@ -2459,8 +2459,10 @@ interclass_mathfn_icode (tree arg, tree fndecl)
>        errno_set = true; builtin_optab = ilogb_optab; break;
>      CASE_FLT_FN (BUILT_IN_ISINF):
>        builtin_optab = isinf_optab; break;
> -    case BUILT_IN_ISNORMAL:
>      case BUILT_IN_ISFINITE:
> +      builtin_optab = isfinite_optab;
> +      break;
> +    case BUILT_IN_ISNORMAL:
>      CASE_FLT_FN (BUILT_IN_FINITE):
>      case BUILT_IN_FINITED32:
>      case BUILT_IN_FINITED64:
> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
> index 5730bda80dc..3eb4216141e 100644
> --- a/gcc/doc/md.texi
> +++ b/gcc/doc/md.texi
> @@ -8557,6 +8557,12 @@ operand 2, greater than operand 2 or is unordered with operand 2.
> 
>  This pattern is not allowed to @code{FAIL}.
> 
> +@cindex @code{isfinite@var{m}2} instruction pattern
> +@item @samp{isfinite@var{m}2}
> +Return 1 if operand 1 is a finite floating point number and 0
> +otherwise.  @var{m} is a scalar floating point mode.  Operand 0
> +has mode @code{SImode}, and operand 1 has mode @var{m}.
> +
>  @end table
> 
>  @end ifset
> diff --git a/gcc/optabs.def b/gcc/optabs.def
> index ad14f9328b9..dcd77315c2a 100644
> --- a/gcc/optabs.def
> +++ b/gcc/optabs.def
> @@ -352,6 +352,7 @@ OPTAB_D (fmod_optab, "fmod$a3")
>  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 (issignaling_optab, "issignaling$a2")
>  OPTAB_D (ldexp_optab, "ldexp$a3")
>  OPTAB_D (log10_optab, "log10$a2")

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

* Ping^2 [PATCHv5] Optab: add isfinite_optab for __builtin_isfinite
  2024-06-03  2:37 ` Ping " HAO CHEN GUI
@ 2024-06-17  5:29   ` HAO CHEN GUI
       [not found]     ` <c0a6f075-1ea9-41cc-ab59-b167d980a709@linux.ibm.com>
  0 siblings, 1 reply; 4+ messages in thread
From: HAO CHEN GUI @ 2024-06-17  5:29 UTC (permalink / raw)
  To: gcc-patches
  Cc: Segher Boessenkool, David, Kewen.Lin, Peter Bergner,
	Andrew Pinski, Richard Biener, Richard Sandiford

Hi,
  Gently ping it.
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652991.html

Thanks
Gui Haochen

在 2024/6/3 10:37, HAO CHEN GUI 写道:
> Hi,
>   All issues were addressed. Gently ping it.
> https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652991.html
> 
> Thanks
> Gui Haochen
> 
> 在 2024/5/29 14:36, HAO CHEN GUI 写道:
>> Hi,
>>   This patch adds an optab for __builtin_isfinite. The finite 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.
>>
>>   Compared to previous version, the main change is to specify return
>> value of the optab should be either 0 or 1.
>> https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652864.html
>>
>>   Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no
>> regressions. Is this OK for trunk?
>>
>> Thanks
>> Gui Haochen
>>
>> ChangeLog
>> optab: Add isfinite_optab for isfinite builtin
>>
>> gcc/
>> 	* builtins.cc (interclass_mathfn_icode): Set optab to isfinite_optab
>> 	for isfinite builtin.
>> 	* optabs.def (isfinite_optab): New.
>> 	* doc/md.texi (isfinite): Document.
>>
>>
>> patch.diff
>> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
>> index f8d94c4b435..53e9d210541 100644
>> --- a/gcc/builtins.cc
>> +++ b/gcc/builtins.cc
>> @@ -2459,8 +2459,10 @@ interclass_mathfn_icode (tree arg, tree fndecl)
>>        errno_set = true; builtin_optab = ilogb_optab; break;
>>      CASE_FLT_FN (BUILT_IN_ISINF):
>>        builtin_optab = isinf_optab; break;
>> -    case BUILT_IN_ISNORMAL:
>>      case BUILT_IN_ISFINITE:
>> +      builtin_optab = isfinite_optab;
>> +      break;
>> +    case BUILT_IN_ISNORMAL:
>>      CASE_FLT_FN (BUILT_IN_FINITE):
>>      case BUILT_IN_FINITED32:
>>      case BUILT_IN_FINITED64:
>> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
>> index 5730bda80dc..3eb4216141e 100644
>> --- a/gcc/doc/md.texi
>> +++ b/gcc/doc/md.texi
>> @@ -8557,6 +8557,12 @@ operand 2, greater than operand 2 or is unordered with operand 2.
>>
>>  This pattern is not allowed to @code{FAIL}.
>>
>> +@cindex @code{isfinite@var{m}2} instruction pattern
>> +@item @samp{isfinite@var{m}2}
>> +Return 1 if operand 1 is a finite floating point number and 0
>> +otherwise.  @var{m} is a scalar floating point mode.  Operand 0
>> +has mode @code{SImode}, and operand 1 has mode @var{m}.
>> +
>>  @end table
>>
>>  @end ifset
>> diff --git a/gcc/optabs.def b/gcc/optabs.def
>> index ad14f9328b9..dcd77315c2a 100644
>> --- a/gcc/optabs.def
>> +++ b/gcc/optabs.def
>> @@ -352,6 +352,7 @@ OPTAB_D (fmod_optab, "fmod$a3")
>>  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 (issignaling_optab, "issignaling$a2")
>>  OPTAB_D (ldexp_optab, "ldexp$a3")
>>  OPTAB_D (log10_optab, "log10$a2")

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

* Re: Ping^3 [PATCHv5] Optab: add isfinite_optab for __builtin_isfinite
       [not found]     ` <c0a6f075-1ea9-41cc-ab59-b167d980a709@linux.ibm.com>
@ 2024-06-24 11:19       ` Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2024-06-24 11:19 UTC (permalink / raw)
  To: HAO CHEN GUI
  Cc: gcc-patches, Segher Boessenkool, David, Kewen.Lin, Peter Bergner,
	Andrew Pinski, Richard Sandiford

On Mon, Jun 24, 2024 at 3:38 AM HAO CHEN GUI <guihaoc@linux.ibm.com> wrote:
>
> Hi,
>   Gently ping it.
> https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652991.html

OK

> Thanks
> Gui Haochen
>
> 在 2024/6/17 13:29, HAO CHEN GUI 写道:
> > Hi,
> >   Gently ping it.
> > https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652991.html
> >
> > Thanks
> > Gui Haochen
> >
> > 在 2024/6/3 10:37, HAO CHEN GUI 写道:
> >> Hi,
> >>   All issues were addressed. Gently ping it.
> >> https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652991.html
> >>
> >> Thanks
> >> Gui Haochen
> >>
> >> 在 2024/5/29 14:36, HAO CHEN GUI 写道:
> >>> Hi,
> >>>   This patch adds an optab for __builtin_isfinite. The finite 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.
> >>>
> >>>   Compared to previous version, the main change is to specify return
> >>> value of the optab should be either 0 or 1.
> >>> https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652864.html
> >>>
> >>>   Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no
> >>> regressions. Is this OK for trunk?
> >>>
> >>> Thanks
> >>> Gui Haochen
> >>>
> >>> ChangeLog
> >>> optab: Add isfinite_optab for isfinite builtin
> >>>
> >>> gcc/
> >>>     * builtins.cc (interclass_mathfn_icode): Set optab to isfinite_optab
> >>>     for isfinite builtin.
> >>>     * optabs.def (isfinite_optab): New.
> >>>     * doc/md.texi (isfinite): Document.
> >>>
> >>>
> >>> patch.diff
> >>> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
> >>> index f8d94c4b435..53e9d210541 100644
> >>> --- a/gcc/builtins.cc
> >>> +++ b/gcc/builtins.cc
> >>> @@ -2459,8 +2459,10 @@ interclass_mathfn_icode (tree arg, tree fndecl)
> >>>        errno_set = true; builtin_optab = ilogb_optab; break;
> >>>      CASE_FLT_FN (BUILT_IN_ISINF):
> >>>        builtin_optab = isinf_optab; break;
> >>> -    case BUILT_IN_ISNORMAL:
> >>>      case BUILT_IN_ISFINITE:
> >>> +      builtin_optab = isfinite_optab;
> >>> +      break;
> >>> +    case BUILT_IN_ISNORMAL:
> >>>      CASE_FLT_FN (BUILT_IN_FINITE):
> >>>      case BUILT_IN_FINITED32:
> >>>      case BUILT_IN_FINITED64:
> >>> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
> >>> index 5730bda80dc..3eb4216141e 100644
> >>> --- a/gcc/doc/md.texi
> >>> +++ b/gcc/doc/md.texi
> >>> @@ -8557,6 +8557,12 @@ operand 2, greater than operand 2 or is unordered with operand 2.
> >>>
> >>>  This pattern is not allowed to @code{FAIL}.
> >>>
> >>> +@cindex @code{isfinite@var{m}2} instruction pattern
> >>> +@item @samp{isfinite@var{m}2}
> >>> +Return 1 if operand 1 is a finite floating point number and 0
> >>> +otherwise.  @var{m} is a scalar floating point mode.  Operand 0
> >>> +has mode @code{SImode}, and operand 1 has mode @var{m}.
> >>> +
> >>>  @end table
> >>>
> >>>  @end ifset
> >>> diff --git a/gcc/optabs.def b/gcc/optabs.def
> >>> index ad14f9328b9..dcd77315c2a 100644
> >>> --- a/gcc/optabs.def
> >>> +++ b/gcc/optabs.def
> >>> @@ -352,6 +352,7 @@ OPTAB_D (fmod_optab, "fmod$a3")
> >>>  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 (issignaling_optab, "issignaling$a2")
> >>>  OPTAB_D (ldexp_optab, "ldexp$a3")
> >>>  OPTAB_D (log10_optab, "log10$a2")

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

end of thread, other threads:[~2024-06-24 11:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-29  6:36 [PATCHv5] Optab: add isfinite_optab for __builtin_isfinite HAO CHEN GUI
2024-06-03  2:37 ` Ping " HAO CHEN GUI
2024-06-17  5:29   ` Ping^2 " HAO CHEN GUI
     [not found]     ` <c0a6f075-1ea9-41cc-ab59-b167d980a709@linux.ibm.com>
2024-06-24 11:19       ` Ping^3 " Richard Biener

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).