diff mbox series

Change rs6000_const_f32_to_i32 return type.

Message ID 20210518203928.GA15973@ibm-toto.the-meissners.org
State New
Headers show
Series Change rs6000_const_f32_to_i32 return type. | expand

Commit Message

Michael Meissner May 18, 2021, 8:39 p.m. UTC
[PATCH] Change rs6000_const_f32_to_i32 return type.

The function rs6000_const_f32_to_i32 called REAL_VALUE_TO_TARGET_SINGLE
with a long long type and returns it.  This patch changes the type to long
which is the proper type for REAL_VALUE_TO_TARGET_SINGLE.

I have done bootstraps on little endian power9 and big endian power8 systems.
Can I check this into the trunk?

This does not need to go into GCC 11, unless some of the other patches that use
this function are also back ported.

gcc/
2021-05-18  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000-protos.h (rs6000_const_f32_to_i32): Change
	return type to long.
	* config/rs6000/rs6000.c (rs6000_const_f32_to_i32): Change return
	type to long.
---
 gcc/config/rs6000/rs6000-protos.h | 2 +-
 gcc/config/rs6000/rs6000.c        | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

will schmidt May 20, 2021, 7:29 p.m. UTC | #1
On Tue, 2021-05-18 at 16:39 -0400, Michael Meissner wrote:
> [PATCH] Change rs6000_const_f32_to_i32 return type.
> 
> The function rs6000_const_f32_to_i32 called REAL_VALUE_TO_TARGET_SINGLE
> with a long long type and returns it.  This patch changes the type to long
> which is the proper type for REAL_VALUE_TO_TARGET_SINGLE.

ok

That seems consistent with the tm.texi blurb: 
	For @code{REAL_VALUE_TO_TARGET_SINGLE} and
	@code{REAL_VALUE_TO_TARGET_DECIMAL32}, this variable should be
 	a simple @code{long int}. 

> 
> I have done bootstraps on little endian power9 and big endian power8 systems.
> Can I check this into the trunk?
> 
> This does not need to go into GCC 11, unless some of the other patches that use
> this function are also back ported.
> 
> gcc/
> 2021-05-18  Michael Meissner  <meissner@linux.ibm.com>
> 
> 	* config/rs6000/rs6000-protos.h (rs6000_const_f32_to_i32): Change
> 	return type to long.
> 	* config/rs6000/rs6000.c (rs6000_const_f32_to_i32): Change return
> 	type to long.
> ---
>  gcc/config/rs6000/rs6000-protos.h | 2 +-
>  gcc/config/rs6000/rs6000.c        | 6 ++++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
> index bef727e0a64..c407034d58c 100644
> --- a/gcc/config/rs6000/rs6000-protos.h
> +++ b/gcc/config/rs6000/rs6000-protos.h
> @@ -282,7 +282,7 @@ extern void rs6000_asm_output_dwarf_pcrel (FILE *file, int size,
>  					   const char *label);
>  extern void rs6000_asm_output_dwarf_datarel (FILE *file, int size,
>  					     const char *label);
> -extern long long rs6000_const_f32_to_i32 (rtx operand);
> +extern long rs6000_const_f32_to_i32 (rtx operand);
> 
>  /* Declare functions in rs6000-c.c */

ok

> 
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 86f53297cb9..ef1ebaaee05 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -27937,10 +27937,12 @@ rs6000_invalid_conversion (const_tree fromtype, const_tree totype)
>    return NULL;
>  }
> 
> -long long
> +/* Convert a SFmode constant to the integer bit pattern.  */
> +
> +long
>  rs6000_const_f32_to_i32 (rtx operand)
>  {
> -  long long value;
> +  long value;
>    const struct real_value *rv = CONST_DOUBLE_REAL_VALUE (operand);

ok

Thanks
-Will

> 
>    gcc_assert (GET_MODE (operand) == SFmode);
> -- 
> 2.31.1
>
Michael Meissner May 24, 2021, 3:55 p.m. UTC | #2
Ping patch.  This is independent of the other patches.

| Date: Tue, 18 May 2021 16:39:28 -0400
| Subject: [PATCH] Change rs6000_const_f32_to_i32 return type.
| Message-ID: <20210518203928.GA15973@ibm-toto.the-meissners.org>
Michael Meissner June 2, 2021, 12:11 a.m. UTC | #3
Ping patch again.

Original patch (Change rs6000_const_f32_to_i32 return type)

| Date: Tue, 18 May 2021 16:39:28 -0400
| Subject: [PATCH] Change rs6000_const_f32_to_i32 return type.
| Message-ID: <20210518203928.GA15973@ibm-toto.the-meissners.org>
| https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570680.html
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index bef727e0a64..c407034d58c 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -282,7 +282,7 @@  extern void rs6000_asm_output_dwarf_pcrel (FILE *file, int size,
 					   const char *label);
 extern void rs6000_asm_output_dwarf_datarel (FILE *file, int size,
 					     const char *label);
-extern long long rs6000_const_f32_to_i32 (rtx operand);
+extern long rs6000_const_f32_to_i32 (rtx operand);
 
 /* Declare functions in rs6000-c.c */
 
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 86f53297cb9..ef1ebaaee05 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -27937,10 +27937,12 @@  rs6000_invalid_conversion (const_tree fromtype, const_tree totype)
   return NULL;
 }
 
-long long
+/* Convert a SFmode constant to the integer bit pattern.  */
+
+long
 rs6000_const_f32_to_i32 (rtx operand)
 {
-  long long value;
+  long value;
   const struct real_value *rv = CONST_DOUBLE_REAL_VALUE (operand);
 
   gcc_assert (GET_MODE (operand) == SFmode);