On 6/16/26 06:30, Peter Maydell wrote:
+#define DO_EXPAND(NAME, TYPE, H) \
+void HELPER(NAME)(void *vd, void *vn, void *vg, uint32_t desc) \
+{ \
+ intptr_t oprsz = simd_oprsz(desc); \
+ ARMVectorReg tn = *(ARMVectorReg *)vn; \
+ intptr_t i = 0, j = 0; \
+ do { \
+ uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \
+ do { \
+ TYPE nn = 0; \
+ if (pg & 1) { \
+ nn = *(TYPE *)((void *)&tn + H(j)); \
+ j += sizeof(TYPE); \
+ } \
+ *(TYPE *)(vd + H(i)) = nn; \
+ i += sizeof(TYPE); \
+ pg >>= sizeof(TYPE); \
+ } while (i & 15); \
+ } while (i < oprsz); \
It looks like in the other macros where we iterate like this
(eg DO_ZPZZ, DO_ZPZ) we write the outer loop as
for (i = 0; i < opr_sz; ) {
...
}
rather than as a do while(). Is there a reason I'm missing why
we need the do-while here ?
Nothing special, no.
Some of the predicate using macros use do/while, e.g. DO_COMPACT. I probably looked at
that one while writing expand.
r~