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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 33761
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33761&action=edit
WIP patch for discussions

>From what I see, if TARGET_AVX512BW is not defined, then we obviously can't use
ix86_vector_duplicate_value, but need two instructions (either it can be
QI->V32QI / HI->V16HI broadcast followed by concat of the two parts, or
QI->V16QI / HI->V8HI broadcast followed by concat of the 4 parts together).
But, it seems even for -mavx2 or -mavx we actually generate terrible code,
for -mavx2 there is no point in using 2 instructions when in theory
vpbroadcast{b,w} should handle it alone just fine.
The patch enables all of that, but unfortunately we generate perhaps not so
good code with it, e.g. for -mavx2 in testchar32, we spill the argument always
to memory, and then broadcast it from memory, even when vmovd + broadcast from
register could have been used.
And in testchar16, for some reason we spill into memory, and broadcast from
vmovd result (so the spill is totally useless).
Uros/Kyrill, any thoughts on this?

Reply via email to