https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115843

Hongyu Wang <hongyuw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hongyuw at gcc dot gnu.org

--- Comment #8 from Hongyu Wang <hongyuw at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)
> Note while on the GCC 14 branch with the fix as posted I see the correct
> 
>         movl    $-128, %eax
>         vpxor   %xmm2, %xmm2, %xmm2
>         kxorb   %k4, %k4, %k4
>         kmovb   %eax, %k1
>         vmovdqu64       KingSafetyMask1-56(%rip), %zmm0{%k1}{z}
>         vmovdqu64       KingSafetyMask1-48(%rip), %zmm1{%k1}{z}
>         movl    $64, %eax
>         kmovb   %eax, %k2
> ..
> 
> oddly enough on trunk while there's
> 
> (insn 5 26 76 2 (set (reg:QI 4 si [orig:113 loop_mask_57 ] [113])
>         (const_int -128 [0xffffffffffffff80])) "t.c":6:1 91 {*movqi_internal}
>      (expr_list:REG_EQUAL (const_int -128 [0xffffffffffffff80])
>         (nil)))
> (insn:TI 76 5 92 2 (set (reg:QI 73 k5 [orig:113 loop_mask_57 ] [113])
>         (reg:QI 4 si [orig:113 loop_mask_57 ] [113])) "t.c":6:1 91
> {*movqi_internal}
>      (expr_list:REG_DEAD (reg:QI 4 si [orig:113 loop_mask_57 ] [113])
>         (nil)))
> 
> in .dfinish there's
> 
>         movl    $-128, %esi
>         kmovw   %esi, %k5
> 
> in the assembly and we leak extra set bits into %k5.  I have a debug patch
> which then causes the testcase to fail again on trunk but not on the branch.
> How do we end up with kmovw from the above insns?  It looks like
> *movqi_internal might benefit from the new [] syntax - maybe
> alternatives/attributes got mixed up?

movqi_internal will emit kmovw when -mno-avx512dq on kmov alternatives, this
was added in r7-4839-g46e89251c471b2

So I wonder how gcc14 will choose kmovb on just -mavx512vl. The code keeps the
same for this part.

But using kmovw for QImode mask is not correct as we don't know the value in
gpr. Perhaps we'd consider restrict the kmovb under avx512dq only.

Reply via email to