On Tue, Nov 24, 2020 at 10:36:49AM +0800, Hongtao Liu via Gcc-patches wrote:
> > >       * gcc.target/i386/pr97642-2.c: New test.
> > So in the BZ Jakub asked for the all-ones mask case to be specially
> > handled to emit a normal load.  I don't see where we're handling that.
> > ISTM that we'd want a test for that too.  Right?
> >
> 
> all-ones mask would be simplified to a simple load but with unspec in
> set_src and would be handled by the following
> 
> +(define_insn_and_split "*<avx512>_load<mode>"
> +  [(set (match_operand:V48_AVX512VL 0 "register_operand")
> + (unspec:V48_AVX512VL
> +   [(match_operand:V48_AVX512VL 1 "memory_operand")]
> +   UNSPEC_MASKLOAD))]
> +  "TARGET_AVX512F"
> +  "#"
> +  "&& 1"
> +  [(set (match_dup 0) (match_dup 1))])

It is certainly good to have these insns and splitters, but
the reason I think it is very much desirable to handle this during expansion
too is to avoid creating the UNSPECs in the very common case where
either already from the user, or from all the GIMPLE optimizations the
mask is optimized into all ones.  The UNSPECs then can prevent various
optimizations before splitting is performed, because generic RTL optimizers
don't know anything about what it does.  While for all ones mask it is
easily expressible in RTL by having the most simple RTL for that, plain
load.

        Jakub

Reply via email to