* [PATCH] x86: Ignore OPTION_MASK_ISA_64BIT for -m32 when inlining
@ 2022-03-14 13:49 H.J. Lu
2022-03-14 13:53 ` H.J. Lu
2022-03-14 14:03 ` Jakub Jelinek
0 siblings, 2 replies; 4+ messages in thread
From: H.J. Lu @ 2022-03-14 13:49 UTC (permalink / raw)
To: gcc-patches
gcc/
PR target/104890
* config/i386/i386.cc (ix86_can_inline_p): Ignore
OPTION_MASK_ISA_64BIT for -m32.
gcc/testsuite/
PR target/104890
* gcc.target/i386/pr104890.c: New test.
---
gcc/config/i386/i386.cc | 4 ++++
gcc/testsuite/gcc.target/i386/pr104890.c | 11 +++++++++++
2 files changed, 15 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/i386/pr104890.c
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 23bedea92bd..f2bb4765e5b 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -587,6 +587,10 @@ ix86_can_inline_p (tree caller, tree callee)
if (TARGET_GENERAL_REGS_ONLY_P (callee_opts->x_ix86_target_flags))
always_inline_safe_mask |= MASK_80387;
+ /* Ignore OPTION_MASK_ISA_64BIT for -m32. */
+ if (!TARGET_64BIT)
+ always_inline_safe_mask |= OPTION_MASK_ISA_64BIT;
+
cgraph_node *callee_node = cgraph_node::get (callee);
/* Callee's isa options should be a subset of the caller's, i.e. a SSE4
function can inline a SSE2 function but a SSE2 function can't inline
diff --git a/gcc/testsuite/gcc.target/i386/pr104890.c b/gcc/testsuite/gcc.target/i386/pr104890.c
new file mode 100644
index 00000000000..cb430eef688
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr104890.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -mshstk -march=i686" } */
+
+#include <x86gprintrin.h>
+
+__attribute__((target ("general-regs-only")))
+int
+foo ()
+{
+ return _get_ssp ();
+}
--
2.35.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: Ignore OPTION_MASK_ISA_64BIT for -m32 when inlining
2022-03-14 13:49 [PATCH] x86: Ignore OPTION_MASK_ISA_64BIT for -m32 when inlining H.J. Lu
@ 2022-03-14 13:53 ` H.J. Lu
2022-03-14 14:03 ` Jakub Jelinek
1 sibling, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2022-03-14 13:53 UTC (permalink / raw)
To: GCC Patches
On Mon, Mar 14, 2022 at 6:49 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> gcc/
>
> PR target/104890
> * config/i386/i386.cc (ix86_can_inline_p): Ignore
> OPTION_MASK_ISA_64BIT for -m32.
Please ignore this.
> gcc/testsuite/
>
> PR target/104890
> * gcc.target/i386/pr104890.c: New test.
> ---
> gcc/config/i386/i386.cc | 4 ++++
> gcc/testsuite/gcc.target/i386/pr104890.c | 11 +++++++++++
> 2 files changed, 15 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/i386/pr104890.c
>
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 23bedea92bd..f2bb4765e5b 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -587,6 +587,10 @@ ix86_can_inline_p (tree caller, tree callee)
> if (TARGET_GENERAL_REGS_ONLY_P (callee_opts->x_ix86_target_flags))
> always_inline_safe_mask |= MASK_80387;
>
> + /* Ignore OPTION_MASK_ISA_64BIT for -m32. */
> + if (!TARGET_64BIT)
> + always_inline_safe_mask |= OPTION_MASK_ISA_64BIT;
> +
> cgraph_node *callee_node = cgraph_node::get (callee);
> /* Callee's isa options should be a subset of the caller's, i.e. a SSE4
> function can inline a SSE2 function but a SSE2 function can't inline
> diff --git a/gcc/testsuite/gcc.target/i386/pr104890.c b/gcc/testsuite/gcc.target/i386/pr104890.c
> new file mode 100644
> index 00000000000..cb430eef688
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr104890.c
> @@ -0,0 +1,11 @@
> +/* { dg-do compile { target ia32 } } */
> +/* { dg-options "-O2 -mshstk -march=i686" } */
> +
> +#include <x86gprintrin.h>
> +
> +__attribute__((target ("general-regs-only")))
> +int
> +foo ()
> +{
> + return _get_ssp ();
> +}
> --
> 2.35.1
>
--
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: Ignore OPTION_MASK_ISA_64BIT for -m32 when inlining
2022-03-14 13:49 [PATCH] x86: Ignore OPTION_MASK_ISA_64BIT for -m32 when inlining H.J. Lu
2022-03-14 13:53 ` H.J. Lu
@ 2022-03-14 14:03 ` Jakub Jelinek
2022-03-14 14:32 ` H.J. Lu
1 sibling, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2022-03-14 14:03 UTC (permalink / raw)
To: H.J. Lu; +Cc: gcc-patches
On Mon, Mar 14, 2022 at 06:49:01AM -0700, H.J. Lu via Gcc-patches wrote:
> gcc/
>
> PR target/104890
> * config/i386/i386.cc (ix86_can_inline_p): Ignore
> OPTION_MASK_ISA_64BIT for -m32.
>
> gcc/testsuite/
>
> PR target/104890
> * gcc.target/i386/pr104890.c: New test.
> ---
> gcc/config/i386/i386.cc | 4 ++++
> gcc/testsuite/gcc.target/i386/pr104890.c | 11 +++++++++++
> 2 files changed, 15 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/i386/pr104890.c
>
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 23bedea92bd..f2bb4765e5b 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -587,6 +587,10 @@ ix86_can_inline_p (tree caller, tree callee)
> if (TARGET_GENERAL_REGS_ONLY_P (callee_opts->x_ix86_target_flags))
> always_inline_safe_mask |= MASK_80387;
>
> + /* Ignore OPTION_MASK_ISA_64BIT for -m32. */
> + if (!TARGET_64BIT)
> + always_inline_safe_mask |= OPTION_MASK_ISA_64BIT;
This looks wrong. (1 << 1) in alwyas_inline_safe_mask and
*->x_target_flags is MASK_80387, not OPTION_MASK_ISA_64BIT.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: Ignore OPTION_MASK_ISA_64BIT for -m32 when inlining
2022-03-14 14:03 ` Jakub Jelinek
@ 2022-03-14 14:32 ` H.J. Lu
0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2022-03-14 14:32 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: GCC Patches
On Mon, Mar 14, 2022 at 7:03 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Mon, Mar 14, 2022 at 06:49:01AM -0700, H.J. Lu via Gcc-patches wrote:
> > gcc/
> >
> > PR target/104890
> > * config/i386/i386.cc (ix86_can_inline_p): Ignore
> > OPTION_MASK_ISA_64BIT for -m32.
> >
> > gcc/testsuite/
> >
> > PR target/104890
> > * gcc.target/i386/pr104890.c: New test.
> > ---
> > gcc/config/i386/i386.cc | 4 ++++
> > gcc/testsuite/gcc.target/i386/pr104890.c | 11 +++++++++++
> > 2 files changed, 15 insertions(+)
> > create mode 100644 gcc/testsuite/gcc.target/i386/pr104890.c
> >
> > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> > index 23bedea92bd..f2bb4765e5b 100644
> > --- a/gcc/config/i386/i386.cc
> > +++ b/gcc/config/i386/i386.cc
> > @@ -587,6 +587,10 @@ ix86_can_inline_p (tree caller, tree callee)
> > if (TARGET_GENERAL_REGS_ONLY_P (callee_opts->x_ix86_target_flags))
> > always_inline_safe_mask |= MASK_80387;
> >
> > + /* Ignore OPTION_MASK_ISA_64BIT for -m32. */
> > + if (!TARGET_64BIT)
> > + always_inline_safe_mask |= OPTION_MASK_ISA_64BIT;
>
> This looks wrong. (1 << 1) in alwyas_inline_safe_mask and
> *->x_target_flags is MASK_80387, not OPTION_MASK_ISA_64BIT.
>
> Jakub
Here is the v2 patch:
https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591716.html
--
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-14 14:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 13:49 [PATCH] x86: Ignore OPTION_MASK_ISA_64BIT for -m32 when inlining H.J. Lu
2022-03-14 13:53 ` H.J. Lu
2022-03-14 14:03 ` Jakub Jelinek
2022-03-14 14:32 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).