On Wed, Sep 2, 2026 at 11:01 PM Roger Sayle <[email protected]> wrote:
>
>

>         vpinsrb $1, %esi, %xmm0, %xmm0
>         vpbroadcastw    %xmm0, %xmm0
>         ret
>
> bar:    vmovdqa .LC0(%rip), %xmm0
>         vpinsrb $0, %edi, %xmm0, %xmm0
>         vpinsrb $8, %edi, %xmm0, %xmm0
>         ret
>
> There's still more that can be done/improved, but I stopped here
> (1) because the patch is already quite large and (2) I'm not sure
> if the final bar above is optimal (yes in number of instructions),
> or if (v2di){0x12345678abcdefLL,0} is better written as movabs+movq?
We can stop here until we find real opportunity in real workload.


>+  for (i = 0; i < 4; i++)
>+    if (CONST_INT_P (ops[i]) && ops[i] != const0_rtx)
>+      {
>+ val += (UINTVAL (ops[0]) & 0xff) << (i*8);

typo, should be ops[i], not ops[0]?
>+ vars[i] = const0_rtx;
>+      }

>+  bool all_same_p = true;
>+  for (i = 1; i < 16; i++)
>+    if (!rtx_equal_p (ops[i], ops[0]))
>+      {
>+        all_same_p = false;
>+        break;
>+      }
>+  if (all_same_p)
We already handle all_same_p in ix86_expand_vector_init before it
reaches _general, and I didn't see any place with recursively call
which needs to handle all_same_p, so perhaps just remove the code for
all_same_p.

>+    {
>+      ok = ix86_expand_vector_init_duplicate (false, V16QImode,
>+                                              target, ops[0]);
>+      gcc_assert (ok);
>+      return;
>+    }


-- 
BR,
Hongtao

Reply via email to