diff mbox series

[05/52] rust: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE

Message ID 2433deffaba4159f49ecaa4fc50e2a065c271aad.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 rust with TYPE_PRECISION of {float,{,long_}double}_type_node.

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

gcc/rust/ChangeLog:

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

Comments

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

Gentle ping:

https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653339.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 rust with TYPE_PRECISION of {float,{,long_}double}_type_node.
> 
> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html
> 
> gcc/rust/ChangeLog:
> 
> 	* rust-gcc.cc (float_type): Use TYPE_PRECISION of
> 	{float,double,long_double}_type_node to replace
> 	{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
> ---
>  gcc/rust/rust-gcc.cc | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
> index f17e19a2dfc..38169c08985 100644
> --- a/gcc/rust/rust-gcc.cc
> +++ b/gcc/rust/rust-gcc.cc
> @@ -411,11 +411,11 @@ tree
>  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
>      {
Kewen.Lin June 21, 2024, 1:48 a.m. UTC | #2
Hi!

Gentle ping^2:

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

BR,
Kewen

on 2024/6/12 17:35, Kewen.Lin wrote:
> Hi,
> 
> Gentle ping:
> 
> https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653339.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 rust with TYPE_PRECISION of {float,{,long_}double}_type_node.
>>
>> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html
>>
>> gcc/rust/ChangeLog:
>>
>> 	* rust-gcc.cc (float_type): Use TYPE_PRECISION of
>> 	{float,double,long_double}_type_node to replace
>> 	{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
>> ---
>>  gcc/rust/rust-gcc.cc | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
>> index f17e19a2dfc..38169c08985 100644
>> --- a/gcc/rust/rust-gcc.cc
>> +++ b/gcc/rust/rust-gcc.cc
>> @@ -411,11 +411,11 @@ tree
>>  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
>>      {
>
Arthur Cohen June 21, 2024, 10:17 a.m. UTC | #3
Hi,

Sorry about the delay in my answer! The patch looks good to me :) Will 
you push it as part of your patchset?

Kindly,

Arthur

On 6/3/24 05: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 rust with TYPE_PRECISION of {float,{,long_}double}_type_node.
> 
> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html
> 
> gcc/rust/ChangeLog:
> 
> 	* rust-gcc.cc (float_type): Use TYPE_PRECISION of
> 	{float,double,long_double}_type_node to replace
> 	{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
> ---
>   gcc/rust/rust-gcc.cc | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
> index f17e19a2dfc..38169c08985 100644
> --- a/gcc/rust/rust-gcc.cc
> +++ b/gcc/rust/rust-gcc.cc
> @@ -411,11 +411,11 @@ tree
>   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
>       {
Kewen.Lin June 21, 2024, 10:36 a.m. UTC | #4
Hi Arthur,

on 2024/6/21 18:17, Arthur Cohen wrote:
> Hi,
> 
> Sorry about the delay in my answer! The patch looks good to me :) Will you push it as part of your patchset?
> 

Thanks for the review!  Since this one doesn't necessarily depend on
"09/52 Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook
mode_for_floating_type", I'm going to push this before that (just like
the other FE changes excepting for the jit one 10/52 which depends on
the new hook 09/52).  btw, all after 09/52 would be merged into 09/52
when committing. :)

Does it sound good to you?

BR,
Kewen

> Kindly,
> 
> Arthur
> 
> On 6/3/24 05: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 rust with TYPE_PRECISION of {float,{,long_}double}_type_node.
>>
>> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html
>>
>> gcc/rust/ChangeLog:
>>
>>     * rust-gcc.cc (float_type): Use TYPE_PRECISION of
>>     {float,double,long_double}_type_node to replace
>>     {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
>> ---
>>   gcc/rust/rust-gcc.cc | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
>> index f17e19a2dfc..38169c08985 100644
>> --- a/gcc/rust/rust-gcc.cc
>> +++ b/gcc/rust/rust-gcc.cc
>> @@ -411,11 +411,11 @@ tree
>>   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
>>       {
Kewen.Lin June 25, 2024, 5:42 a.m. UTC | #5
on 2024/6/21 18:36, Kewen.Lin wrote:
> Hi Arthur,
> 
> on 2024/6/21 18:17, Arthur Cohen wrote:
>> Hi,
>>
>> Sorry about the delay in my answer! The patch looks good to me :) Will you push it as part of your patchset?
>>
> 
> Thanks for the review!  Since this one doesn't necessarily depend on
> "09/52 Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook
> mode_for_floating_type", I'm going to push this before that (just like
> the other FE changes excepting for the jit one 10/52 which depends on
> the new hook 09/52).  btw, all after 09/52 would be merged into 09/52
> when committing. :)

Pushed as r15-1592-gbcd1b7a097031d, thanks!

BR,
Kewen
Arthur Cohen June 25, 2024, 10:14 a.m. UTC | #6
Hi Kewen,

Sorry for not answering earlier - yes, this sounds good to me :) thanks 
for taking care of that.

Best,

Arthur

On 6/21/24 12:36, Kewen.Lin wrote:
> Hi Arthur,
> 
> on 2024/6/21 18:17, Arthur Cohen wrote:
>> Hi,
>>
>> Sorry about the delay in my answer! The patch looks good to me :) Will you push it as part of your patchset?
>>
> 
> Thanks for the review!  Since this one doesn't necessarily depend on
> "09/52 Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook
> mode_for_floating_type", I'm going to push this before that (just like
> the other FE changes excepting for the jit one 10/52 which depends on
> the new hook 09/52).  btw, all after 09/52 would be merged into 09/52
> when committing. :)
> 
> Does it sound good to you?
> 
> BR,
> Kewen
> 
>> Kindly,
>>
>> Arthur
>>
>> On 6/3/24 05: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 rust with TYPE_PRECISION of {float,{,long_}double}_type_node.
>>>
>>> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html
>>>
>>> gcc/rust/ChangeLog:
>>>
>>>      * rust-gcc.cc (float_type): Use TYPE_PRECISION of
>>>      {float,double,long_double}_type_node to replace
>>>      {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
>>> ---
>>>    gcc/rust/rust-gcc.cc | 6 +++---
>>>    1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
>>> index f17e19a2dfc..38169c08985 100644
>>> --- a/gcc/rust/rust-gcc.cc
>>> +++ b/gcc/rust/rust-gcc.cc
>>> @@ -411,11 +411,11 @@ tree
>>>    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
>>>        {
diff mbox series

Patch

diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index f17e19a2dfc..38169c08985 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -411,11 +411,11 @@  tree
 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
     {