On Tue, Jul 30, 2024 at 1:05 PM Hongyu Wang <wwwhhhyyy...@gmail.com> wrote:
>
> Richard Biener <richard.guent...@gmail.com> 于2024年7月26日周五 19:45写道:
> >
> > On Fri, Jul 26, 2024 at 10:50 AM Hongyu Wang <hongyu.w...@intel.com> wrote:
> > >
> > > Hi,
> > >
> > > When introducing munroll-only-small-loops, the option was marked as
> > > Target Save and added to -O2 default which makes attribute(optimize)
> > > resets target option and causing error when cmdline has O1 and
> > > funciton attribute has O2 and other target options. Mark this option
> > > as Optimization to fix.
> > >
> > > Bootstrapped and regtested on x86_64-pc-linux-gnu.
> > >
> > > Ok for trunk and backport down to gcc-13?
> >
> > Note this requires bumping LTO_minor_version on branches.
> >
>
> Yes, as the aarch64 fix was not backported I'd like to just fix it for trunk.
Ok for trunk only.
>
> > > gcc/ChangeLog
> > >
> > >         PR target/116065
> > >         * config/i386/i386.opt (munroll-only-small-loops): Mark as
> > >         Optimization instead of Save.
> > >
> > > gcc/testsuite/ChangeLog
> > >
> > >         PR target/116065
> > >         * gcc.target/i386/pr116065.c: New test.
> > > ---
> > >  gcc/config/i386/i386.opt                 |  2 +-
> > >  gcc/testsuite/gcc.target/i386/pr116065.c | 24 ++++++++++++++++++++++++
> > >  2 files changed, 25 insertions(+), 1 deletion(-)
> > >  create mode 100644 gcc/testsuite/gcc.target/i386/pr116065.c
> > >
> > > diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
> > > index 353fffb2343..52054bc018a 100644
> > > --- a/gcc/config/i386/i386.opt
> > > +++ b/gcc/config/i386/i386.opt
> > > @@ -1259,7 +1259,7 @@ Target Mask(ISA2_RAOINT) Var(ix86_isa_flags2) Save
> > >  Support RAOINT built-in functions and code generation.
> > >
> > >  munroll-only-small-loops
> > > -Target Var(ix86_unroll_only_small_loops) Init(0) Save
> > > +Target Var(ix86_unroll_only_small_loops) Init(0) Optimization
> > >  Enable conservative small loop unrolling.
> > >
> > >  mlam=
> > > diff --git a/gcc/testsuite/gcc.target/i386/pr116065.c 
> > > b/gcc/testsuite/gcc.target/i386/pr116065.c
> > > new file mode 100644
> > > index 00000000000..083e70f2413
> > > --- /dev/null
> > > +++ b/gcc/testsuite/gcc.target/i386/pr116065.c
> > > @@ -0,0 +1,24 @@
> > > +/* PR target/116065  */
> > > +/* { dg-do compile } */
> > > +/* { dg-options "-O1 -mno-avx" } */
> > > +
> > > +#ifndef __AVX__
> > > +#pragma GCC push_options
> > > +#pragma GCC target("avx")
> > > +#define __DISABLE_AVX__
> > > +#endif /* __AVX__ */
> > > +
> > > +extern inline double __attribute__((__gnu_inline__,__always_inline__))
> > > +     foo (double x) { return x; }
> > > +
> > > +#ifdef __DISABLE_AVX__
> > > +#undef __DISABLE_AVX__
> > > +#pragma GCC pop_options
> > > +#endif /* __DISABLE_AVX__ */
> > > +
> > > +void __attribute__((target ("avx"), optimize(3)))
> > > +bar (double *p)
> > > +{
> > > +  *p = foo (*p);
> > > +}
> > > +
> > > --
> > > 2.31.1
> > >



-- 
BR,
Hongtao

Reply via email to