Message ID | 20220314134901.1252090-1-hjl.tools@gmail.com |
---|---|
State | New |
Headers | show |
Series | x86: Ignore OPTION_MASK_ISA_64BIT for -m32 when inlining | expand |
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 >
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
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
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 (); +}