[PATCH 4/4][PR target/88808]Enable bitwise operator for AVX512 masks.
Wed Aug 19 02:26:33 GMT 2020
On Mon, Aug 17, 2020 at 6:08 PM Uros Bizjak <firstname.lastname@example.org> wrote:
> On Fri, Aug 14, 2020 at 10:26 AM Hongtao Liu <email@example.com> wrote:
> > Enable operator or/xor/and/andn/not for mask register, kxnor is not
> > enabled since there's no corresponding instruction for general
> > registers.
> > gcc/
> > PR target/88808
> > * config/i386/i386.md: (*movsi_internal): Adjust constraints
> > for mask registers.
> > (*movhi_internal): Ditto.
> > (*movqi_internal): Ditto.
> > (*anddi_1): Support mask register operations
> > (*and<mode>_1): Ditto.
> > (*andqi_1): Ditto.
> > (*andn<mode>_1): Ditto.
> > (*<code><mode>_1): Ditto.
> > (*<code>qi_1): Ditto.
> > (*one_cmpl<mode>2_1): Ditto.
> > (*one_cmplsi2_1_zext): Ditto.
> > (*one_cmplqi2_1): Ditto.
> > gcc/testsuite/
> > * gcc.target/i386/bitwise_mask_op-1.c: New test.
> > * gcc.target/i386/bitwise_mask_op-2.c: New test.
> > * gcc.target/i386/avx512bw-kunpckwd-1.c: Adjust testcase.
> > * gcc.target/i386/avx512bw-kunpckwd-3.c: Ditto.
> > * gcc.target/i386/avx512dq-kmovb-5.c: Ditto.
> > * gcc.target/i386/avx512f-kmovw-5.c: Ditto.
> index 74d207c3711..e8ad79d1b0a 100644
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -2294,7 +2294,7 @@
> (define_insn "*movsi_internal"
> [(set (match_operand:SI 0 "nonimmediate_operand"
> - "=r,m ,*y,*y,?*y,?m,?r,?*y,*v,*v,*v,m ,?r,?*v,*k,*k ,*rm,*k")
> + "=r,m ,*y,*y,?*y,?m,?r,?*y,*v,*v,*v,m ,?r,?*v,*k,*k ,*rm,k")
> (match_operand:SI 1 "general_operand"
> "g ,re,C ,*y,m ,*y,*y,r ,C ,*v,m ,*v,*v,r ,*r,*km,*k ,CBC"))]
> "!(MEM_P (operands) && MEM_P (operands))"
> I'd rather see *k everywhere, also with *movqi_internal and
> *movhi_internal patterns. The "*" means that the allocator won't
> allocate a mask register by default, but it will be used to optimize
> moves. With the above change, you are risking that during integer
> register pressure, the register allocator will allocate zero to a mask
> register, and later "optimize" the move with a direct maskreg-intreg
> The current strategy is that only general registers get allocated for
> integer modes. Let's keep it this way for now.
Yes, though it would fail gcc.target/i386/avx512dq-pr88465.c and
gcc.target/i386/avx512f-pr88465.c, i think it's more reasonable not to
move zero into mask register directly.
> Otherwise, the patchset LGTM, but please test the suggested changes and repost.
> BTW: Do you plan to remove mask operations from sse.md? ATM, they are
> used to distinguish mask operations, generated from builtins from
> generic operations, so I'd like to keep them for a while. The drawback
> is, that they are not combined with other operations, but at the end
> of the day, this is what the programmer asked for by using builtins.
Agree, I prefer to keep them.
Bootstrap is ok, regression test is ok for i386/x86-64 backend(After
impact for SPEC2017 on SKL.
INT geomean 0.64%
FP geomean 0.66%
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 24005 bytes
Desc: not available
More information about the Gcc-patches