diff mbox

rs6000: Introducing rs6000_abi_word_mode

Message ID 0a1541b82e8d3ff150976862824db4eabba4e9c5.1420816654.git.segher@kernel.crashing.org
State New
Headers show

Commit Message

Segher Boessenkool Jan. 9, 2015, 3:26 p.m. UTC
Some hooks return word_mode by default, which is incorrect for -m32
-mpowerpc64.  This patch creates a new function rs6000_abi_word_mode
to implement these hooks, and does so.

This fixes 163 testuite FAILs.

Tested as usual; okay for mainline?


2015-01-09  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/
	* config/rs6000/rs6000.c (TARGET_LIBGCC_CMP_RETURN_MODE,
	TARGET_LIBGCC_SHIFT_COUNT_MODE, TARGET_UNWIND_WORD_MODE): Implement
	as ...
	(rs6000_abi_word_mode): New function.

---
 gcc/config/rs6000/rs6000.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

David Edelsohn Jan. 9, 2015, 3:51 p.m. UTC | #1
On Fri, Jan 9, 2015 at 10:26 AM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> Some hooks return word_mode by default, which is incorrect for -m32
> -mpowerpc64.  This patch creates a new function rs6000_abi_word_mode
> to implement these hooks, and does so.
>
> This fixes 163 testuite FAILs.
>
> Tested as usual; okay for mainline?
>
>
> 2015-01-09  Segher Boessenkool  <segher@kernel.crashing.org>
>
> gcc/
>         * config/rs6000/rs6000.c (TARGET_LIBGCC_CMP_RETURN_MODE,
>         TARGET_LIBGCC_SHIFT_COUNT_MODE, TARGET_UNWIND_WORD_MODE): Implement
>         as ...
>         (rs6000_abi_word_mode): New function.

Okay.

> +/* The mode the ABI uses for a word.  This is not the same as word_mode
> +   for -m32 -mpowerpc64.  This is used to implement various target hooks.  */
> +
> +static enum machine_mode
> +rs6000_abi_word_mode (void)
> +{
> +  return TARGET_32BIT ? SImode : DImode;
> +}

But I think that new code does not need "enum".

Thanks, David
diff mbox

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index cc7b2a4..958a8b9 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1663,6 +1663,13 @@  static const struct attribute_spec rs6000_attribute_table[] =
 
 #undef TARGET_ATOMIC_ASSIGN_EXPAND_FENV
 #define TARGET_ATOMIC_ASSIGN_EXPAND_FENV rs6000_atomic_assign_expand_fenv
+
+#undef TARGET_LIBGCC_CMP_RETURN_MODE
+#define TARGET_LIBGCC_CMP_RETURN_MODE rs6000_abi_word_mode
+#undef TARGET_LIBGCC_SHIFT_COUNT_MODE
+#define TARGET_LIBGCC_SHIFT_COUNT_MODE rs6000_abi_word_mode
+#undef TARGET_UNWIND_WORD_MODE
+#define TARGET_UNWIND_WORD_MODE rs6000_abi_word_mode
 
 
 /* Processor table.  */
@@ -9293,8 +9300,18 @@  init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
     }
 }
 
+/* The mode the ABI uses for a word.  This is not the same as word_mode
+   for -m32 -mpowerpc64.  This is used to implement various target hooks.  */
+
+static enum machine_mode
+rs6000_abi_word_mode (void)
+{
+  return TARGET_32BIT ? SImode : DImode;
+}
+
 /* On rs6000, function arguments are promoted, as are function return
    values.  */
+
 static machine_mode
 rs6000_promote_function_mode (const_tree, machine_mode mode, int *,
 			      const_tree, int)