diff mbox series

[04/52] go: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE

Message ID 657e010ec8d3bb5d42adc765dbf384a60a3569f4.1717134752.git.linkw@linux.ibm.com
State New
Headers show
Series Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook | expand

Commit Message

Kewen.Lin June 3, 2024, 3 a.m. UTC
Joseph pointed out "floating types should have their mode,
not a poorly defined precision value" in the discussion[1],
as he and Richi suggested, the existing macros
{FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE will be replaced with a
hook mode_for_floating_type.  To be prepared for that, this
patch is to replace use of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
in go with TYPE_PRECISION of {float,{,long_}double}_type_node.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html

gcc/go/ChangeLog:

	* go-gcc.cc (Gcc_backend::float_type): Use TYPE_PRECISION of
	{float,double,long_double}_type_node to replace
	{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
	(Gcc_backend::complex_type): Likewise.
---
 gcc/go/go-gcc.cc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Kewen.Lin June 12, 2024, 9:33 a.m. UTC | #1
Hi,

Gentle ping:

https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653387.html

BR,
Kewen

on 2024/6/3 11:00, Kewen Lin wrote:
> Joseph pointed out "floating types should have their mode,
> not a poorly defined precision value" in the discussion[1],
> as he and Richi suggested, the existing macros
> {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE will be replaced with a
> hook mode_for_floating_type.  To be prepared for that, this
> patch is to replace use of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
> in go with TYPE_PRECISION of {float,{,long_}double}_type_node.
> 
> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html
> 
> gcc/go/ChangeLog:
> 
> 	* go-gcc.cc (Gcc_backend::float_type): Use TYPE_PRECISION of
> 	{float,double,long_double}_type_node to replace
> 	{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
> 	(Gcc_backend::complex_type): Likewise.
> ---
>  gcc/go/go-gcc.cc | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
> index bc9732c3db3..6aa751f9f30 100644
> --- a/gcc/go/go-gcc.cc
> +++ b/gcc/go/go-gcc.cc
> @@ -993,11 +993,11 @@ Btype*
>  Gcc_backend::float_type(int bits)
>  {
>    tree type;
> -  if (bits == FLOAT_TYPE_SIZE)
> +  if (bits == TYPE_PRECISION (float_type_node))
>      type = float_type_node;
> -  else if (bits == DOUBLE_TYPE_SIZE)
> +  else if (bits == TYPE_PRECISION (double_type_node))
>      type = double_type_node;
> -  else if (bits == LONG_DOUBLE_TYPE_SIZE)
> +  else if (bits == TYPE_PRECISION (long_double_type_node))
>      type = long_double_type_node;
>    else
>      {
> @@ -1014,11 +1014,11 @@ Btype*
>  Gcc_backend::complex_type(int bits)
>  {
>    tree type;
> -  if (bits == FLOAT_TYPE_SIZE * 2)
> +  if (bits == TYPE_PRECISION (float_type_node) * 2)
>      type = complex_float_type_node;
> -  else if (bits == DOUBLE_TYPE_SIZE * 2)
> +  else if (bits == TYPE_PRECISION (double_type_node) * 2)
>      type = complex_double_type_node;
> -  else if (bits == LONG_DOUBLE_TYPE_SIZE * 2)
> +  else if (bits == TYPE_PRECISION (long_double_type_node) * 2)
>      type = complex_long_double_type_node;
>    else
>      {
Ian Lance Taylor June 12, 2024, 12:32 p.m. UTC | #2
"Kewen.Lin" <linkw@linux.ibm.com> writes:

> Hi,
>
> Gentle ping:
>
> https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653387.html
>
> BR,
> Kewen
>
> on 2024/6/3 11:00, Kewen Lin wrote:
>> Joseph pointed out "floating types should have their mode,
>> not a poorly defined precision value" in the discussion[1],
>> as he and Richi suggested, the existing macros
>> {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE will be replaced with a
>> hook mode_for_floating_type.  To be prepared for that, this
>> patch is to replace use of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
>> in go with TYPE_PRECISION of {float,{,long_}double}_type_node.
>> 
>> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html
>> 
>> gcc/go/ChangeLog:
>> 
>> 	* go-gcc.cc (Gcc_backend::float_type): Use TYPE_PRECISION of
>> 	{float,double,long_double}_type_node to replace
>> 	{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
>> 	(Gcc_backend::complex_type): Likewise.

This is fine if the other parts of the patch are accepted.

Thanks.

Ian
Kewen.Lin June 25, 2024, 5:38 a.m. UTC | #3
on 2024/6/12 20:32, Ian Lance Taylor wrote:
> "Kewen.Lin" <linkw@linux.ibm.com> writes:
> 
>> Hi,
>>
>> Gentle ping:
>>
>> https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653387.html
>>
>> BR,
>> Kewen
>>
>> on 2024/6/3 11:00, Kewen Lin wrote:
>>> Joseph pointed out "floating types should have their mode,
>>> not a poorly defined precision value" in the discussion[1],
>>> as he and Richi suggested, the existing macros
>>> {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE will be replaced with a
>>> hook mode_for_floating_type.  To be prepared for that, this
>>> patch is to replace use of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
>>> in go with TYPE_PRECISION of {float,{,long_}double}_type_node.
>>>
>>> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html
>>>
>>> gcc/go/ChangeLog:
>>>
>>> 	* go-gcc.cc (Gcc_backend::float_type): Use TYPE_PRECISION of
>>> 	{float,double,long_double}_type_node to replace
>>> 	{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
>>> 	(Gcc_backend::complex_type): Likewise.
> 
> This is fine if the other parts of the patch are accepted.

Thanks, pushed as r15-1591-gfafd87830937d5.

BR,
Kewen
diff mbox series

Patch

diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index bc9732c3db3..6aa751f9f30 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -993,11 +993,11 @@  Btype*
 Gcc_backend::float_type(int bits)
 {
   tree type;
-  if (bits == FLOAT_TYPE_SIZE)
+  if (bits == TYPE_PRECISION (float_type_node))
     type = float_type_node;
-  else if (bits == DOUBLE_TYPE_SIZE)
+  else if (bits == TYPE_PRECISION (double_type_node))
     type = double_type_node;
-  else if (bits == LONG_DOUBLE_TYPE_SIZE)
+  else if (bits == TYPE_PRECISION (long_double_type_node))
     type = long_double_type_node;
   else
     {
@@ -1014,11 +1014,11 @@  Btype*
 Gcc_backend::complex_type(int bits)
 {
   tree type;
-  if (bits == FLOAT_TYPE_SIZE * 2)
+  if (bits == TYPE_PRECISION (float_type_node) * 2)
     type = complex_float_type_node;
-  else if (bits == DOUBLE_TYPE_SIZE * 2)
+  else if (bits == TYPE_PRECISION (double_type_node) * 2)
     type = complex_double_type_node;
-  else if (bits == LONG_DOUBLE_TYPE_SIZE * 2)
+  else if (bits == TYPE_PRECISION (long_double_type_node) * 2)
     type = complex_long_double_type_node;
   else
     {