On Fri, Nov 8, 2024 at 12:18 PM H.J. Lu <hjl.to...@gmail.com> wrote:
>
> On Fri, Nov 8, 2024 at 10:41 AM Hu, Lin1 <lin1...@intel.com> wrote:
> >
> > Hi, all
> >
> > -maddress-mode=long will let Pmode = DI_mode, but -mx32 request x32 ABI.
> > So raise an error to avoid ICE.
> >
> > Bootstrapped and regtested, OK for trunk?
> >
> > BRs,
> > Lin
> >
> > gcc/ChangeLog:
> >
> >         PR target/117418
> >         * config/i386/i386-options.cc (ix86_option_override_internal): 
> > raise an
> >         error with option -mx32 -maddress-mode=long.
> >
> > gcc/testsuite/ChangeLog:
> >
> >         PR target/117418
> >         * gcc.target/i386/pr117418-1.c: New test.
> > ---
> >  gcc/config/i386/i386-options.cc            |  4 ++++
> >  gcc/testsuite/gcc.target/i386/pr117418-1.c | 13 +++++++++++++
> >  2 files changed, 17 insertions(+)
> >  create mode 100644 gcc/testsuite/gcc.target/i386/pr117418-1.c
> >
> > diff --git a/gcc/config/i386/i386-options.cc 
> > b/gcc/config/i386/i386-options.cc
> > index 239269ecbdd..ba1abea2537 100644
> > --- a/gcc/config/i386/i386-options.cc
> > +++ b/gcc/config/i386/i386-options.cc
> > @@ -2190,6 +2190,10 @@ ix86_option_override_internal (bool main_args_p,
> >         error ("address mode %qs not supported in the %s bit mode",
> >                TARGET_64BIT_P (opts->x_ix86_isa_flags) ? "short" : "long",
> >                TARGET_64BIT_P (opts->x_ix86_isa_flags) ? "64" : "32");
> > +
> > +      if (TARGET_X32_P (opts->x_ix86_isa_flags)
> > +         && opts_set->x_ix86_pmode == PMODE_DI)
> > +       error ("address mode 'long' not supported in the x32 ABI");
>
> This looks wrong.   Try the encoded patch.
>
So it means -maddress-mode=long will override x32 to use 64-bit pointer?
> >      }
> >    else
> >      opts->x_ix86_pmode = TARGET_LP64_P (opts->x_ix86_isa_flags)
> > diff --git a/gcc/testsuite/gcc.target/i386/pr117418-1.c 
> > b/gcc/testsuite/gcc.target/i386/pr117418-1.c
> > new file mode 100644
> > index 00000000000..08430ef9d4b
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/i386/pr117418-1.c
> > @@ -0,0 +1,13 @@
> > +/* PR target/117418 */
> > +/* { dg-do compile } */
> > +/* { dg-options "-maddress-mode=long -mwidekl -mx32" } */
> > +/* { dg-error "address mode 'long' not supported in the x32 ABI" "" { 
> > target *-*-* } 0 } */
> > +
> > +typedef __attribute__((__vector_size__(16))) long long V;
> > +V a;
> > +
> > +void
> > +foo()
> > +{
> > +    __builtin_ia32_encodekey256_u32(0, a, a, &a);
> > +}
> > --
> > 2.31.1
> >
>
>
> --
> H.J.



-- 
BR,
Hongtao

Reply via email to