On 30/10/26 09:08, Philippe Mathieu-Daudé wrote:
On 29/10/26 19:33, Aurelien Jarno wrote:
On 2026-10-28 15:33, Philippe Mathieu-Daudé wrote:
and/or/xor_vec always have VECE 0, yet their constant was matched
as a byte element and applied at the stale SEW of the previous op:
"bic v4.8h, #0xf0" became "vand.vi ..., 15".

Add the 'N' constraint: use the smallest element size at which the
constant replicates, if that element fits simm5, and switch SEW to
it. A wider element can't fit when the smallest doesn't: its upper
half repeats the smaller element, which would then be 0 or -1.


I am still wondering why not propagating VECE for logical ops at the TCG
level, instead of recomputing it at the TCG target level. But this is
how TCG is currently designed,

AND/OR/XOR are bitwise, so VECE doesn't matter to the generic layer.
Indeed propagating it would be a separate tcg-op change.

Reworded in order to clarify:

  and/or/xor_vec are bitwise, so the generic layer doesn't track a
  meaningful VECE for them (it is always 0). The backend nevertheless
  matched the constant as a byte element, and emitted the .vi form at
  whatever SEW the previous op left behind:
  "bic v4.8h, #0xf0" became "vand.vi ..., 15".

  Add the 'N' constraint: find the smallest element size at which the
  constant replicates; the constant matches if that element fits simm5.
  The emitter then sets SEW to that size. A wider element can't fit
  when the smallest doesn't: its upper half repeats the smaller
  element, which would then be 0 or -1.


so:

Reviewed-by: Aurelien Jarno <[email protected]>


Thanks!




Reply via email to