diff mbox series

x86, Darwin: Fix bootstrap for 32b multilibs/hosts.

Message ID 20240705083451.87687-1-iain@sandoe.co.uk
State New
Headers show
Series x86, Darwin: Fix bootstrap for 32b multilibs/hosts. | expand

Commit Message

Iain Sandoe July 5, 2024, 8:34 a.m. UTC
This is Darwin-local, and I would like to apply it today to restore
bootstrap before my weekend test-runs, but would welcome any comments
or suggestions.

thanks
Iain

--- 8< ---

r15-1735-ge62ea4fb8ffcab06ddd  contained changes that altered the
codegen for 32b Darwin (whether hosted on 64b or as 32b host) such
that the per function picbase load is called multiple times in some
cases.  Darwin's back end is not expecting this (and indeed some of
the handling depends on a single instance).

The fixes the issue by marking those instructions as not copyable
(as suggested by Andrew Pinski).

The change is Darwin-specific.

gcc/ChangeLog:

	* config/i386/i386.cc (ix86_cannot_copy_insn_p): New.
	(TARGET_CANNOT_COPY_INSN_P): New.

Signed-off-by: Iain Sandoe <iains@gcc.gnu.org>
---
 gcc/config/i386/i386.cc | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Iain Sandoe July 5, 2024, 10:36 p.m. UTC | #1
> On 5 Jul 2024, at 09:34, Iain Sandoe <iains.gcc@gmail.com> wrote:
> 
> This is Darwin-local, and I would like to apply it today to restore
> bootstrap before my weekend test-runs,

tested on x86_64-linux (m32/m64) x86_64-darwin17 (m32/m64)
i686-darwin17 (m32/m64) i686-darwin9 (m32/m64) x86_64-darwin21 (m64)
pushed to trunk to restore bootstrap on the affected targets,
thanks
Iain

> but would welcome any comments
> or suggestions.
> 
> thanks
> Iain
> 
> --- 8< ---
> 
> r15-1735-ge62ea4fb8ffcab06ddd  contained changes that altered the
> codegen for 32b Darwin (whether hosted on 64b or as 32b host) such
> that the per function picbase load is called multiple times in some
> cases.  Darwin's back end is not expecting this (and indeed some of
> the handling depends on a single instance).
> 
> The fixes the issue by marking those instructions as not copyable
> (as suggested by Andrew Pinski).
> 
> The change is Darwin-specific.
> 
> gcc/ChangeLog:
> 
> 	* config/i386/i386.cc (ix86_cannot_copy_insn_p): New.
> 	(TARGET_CANNOT_COPY_INSN_P): New.
> 
> Signed-off-by: Iain Sandoe <iains@gcc.gnu.org>
> ---
> gcc/config/i386/i386.cc | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
> 
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 99def8d4a77..f75250f79de 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -27025,6 +27025,29 @@ ix86_libm_function_max_error (unsigned cfn, machine_mode mode,
> #undef TARGET_LIBM_FUNCTION_MAX_ERROR
> #define TARGET_LIBM_FUNCTION_MAX_ERROR ix86_libm_function_max_error
> 
> +#if TARGET_MACHO
> +static bool
> +ix86_cannot_copy_insn_p (rtx_insn *insn)
> +{
> +  if (TARGET_64BIT)
> +    return false;
> +
> +  rtx set = single_set (insn);
> +  if (set)
> +    {
> +      rtx src = SET_SRC (set);
> +      if (GET_CODE (src) == UNSPEC
> +	  && XINT (src, 1) == UNSPEC_SET_GOT)
> +	return true;
> +    }
> +  return false;
> +}
> +
> +#undef TARGET_CANNOT_COPY_INSN_P
> +#define TARGET_CANNOT_COPY_INSN_P ix86_cannot_copy_insn_p
> +
> +#endif
> +
> #if CHECKING_P
> #undef TARGET_RUN_TARGET_SELFTESTS
> #define TARGET_RUN_TARGET_SELFTESTS selftest::ix86_run_selftests
> -- 
> 2.39.2 (Apple Git-143)
>
diff mbox series

Patch

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 99def8d4a77..f75250f79de 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -27025,6 +27025,29 @@  ix86_libm_function_max_error (unsigned cfn, machine_mode mode,
 #undef TARGET_LIBM_FUNCTION_MAX_ERROR
 #define TARGET_LIBM_FUNCTION_MAX_ERROR ix86_libm_function_max_error
 
+#if TARGET_MACHO
+static bool
+ix86_cannot_copy_insn_p (rtx_insn *insn)
+{
+  if (TARGET_64BIT)
+    return false;
+
+  rtx set = single_set (insn);
+  if (set)
+    {
+      rtx src = SET_SRC (set);
+      if (GET_CODE (src) == UNSPEC
+	  && XINT (src, 1) == UNSPEC_SET_GOT)
+	return true;
+    }
+  return false;
+}
+
+#undef TARGET_CANNOT_COPY_INSN_P
+#define TARGET_CANNOT_COPY_INSN_P ix86_cannot_copy_insn_p
+
+#endif
+
 #if CHECKING_P
 #undef TARGET_RUN_TARGET_SELFTESTS
 #define TARGET_RUN_TARGET_SELFTESTS selftest::ix86_run_selftests