diff mbox series

[PATCHv5] Optab: add isnormal_optab for __builtin_isnormal

Message ID 1a0ffcad-f455-472c-90b7-0c712896837f@linux.ibm.com
State New
Headers show
Series [PATCHv5] Optab: add isnormal_optab for __builtin_isnormal | expand

Commit Message

HAO CHEN GUI May 29, 2024, 6:36 a.m. UTC
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.

  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/652865.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 isnormal_optab for isnormal builtin

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


patch.diff

Comments

HAO CHEN GUI June 3, 2024, 2:37 a.m. UTC | #1
Hi,
  All issues were addressed. Gently ping it.
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653001.html

Thanks
Gui Haochen


在 2024/5/29 14:36, HAO CHEN GUI 写道:
> 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.
> 
>   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/652865.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 isnormal_optab for isnormal builtin
> 
> gcc/
> 	* builtins.cc (interclass_mathfn_icode): Set optab to isnormal_optab
> 	for isnormal builtin.
> 	* optabs.def (isnormal_optab): New.
> 	* doc/md.texi (isnormal): Document.
> 
> 
> patch.diff
> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
> index 53e9d210541..89ba56abf17 100644
> --- a/gcc/builtins.cc
> +++ b/gcc/builtins.cc
> @@ -2463,6 +2463,8 @@ interclass_mathfn_icode (tree arg, tree fndecl)
>        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/doc/md.texi b/gcc/doc/md.texi
> index 3eb4216141e..4fd7da095fe 100644
> --- a/gcc/doc/md.texi
> +++ b/gcc/doc/md.texi
> @@ -8563,6 +8563,12 @@ 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}.
> 
> +@cindex @code{isnormal@var{m}2} instruction pattern
> +@item @samp{isnormal@var{m}2}
> +Return 1 if operand 1 is a normal 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 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")
HAO CHEN GUI June 17, 2024, 5:30 a.m. UTC | #2
Hi,
  Gently ping it.
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653001.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/653001.html
> 
> Thanks
> Gui Haochen
> 
> 
> 在 2024/5/29 14:36, HAO CHEN GUI 写道:
>> 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.
>>
>>   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/652865.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 isnormal_optab for isnormal builtin
>>
>> gcc/
>> 	* builtins.cc (interclass_mathfn_icode): Set optab to isnormal_optab
>> 	for isnormal builtin.
>> 	* optabs.def (isnormal_optab): New.
>> 	* doc/md.texi (isnormal): Document.
>>
>>
>> patch.diff
>> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
>> index 53e9d210541..89ba56abf17 100644
>> --- a/gcc/builtins.cc
>> +++ b/gcc/builtins.cc
>> @@ -2463,6 +2463,8 @@ interclass_mathfn_icode (tree arg, tree fndecl)
>>        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/doc/md.texi b/gcc/doc/md.texi
>> index 3eb4216141e..4fd7da095fe 100644
>> --- a/gcc/doc/md.texi
>> +++ b/gcc/doc/md.texi
>> @@ -8563,6 +8563,12 @@ 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}.
>>
>> +@cindex @code{isnormal@var{m}2} instruction pattern
>> +@item @samp{isnormal@var{m}2}
>> +Return 1 if operand 1 is a normal 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 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")
HAO CHEN GUI June 24, 2024, 1:39 a.m. UTC | #3
Hi,
  Gently ping it.
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653001.html

Thanks
Gui Haochen

在 2024/6/17 13:30, HAO CHEN GUI 写道:
> Hi,
>   Gently ping it.
> https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653001.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/653001.html
>>
>> Thanks
>> Gui Haochen
>>
>>
>> 在 2024/5/29 14:36, HAO CHEN GUI 写道:
>>> 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.
>>>
>>>   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/652865.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 isnormal_optab for isnormal builtin
>>>
>>> gcc/
>>> 	* builtins.cc (interclass_mathfn_icode): Set optab to isnormal_optab
>>> 	for isnormal builtin.
>>> 	* optabs.def (isnormal_optab): New.
>>> 	* doc/md.texi (isnormal): Document.
>>>
>>>
>>> patch.diff
>>> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
>>> index 53e9d210541..89ba56abf17 100644
>>> --- a/gcc/builtins.cc
>>> +++ b/gcc/builtins.cc
>>> @@ -2463,6 +2463,8 @@ interclass_mathfn_icode (tree arg, tree fndecl)
>>>        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/doc/md.texi b/gcc/doc/md.texi
>>> index 3eb4216141e..4fd7da095fe 100644
>>> --- a/gcc/doc/md.texi
>>> +++ b/gcc/doc/md.texi
>>> @@ -8563,6 +8563,12 @@ 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}.
>>>
>>> +@cindex @code{isnormal@var{m}2} instruction pattern
>>> +@item @samp{isnormal@var{m}2}
>>> +Return 1 if operand 1 is a normal 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 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")
Richard Biener June 24, 2024, 11:19 a.m. UTC | #4
On Mon, Jun 24, 2024 at 3:39 AM HAO CHEN GUI <guihaoc@linux.ibm.com> wrote:
>
> Hi,
>   Gently ping it.
> https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653001.html

OK

> Thanks
> Gui Haochen
>
> 在 2024/6/17 13:30, HAO CHEN GUI 写道:
> > Hi,
> >   Gently ping it.
> > https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653001.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/653001.html
> >>
> >> Thanks
> >> Gui Haochen
> >>
> >>
> >> 在 2024/5/29 14:36, HAO CHEN GUI 写道:
> >>> 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.
> >>>
> >>>   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/652865.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 isnormal_optab for isnormal builtin
> >>>
> >>> gcc/
> >>>     * builtins.cc (interclass_mathfn_icode): Set optab to isnormal_optab
> >>>     for isnormal builtin.
> >>>     * optabs.def (isnormal_optab): New.
> >>>     * doc/md.texi (isnormal): Document.
> >>>
> >>>
> >>> patch.diff
> >>> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
> >>> index 53e9d210541..89ba56abf17 100644
> >>> --- a/gcc/builtins.cc
> >>> +++ b/gcc/builtins.cc
> >>> @@ -2463,6 +2463,8 @@ interclass_mathfn_icode (tree arg, tree fndecl)
> >>>        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/doc/md.texi b/gcc/doc/md.texi
> >>> index 3eb4216141e..4fd7da095fe 100644
> >>> --- a/gcc/doc/md.texi
> >>> +++ b/gcc/doc/md.texi
> >>> @@ -8563,6 +8563,12 @@ 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}.
> >>>
> >>> +@cindex @code{isnormal@var{m}2} instruction pattern
> >>> +@item @samp{isnormal@var{m}2}
> >>> +Return 1 if operand 1 is a normal 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 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")
diff mbox series

Patch

diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 53e9d210541..89ba56abf17 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -2463,6 +2463,8 @@  interclass_mathfn_icode (tree arg, tree fndecl)
       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/doc/md.texi b/gcc/doc/md.texi
index 3eb4216141e..4fd7da095fe 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -8563,6 +8563,12 @@  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}.

+@cindex @code{isnormal@var{m}2} instruction pattern
+@item @samp{isnormal@var{m}2}
+Return 1 if operand 1 is a normal 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 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")