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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Looking at the generated assembly, I see there:
        movw    %di, -80(%rbp)
        vpbroadcastw    -80(%rbp), %ymm1
        vmovdqa %ymm1, -80(%rbp)
I'd have expected
        vmovd   %edi, %xmm1
        vpbroadcastw    %xmm1, %ymm1
        vmovdqa %ymm1, -80(%rbp)
Is there some bug in the *vec_dupv16hi pattern that LRA can't use the !r
alternative?  %di should be valid nonimmediate_operand in HImode.  For e.g.
typedef unsigned short V __attribute__((vector_size (32)));
V foo (unsigned short x)
{
  return (V) { x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x };
}
we emit what I expect.  In the latter case, at *.ira we have:
(insn 2 5 3 2 (set (reg:SI 90 [ x ])
        (reg:SI 5 di [ x ])) pr64110-4.c:3 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 5 di [ x ])
        (nil)))
(note 3 2 4 2 NOTE_INSN_DELETED)
(note 4 3 7 2 NOTE_INSN_FUNCTION_BEG)
(insn 7 4 12 2 (set (reg:V16HI 92 [ D.2291 ])
        (vec_duplicate:V16HI (subreg:HI (reg:SI 90 [ x ]) 0))) pr64110-4.c:4
4233 {*vec_dupv16hi}
     (expr_list:REG_DEAD (reg:SI 90 [ x ])
        (nil)))
and in the former case we have:
(insn 27 36 28 2 (set (reg:SI 178 [ x ])
        (reg:SI 5 di [ x ])) pr64110.c:10 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 5 di [ x ])
        (nil)))
(insn 28 27 29 2 (set (reg/v:HI 177 [ x ])
        (subreg:HI (reg:SI 178 [ x ]) 0)) pr64110.c:10 92 {*movhi_internal}
     (expr_list:REG_DEAD (reg:SI 178 [ x ])
        (nil)))
(note 29 28 89 2 NOTE_INSN_FUNCTION_BEG)
(insn 89 29 247 2 (set (reg:V16HI 214 [ vect_cst_.21 ])
        (vec_duplicate:V16HI (reg/v:HI 177 [ x ]))) 4233 {*vec_dupv16hi}
     (nil))
which isn't that much different...

Reply via email to