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

--- Comment #5 from Peter Cordes <peter at cordes dot ca> ---
>     pextrw requires sse4.1 for mem operands.

You're right! I didn't double-check the asm manual for PEXTRW when writing up
the initial report, and had never realized that PINSRW wasn't symmetric with
it.  I was really surprised to see that in
https://www.felixcloutier.com/x86/pextrw

So we do need to care about tuning for _mm_storeu_si16(p, v) without SSE4.1
(without the option of PEXTRW to memory).  PEXTRW to an integer register is
obviously bad; we should be doing

    movd  %xmm0, %eax
    mov   %ax, (%rdi)

instead of an inefficient  pextrw $0, %xmm0, %eax ; movw-store

Reported as PR105079, since the cause of the load missed-opt was GCC thinking
the instruction wasn't available, rather than a wrong tuning choice like this
is.

Reply via email to