On Wed, Apr 28, 2021 at 1:46 PM Richard Biener <rguent...@suse.de> wrote:
>
> On Wed, 28 Apr 2021, Uros Bizjak wrote:
>
> > On Wed, Apr 28, 2021 at 1:02 PM Richard Biener <rguent...@suse.de> wrote:
> > >
> > > This arranges for the x86 AVX and AVX2 masked load builtins to be
> > > pure to enable dead code elimination and more appropriate alias
> > > analysis.
> > >
> > > Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK for trunk?
> > >
> > > Thanks,
> > > Richard.
> > >
> > > 2021-04-28  Richard Biener  <rguent...@suse.de>
> > >
> > >         PR target/100312
> > >         * config/i386/i386-builtin.def (IX86_BUILTIN_MASKLOADPD,
> > >         IX86_BUILTIN_MASKLOADPS, IX86_BUILTIN_MASKLOADPD256,
> > >         IX86_BUILTIN_MASKLOADPS256, IX86_BUILTIN_MASKLOADD,
> > >         IX86_BUILTIN_MASKLOADQ, IX86_BUILTIN_MASKLOADD256,
> > >         IX86_BUILTIN_MASKLOADQ256): Remove.
> > >         * config/i386/i386-builtins.h (ix86_builtins): Add entries for
> > >         IX86_BUILTIN_MASKLOADPD, IX86_BUILTIN_MASKLOADPS,
> > >         IX86_BUILTIN_MASKLOADPD256, IX86_BUILTIN_MASKLOADPS256,
> > >         IX86_BUILTIN_MASKLOADD, IX86_BUILTIN_MASKLOADQ,
> > >         IX86_BUILTIN_MASKLOADD256, and IX86_BUILTIN_MASKLOADQ256.
> > >         * config/i386/i386-builtins.c (ix86_init_mmx_sse_builtins):
> > >         Initialize IX86_BUILTIN_MASKLOADPD, IX86_BUILTIN_MASKLOADPS,
> > >         IX86_BUILTIN_MASKLOADPD256, IX86_BUILTIN_MASKLOADPS256,
> > >         IX86_BUILTIN_MASKLOADD, IX86_BUILTIN_MASKLOADQ,
> > >         IX86_BUILTIN_MASKLOADD256, and IX86_BUILTIN_MASKLOADQ256
> > >         as pure builtins.
> >
> > OK.
>
> Whoops - somehow I posted the wrong version.  The version posted
> ICEs because I failed to realize I'd have to explicitely handle
> those builtins in ix86_expand_builtin.  What bootstrapped and
> tested OK is the version below.
>
> Is that version also OK?

Hm, your previous version removed mentioned builtins from builtins.def
and initialized them in ix86_init_mmx_sse_builtins by hand (this seems
to be the preferred way). This should work, so I really don't see why
the previous approach would result in ICE.

Uros.

>
> Thanks,
> Richard.
>
> From 44fb1b12c4b5ec649804d8ea40ebc087723ccc7f Mon Sep 17 00:00:00 2001
> From: Richard Biener <rguent...@suse.de>
> Date: Wed, 28 Apr 2021 12:09:03 +0200
> Subject: [PATCH] target/100312 - make x86 masked load builtins pure
> To: gcc-patches@gcc.gnu.org
>
> This arranges for the x86 AVX and AVX2 masked load builtins to be
> pure to enable dead code elimination and more appropriate alias
> analysis.
>
> 2021-04-28  Richard Biener  <rguent...@suse.de>
>
>         PR target/100312
>         * config/i386/i386-builtins.c (ix86_init_mmx_sse_builtins):
>         Arrange for IX86_BUILTIN_MASKLOADPD, IX86_BUILTIN_MASKLOADPS,
>         IX86_BUILTIN_MASKLOADPD256, IX86_BUILTIN_MASKLOADPS256,
>         IX86_BUILTIN_MASKLOADD, IX86_BUILTIN_MASKLOADQ,
>         IX86_BUILTIN_MASKLOADD256, and IX86_BUILTIN_MASKLOADQ256
>         to be defined as pure builtins.
> ---
>  gcc/config/i386/i386-builtins.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/i386/i386-builtins.c b/gcc/config/i386/i386-builtins.c
> index 128bd39816c..fa05cd6cf65 100644
> --- a/gcc/config/i386/i386-builtins.c
> +++ b/gcc/config/i386/i386-builtins.c
> @@ -521,7 +521,17 @@ ix86_init_mmx_sse_builtins (void)
>         continue;
>
>        ftype = (enum ix86_builtin_func_type) d->flag;
> -      def_builtin (d->mask, d->mask2, d->name, ftype, d->code);
> +      if (d->code == IX86_BUILTIN_MASKLOADPD
> +         || d->code == IX86_BUILTIN_MASKLOADPS
> +         || d->code == IX86_BUILTIN_MASKLOADPD256
> +         || d->code == IX86_BUILTIN_MASKLOADPS256
> +         || d->code == IX86_BUILTIN_MASKLOADD
> +         || d->code == IX86_BUILTIN_MASKLOADQ
> +         || d->code == IX86_BUILTIN_MASKLOADD256
> +         || d->code == IX86_BUILTIN_MASKLOADQ256)
> +       def_builtin_pure (d->mask, d->mask2, d->name, ftype, d->code);
> +      else
> +       def_builtin (d->mask, d->mask2, d->name, ftype, d->code);
>      }
>    BDESC_VERIFYS (IX86_BUILTIN__BDESC_SPECIAL_ARGS_LAST,
>                  IX86_BUILTIN__BDESC_SPECIAL_ARGS_FIRST,
> --
> 2.26.2
>

Reply via email to